private void _featureSelector_SelectionChanged(object sender, SelectionChangedEventArgs e) { DataItem item = (DataItem)_featureSelector.SelectedItem; if (item != null) { _graphicsLayer.ClearGraphics(); CreateGraphic(item); } }
xmlns:esriConverters="clr-namespace:ESRI.ArcGIS.Client.ValueConverters;assembly=ESRI.ArcGIS.Client"> <UserControl.Resources> <esriConverters:DictionaryConverter x:Key="DictConvert" /> </UserControl.Resources> <Grid> <Ellipse Fill="{Binding Path=Attributes, Converter={StaticResource DictConvert}, ConverterParameter=Color, Mode=OneWay}"/> </Grid>
namespace ESRI.ArcGIS.Client.ValueConverters { [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)] public sealed class DictionaryConverter : IValueConverter {
<UserControl.Resources> <DropShadowEffect x:Name="dropShadow" BlurRadius="10" ShadowDepth="10" Direction="-45" Color="Black" Opacity="0.5" /> <local:ToVisibilityConverter x:Key="ToVisibility" /> </UserControl.Resources> <!-- Identify Window --> <local:WindowPanel x:Name="IdentifyPanel" Width="260" Height="364" Effect="{StaticResource dropShadow}" Background="{StaticResource CommonBackgroundBrush}" Visibility="{Binding ElementName=Identify, Path=IsActive, Mode=TwoWay, Converter={StaticResource ToVisibility}}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="30,200,0,0" BorderBrush="{StaticResource CommonBorderBrush}" > <local:Identify x:Name="Identify" Map="{Binding ElementName=Map}" IsActive="False"/> <local:WindowPanel.ContentTitle> <StackPanel Orientation="Horizontal"> <Image Source="Images/IdentifyTool.png" HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Fill" Width="20" Height="20" Margin="5,2,0,0" /> <TextBlock Foreground="White" FontSize="12" Text="Identify" TextWrapping="NoWrap" Height="Auto" HorizontalAlignment="Left" Margin="5,3,0,0" /> </StackPanel> </local:WindowPanel.ContentTitle> </local:WindowPanel>
#region ToVisibilityConverter public sealed class ToVisibilityConverter : IValueConverter { // Methods public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool flag = false; if (value is bool) { flag = (bool)value; } else if (value is bool?) { bool? nullable = (bool?)value; flag = nullable.HasValue ? nullable.Value : false; } else if (value is int) { flag = ((int)value != 0); } else if (value is double) { flag = ((double)value != 0); } return (flag ? Visibility.Visible : Visibility.Collapsed); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return ((value is Visibility) && (((Visibility)value) == Visibility.Visible)); } } #endregion
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.