Take the 2-minute tour ×

I have a gridView that is using a template. How can I get access to "shadowText" within my C# in order to hide and display these layers?

Taken from MainPage.xaml

   <GridView x:Name="imagesGrid" 
          ItemTemplate="{StaticResource MemeTemplate}" ItemsSource="{Binding}" ItemClick="imagesGrid_ItemClick" IsItemClickEnabled="True" Margin="323,165,91,54" Grid.ColumnSpan="2">
                    <WrapGrid MaximumRowsOrColumns="3" 
                      VerticalChildrenAlignment="Top" HorizontalChildrenAlignment="Center" />

Taken from app.xaml

    <DataTemplate x:Key="MemeTemplate">
        <Grid Background="#FF939598" Height="250" Width="250">
            <Image Source="{Binding ImageBitmap}"  Stretch="UniformToFill"/>
            <StackPanel Name="shadowText" Orientation="Vertical" Background="#CC000000" Height="50" VerticalAlignment="Bottom">
                    Name="memeCategory" Text="{Binding DisplayName}"
                   Margin="10,3,0,0" Width="120" Height="20" 
               TextTrimming="WordEllipsis" HorizontalAlignment="Left"/>
share|improve this question
What are you trying to achieve? Why can't you use data template's triggers? –  Dennis Nov 22 '12 at 8:56
Thanks. I'll look into that –  Frank Sposaro Nov 22 '12 at 8:59
I'm trying to dynamically hide/show the stackpanel in my template or just change the template all together –  Frank Sposaro Nov 22 '12 at 9:05
Does that "dynamically hide/show" depends on any conditions? –  Dennis Nov 22 '12 at 9:07
Yea. What radio button is selected –  Frank Sposaro Nov 22 '12 at 9:07

1 Answer 1

Give your grid a name and use findcontrol

Check if MemeTemplate has find control using intellisense

share|improve this answer
My grid doesn't seem to have this function –  Frank Sposaro Nov 22 '12 at 9:05

Your Answer


