Reputation: 229
I have one image button in Silverlight
in initial load it will show demo1
image, whenever I click on that button i should change image to demo2
.
<Button x:Name="demo"
IsEnabled="False"
Click="demo_Click"
ToolTipService.ToolTip="demo"
Width="25"
Height="25"
VerticalAlignment="Bottom"
HorizontalAlignment="Left"
Margin="0,0,0,25">
<Image x:Name="demo-image" Source="/demo.content;component/demo1.png"/>
</Button>
Upvotes: 0
Views: 1748
Reputation: 15971
First of all, remove IsEnabled="False"
from the Button
XAML. Then simply implement the demo_Click
event handler in your code-behind as follows:
private void demo_Click(object sender, RoutedEventArgs e)
{
demo_image.Source = new BitmapImage(
new Uri("/demo.content;component/demo2.png", UriKind.Relative));
}
Upvotes: 1