how to access elements within a style programatically?

Sep 14, 2010 at 2:51 PM

Hi,

i am using SMFPlayer. I made some modifications with Blend. Now i want to access some elements like grid programatically in order to change the visibility at runtime. Xaml file is like below;

 

<UserControl.Resources>
 <Style x:Key="PlayerStyle1" TargetType="Core:Player">
            <Setter Property="Background" Value="Black"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="VerticalAlignment" Value="Stretch"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Core:Player">
                        <Grid x:Name="PlayerRoot" Background="Black" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" d:DesignWidth="756" d:DesignHeight="387" Margin="323,20,-118,0" Height="297" Width="375">
                            <Grid x:Name="ControllerContainer" Height="40" Margin="-314,0,58,-80" Grid.Row="4" VerticalAlignment="Bottom" d:LayoutOverrides="Height">
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
</UserControl.Resources> 

I want to access ControllerContainer element.

 Thanks.