How to access a control in the content of a ToolbarItem

481
3
02-23-2011 09:26 AM
SuiHuang
Occasional Contributor II
I have a toolbar like the following in my silverlight application (it is a simplified code for readability):
 
//...
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
//...
<esri:Toolbar x:Name="StandardToolbar">
                <esri:Toolbar.Items>
                    <esri:ToolbarItemCollection>
                        <esri:ToolbarItem Text="Zoom In">
                            <esri:ToolbarItem.Content>
                                <Border x:Name="bdrZoomIn" BorderBrush="#FFE52020" BorderThickness="2">
                                    <Image ToolTipService.ToolTip="Zoom In" Source="Assets/Images/ZoomIn.png" Stretch="UniformToFill" Margin="0"/>
                                </Border>
                            </esri:ToolbarItem.Content>
                        </esri:ToolbarItem>
                        </esri:ToolbarItemCollection>
                </esri:Toolbar.Items>
            </esri:Toolbar>
//...


There is a border control bdrZoomIn, which is intended to be used to indicated whether a tool is selected. In the C# code I want to access this control to change it is thickness, however, in both of the following ways I attempt to access it I can only get a null value:
this.bdrZoomIn

StandardToolbar.Items[0].Content.FindName("bdrZoomIn")


How can I access it? Is there anyway for me to highlight/unhighlight the tool item image in the code dynamically if there is no way to access it?

Thank you.
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
You can try to perform animation using VisualStates.
0 Kudos
SuiHuang
Occasional Contributor II
Hi jenniferdnery:

    Is there any simple example how to do it?
    Thank you.
0 Kudos
JenniferNery
Esri Regular Contributor
0 Kudos