Dice_Rolling() { randomdice = ra.Next(1, 6); if (randomdice == 1) { ImageTools.IO.Decoders.AddDecoder<GifDecoder>(); ImageSource = new Uri("Images/Gif/dice_anim_1.gif", UriKind.RelativeOrAbsolute); this.DataContext = this; } if (randomdice == 2) { ImageTools.IO.Decoders.AddDecoder<GifDecoder>(); ImageSource = new Uri("Images/Gif/dice_anim_2.gif", UriKind.RelativeOrAbsolute); this.DataContext = this; } if (randomdice == 3) { ImageTools.IO.Decoders.AddDecoder<GifDecoder>(); ImageSource = new Uri("Images/Gif/dice_anim_3.gif", UriKind.RelativeOrAbsolute); this.DataContext = this; } } public Uri ImageSource { get; set; } private void button1_Click(object sender, RoutedEventArgs e) { Dice_Rolling(); }