<Button x:Name="BtnSearch" Height="120" Width="120" Margin="-20,-30,0,0" Click="BtnSearch_Click" BorderThickness="0" BorderBrush="{x:Null}" Visibility="Visible" >
<Button.Background>
<ImageBrush x:Name="searchImage" ImageSource="images\appbar.feature.search.rest.png" Stretch="Fill"/>
</Button.Background>
In the above xaml I have to change the imagesource programmatically to a different image. How do I do it ?
Use
searchImage.ImageSource =
new BitmapImage(new Uri(imgPath, UriKind.Relative));
to change the image associated with background image brush.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With