Select to view content in your preferred language

Maptip with a dynamic Gradientstop

907
2
10-05-2012 04:24 AM
DarrenAllport
Deactivated User
Is it possible to change the color of a gradientstop dynamically, dependent on the symbol being shown - via a uniquevaluerenderer?

E.g
Here is my maptip, i can get the gradientstop to look at this

<Color x:Key="GS1">#FF00CC</Color>


<esri:FeatureLayer.MapTip>
                    <Border CornerRadius="10" BorderBrush="#FF222957" BorderThickness="3" Margin="0,0,15,15">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188">
                                <GradientStop Color="{StaticResource GS1}"/>
                                <GradientStop Color="#FF0088FF" Offset="0.946"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Border.Effect>
                            <DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" />
                        </Border.Effect>
                        <StackPanel Margin="7">
                                <TextBlock Text="{Binding [ORG_NAME], Mode=OneWay}" FontWeight="Bold" Foreground="Black"  />
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Type: " Foreground="Black" />
                                <TextBlock Text="{Binding [ORGTP_NAME], Mode=OneWay}" Foreground="Black" />
                            </StackPanel>
                         </StackPanel>
                    </Border>
                </esri:FeatureLayer.MapTip>



and then reference GS1 but i want to pull these colors dynamically, preferably the same way as a uniquevaluerenderer does for a symbol. Basically the background color needs to change dependent on the symbol being shown

so if i could add the gradientstop color to this

<esri:UniqueValueInfo Value="1" Symbol="{StaticResource OOH}" />


then that would solve it i think, but i don't think it's possible?
0 Kudos
2 Replies
HyrumErnstrom
Regular Contributor
You could probably pull that off with an IValueConverter class.

Then create a resource to that IValueConverter class.

You will need to Bind the Color to the Attribute
<LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188">
                                <GradientStop Color="{Binding [ORG_NAME], Converter={StaticResource ColorConverter}}"/>
                                <GradientStop Color="#FF0088FF" Offset="0.946"/>
                            </LinearGradientBrush>
0 Kudos
DarrenAllport
Deactivated User
Thanks. I will investigate this further as i haven't used an IValueConverter before.
0 Kudos