0

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?

Mihai
  • 39
  • 1
  • 10

1 Answers1

1

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>
meneses.pt
  • 2,588
  • 3
  • 27
  • 38