Select to view content in your preferred language

Identify grid close button needed

904
3
02-08-2011 09:11 AM
ElizabethMiller
Regular Contributor
I have created a map that uses the Identify sample to create a datagrid panel with attributes of map features that the user clicks on. None of the ESRI examples seem to have "close" buttons. Can someone supply me with an example of how to add a small "close" button at the top of the attributes grid? I want it to dismiss the Identify and roll up the extended datagrid panel so that the map returns to its original state.

Thanks!
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
You can add a button and on click event change the Visibility of IdentifyResultsPanel to Collapsed.
0 Kudos
ElizabethMiller
Regular Contributor
Thanks, I know that in general, but I need the code -- I'm too much of a newbie! Cutting and pasting is more my style right now!
0 Kudos
ElizabethMiller
Regular Contributor
OK, so I got it working.

In xaml:

<Button Style="{StaticResource CloseButton}" Height="16" Width="16" HorizontalAlignment="Left" Margin="282,5,0,0" Name="CloseButton" VerticalAlignment="Top" Click="CloseButton_Click"/>


In xaml.vb:

Private Sub CloseButton_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)

       IdentifyResultsPanel.Visibility = Visibility.Collapsed

End Sub



In App.xaml:

<Application.Resources>

     

            <!-- CloseButton Style -->
            <Style x:Key="CloseButton" TargetType="Button">
                <Setter Property="Width" Value="30" />
                <Setter Property="Height" Value="12" />
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="VerticalAlignment" Value="Top" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Border Width="12" Height="12" CornerRadius="0,0,3,3">
                                <TextBlock 
                                Foreground="WhiteSmoke" 
                                Text="r" 
                                FontSize="10" 
                                FontFamily="Webdings"
                                TextAlignment="Center"
                                VerticalAlignment="Center"
                            >
                                </TextBlock>
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFDB9F96" Offset="0"/>
                                        <GradientStop Color="#FFBE6D5F" Offset="0.499"/>
                                        <GradientStop Color="#FFA63A29" Offset="0.5"/>
                                        <GradientStop Color="#FFbE6E5A" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

  


</Application.Resources>
0 Kudos