My question is about wp7. I’m trying to change the Content of a Button in c# behind-code, after user clicks it. In particular I want to change the Fill property of my three Path elements, that are inside a grid(“GraphGrid”). This grid is the Content of the Button itself.
Here is XAML code about the Button:
<Button.Content>
<Grid x:Name="GraphGrid" Width="Auto" Height="Auto" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Path x:Name="Path"
Data="M 0,0 0,80 20,80 20,0Z"
Stroke="Black"
Fill="Black"
StrokeThickness="0"/>
<Path
Data="M 25,20 25,80 45,80 45,20Z"
Stroke="Black"
Fill="Black"
StrokeThickness="0"/>
<Path
Data="M 50,40 50,80 70,80 70,40Z"
Stroke="Black"
Fill="Black"
StrokeThickness="0"/>
I tried to use keys(such as x:Name…) to refer to my Xaml element in c# behind code, but it doesn’t work.
I hope this will help.