Setting SimpleLineSymbol color using dynamic resource

617
1
12-03-2013 05:49 AM
Labels (1)
TimB
by
New Contributor III
I want to set the color of my SimpleLineSymbol to a dynamic resource so that the color can be bound to my Window.  The xaml below does not work and I can figure out why:

<Grid.Resources>
            <Color x:Key="routeColor">#FF8D8DFB</Color>
            <SolidColorBrush x:Key="routeColorBrush" Color="{DynamicResource routeColor}" />
            <esri:SimpleLineSymbol x:Key="RouteFinalSymbol" Color="{DynamicResource routeColorBrush}" Width="2"   />
</Grid.Resources>

However, the xaml below is fine and it works, but I can't bind the color to the window.

<Grid.Resources>
            <esri:SimpleLineSymbol x:Key="RouteFinalSymbol" Color="#FF8D8DFB" Width="2"   />
</Grid.Resources>

Any ideas on what is wrong?
0 Kudos
1 Reply
DavidLednik
Occasional Contributor II
Hi,

Resources defined at the top code are defined as static resources
So you need to bind them as StaticResource in XAML which is not what you want.

Not really sure if you would be able to bind this dynamically in XAML.
If you want to change line color from a combobox fort example.
You can do it in code behind on change event

David
0 Kudos