How to read Controls defined in App.xaml through code in Silverlight?

Aug 3 2010 6:23 AM

I have defined the following in the App.xaml under Resources.
<Application.Resources>
<Border x:Name="TransformerBorder" BorderBrush="Black" BorderThickness="2" Canvas.Left="15" Canvas.Top="180">
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Canvas.Left="15" Canvas.Top="180">
<Rectangle x:Name="UpperRectangle" Width="25" Height="15" RadiusX="0" RadiusY="15">
<Rectangle.Fill>
<SolidColorBrush Color="White" x:Name="rect1Color" x:Uid="Padma">
</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle x:Name="LowerRectangle" Width="25" Height="15" RadiusX="0" RadiusY="30" Fill="LawnGreen">
</Rectangle>
<StackPanel.Resources>
<Storyboard x:Name="myStoryboard" AutoReverse="True" Duration="0:0:5">
<ColorAnimation
Storyboard.TargetProperty="Color"
Storyboard.TargetName="rect1Color"
From="White"
To="Green"/>
</Storyboard>
</StackPanel.Resources>
</StackPanel>
</Border></Application.Resources>
 
 
Now I need to refer the TransformerBorder, how can I do this? I am not able to access this control from thas App.xaml file.
Can anyone help me out here?
Thanks & Regards
Padma

Answers (1)