I wanted to know how I could make a button to load a window that allows me to upload 3 images, so giving the impression of a gif.
If I do a single project everything is fine, but when I do I associate a button does not work for me. Why is that? Can someone help me understand?
This code XAML:
<Image Name="ConnectionImage" Grid.RowSpan="2" Grid.ColumnSpan="2">
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Name="DoubleAnimation_ConnectionTest" Storyboard.TargetName="ConnectionImage"
Storyboard.TargetProperty="Width" From="200" To="200"
Duration="0:0:1.0" Completed="DoubleAnimation_Completed"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
while the code of image is:
int ctr = 1;
private void DoubleAnimation_Completed (object sender, EventArgs e)
{
ShowImage();
DoubleAnimation_ConnectionTest.BeginAnimation(Image.WidthProperty, DoubleAnimation_ConnectionTest);
}
private void ShowImage()
{
string filename = "Images/Connection" + ctr + ".jpg";
BitmapImage image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(filename, UriKind.Relative);
image.EndInit();
ConnectionImage.Source = image;
ctr++;
if (ctr > 3)
{
ctr = 1;
}
}
and button:
private void Button_Test_DB_Click(object sender, RoutedEventArgs e)
{
Window_Test Test_DB = new Window_Test();
Test_DB.Show();
}