I have a button that features a grid which in turn contains an image.
<Button Style="{StaticResource ButtonStyle1}" d:LayoutOverrides="GridBox" Margin="0,0,0,2.667" BorderThickness="3" BorderBrush="Black" Name="btn1" Click="btn1_Click">
<Grid>
<Image x:Name="img1" Source="Images/Numbers/1.png" Margin="-10,-3,-10,-5" Stretch="Fill"/>
</Grid>
</Button>
I would like to know if there is a way to access the image holder through code without having to explicitly name it as I have above? If I had several buttons and could do it differently it might be easier.
Thanks
yes you can:
you have to make sure though that the button contains a
Gridwith anImageotherwise you get a cast or null pointer exception.