<ControlTemplate x:Key="CircleMarkerSymbol"> <Ellipse x:Name="ellipse" Fill="{Binding Symbol.Color}" Width="{Binding Symbol.Size}" Height="{Binding Symbol.Size}" <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="SelectionStates"> <VisualState x:Name="Unselected" /> <VisualState x:Name="Selected"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ellipse" Storyboard.TargetProperty="Fill"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{Binding Symbol.SelectionColor}" /> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Ellipse> </ControlTemplate>
using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using ESRI.ArcGIS.Client.Symbols; namespace ESRIEditingTest.SymbolClasses { public class SRPDrawMarkerSymbol : MarkerSymbol { public static readonly DependencyProperty ColorProperty = DependencyProperty.Register("Color", typeof(Brush), typeof(SRPDrawMarkerSymbol), null); public static readonly DependencyProperty SelectionColorProperty = DependencyProperty.Register("SelectionColor", typeof(Brush), typeof(SRPDrawMarkerSymbol), null); public static readonly DependencyProperty SizeProperty = DependencyProperty.Register("Size", typeof(double), typeof(SRPDrawMarkerSymbol), null); // Methods public SRPDrawMarkerSymbol() { this.Color = new SolidColorBrush(Colors.Red); this.SelectionColor = new SolidColorBrush(Colors.Cyan); ResourceDictionary resDict = new ResourceDictionary(); resDict.Source = new Uri("/ESRIEditingTest;component/Themes/ResDict.xaml", UriKind.Relative); ControlTemplate = resDict["CircleMarkerSymbol"] as ControlTemplate; } public Brush Color { get { return (Brush)GetValue(ColorProperty); } set { SetValue(ColorProperty, value); } } public Brush SelectionColor { get { return (Brush)GetValue(SelectionColorProperty); } set { SetValue(SelectionColorProperty, value); } } public double Size { get { return (double)GetValue(SizeProperty); } set { SetValue(SizeProperty, value); } } } }
SRPDrawMarkerSymbol dms = new SRPDrawMarkerSymbol(); dms.Size = 70; dms.Color = new SolidColorBrush(Colors.Green); MapPoint p = e.Geometry as MapPoint; gr = new Graphic { Geometry = p, Symbol = dms };
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.