I am not able to see any symbol for the states - normal, mouseover, selection - defined in the xaml. I am still trying to understand how it works. Following used codes, hopefully I get help.XAML Code: <Grid x:Name="MapLayout" Width="750" Height="600" Margin="0,75,0,0"> <Grid.Resources> <esri:FillSymbol x:Key="ResultsFillSymbol"> <esri:FillSymbol.ControlTemplate> <ControlTemplate x:Name="CustomMemberTemplate" > <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal" > <Storyboard> <ColorAnimation Storyboard.TargetName="Member" Storyboard.TargetProperty="(Fill).(Color)" To="#880000FF" Duration="0:0:0.1" /> </Storyboard> </VisualState> <VisualState x:Name="MouseOver" > <Storyboard> <ColorAnimation Storyboard.TargetName="Member" Storyboard.TargetProperty="(Fill).(Color)" To="Brown" Duration="0:0:0.1" /> </Storyboard> </VisualState> <VisualState x:Name="Selected" > <Storyboard> <ColorAnimation Storyboard.TargetName="Member" Storyboard.TargetProperty="(Fill).(Color)" To="Orange" Duration="0:0:0.1" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Grid> </ControlTemplate> </esri:FillSymbol.ControlTemplate> </esri:FillSymbol> </Grid.Resources> The cs looks like: foreach (Graphic resultingFeature in args.FeatureSet.Features) { myGraphicsLayer.Graphics.Add(resultingFeature); resultingFeature.Symbol = (FillSymbol)MapLayout.Resources["ResultsFillSymbol"]; }
</VisualStateManager.VisualStateGroups> <Path x:Name="Member" Stroke="Blue" Fill="Black" StrokeStartLineCap="Round" StrokeThickness="2" StrokeLineJoin="Round" StrokeEndLineCap="Round" /> </Grid> </ControlTemplate> </esri:FillSymbol.ControlTemplate> </esri:FillSymbol>
GraphicsLayer graphicsLayer = Map.Layers["MySelectionGraphicsLayer"] as GraphicsLayer; if (featureSet != null && featureSet.Features.Count > 0) { foreach (Graphic feature in featureSet.Features) { feature.Symbol = LayoutRoot.Resources["ResultsFillSymbol"] as FillSymbol; graphicsLayer.Graphics.Insert(0, feature); } }
<esri:FillSymbol x:Key="ResultsFillSymbol"> <esri:FillSymbol.ControlTemplate> <ControlTemplate x:Name="CustomPolygonTemplate"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"> <Storyboard> <ColorAnimation Storyboard.TargetName="Element" Storyboard.TargetProperty="(Fill).(Color)" To="#FFF5FF45" Duration="0:0:0.1" /> </Storyboard> </VisualState> <VisualState x:Name="MouseOver"> <Storyboard> <ColorAnimation Storyboard.TargetName="Element" Storyboard.TargetProperty="(Fill).(Color)" To="#8800FFFF" Duration="0:0:0.1" /> </Storyboard> </VisualState> <VisualState x:Name="Selected"> <Storyboard> <ColorAnimation Storyboard.TargetName="Element" Storyboard.TargetProperty="(Fill).(Color)" To="#8800FFFF" Duration="0:0:0.1" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Path x:Name="Element" Stroke="Blue" Fill="#880000FF" StrokeStartLineCap="Round" StrokeThickness="2" StrokeLineJoin="Round" StrokeEndLineCap="Round" /> </Grid> </ControlTemplate> </esri:FillSymbol.ControlTemplate> </esri:FillSymbol>
<esri:FillSymbol x:Key="DefaultFillSymbol" > <esri:FillSymbol.ControlTemplate> <ControlTemplate> <Path x:Name="Element" IsHitTestVisible="False" Fill="#66FF0000" Stroke="Red" StrokeThickness="1"/> </ControlTemplate> </esri:FillSymbol.ControlTemplate> </esri:FillSymbol>
<esri:GraphicsLayer ID="MySelectionGraphicsLayer" MouseEnter="GraphicsLayer_MouseEnter" MouseLeave="GraphicsLayer_MouseLeave" />
_drawSurface = new Draw(Map) { FillSymbol = LayoutRoot.Resources["DefaultFillSymbol"] as FillSymbol };
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.