Reputation: 39
This is my xaml:
<Button x:Name="FlashButton"
BorderThickness="0"
Click="FlashButton_Click">
<Button.ContentTemplate>
<DataTemplate>
<Grid Width="70"
Height="70">
<Ellipse Stroke="White"
StrokeThickness="3"/>
<Image x:Name="FlashButtonImage"
Source="/Assets/Images/flashOn.png" />
</Grid>
</DataTemplate>
</Button.ContentTemplate>
It creates a circle button with a flash image in it. When I press the button I want to change FlashButtonImage source to "/Assets/Images/flashOn.png"
but I can't access the image inside it. Is it a simple way to design this type of button or you can help me with some code for accessing image source?
Upvotes: 0
Views: 41
Reputation: 2616
You should try this code instead:
<Button x:Name="FlashButton"
BorderThickness="0"
Click="FlashButton_Click">
<Grid Width="70"
Height="70">
<Ellipse Stroke="White"
StrokeThickness="3"/>
<Image x:Name="FlashButtonImage"
Source="/Assets/Images/flashOn.png" />
</Grid>
</Button>
Upvotes: 1