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"];
}
Alarosa,We might be dealing with a similar problem. I'm trying to make spatial query work for a point layer and I can't get the markersymbol to show up at all. Maybe if I help you Karma will strike today and I will figure out my problem by solving yours and/or someone like you will help me. Here's my post if you want to check it out and return the favor if I help. http://forums.arcgis.com/threads/14622-Super-Easy-Point-GraphicIn the mean time here's what I think I know. In your code behind C# you have this which is working with your xaml storyboardThe FillSymbol is being passed
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);
}
}
And then here's your Story for you Fill mouse over and out
<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>
In your xaml you should also have Default fill or initail, which should look like this mine is yellow
<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>
You also need this in your xaml to, in your map declar area ---- Actually I don't think you need this so don't add this...
<esri:GraphicsLayer ID="MySelectionGraphicsLayer"
MouseEnter="GraphicsLayer_MouseEnter"
MouseLeave="GraphicsLayer_MouseLeave" />
Oh one more thing in your code behind, under your Public MainPage you need initialize your DefaultFillSymbol
_drawSurface = new Draw(Map)
{
FillSymbol = LayoutRoot.Resources["DefaultFillSymbol"] as FillSymbol
};
Sorry for all the bad/hack language I barely read code and really haven't mastered the correct terms.David.