1. Add a dll file in the toolbox
2. This control is displayed in the toolbar and The xaml file is filled in.
1 <UserControl 2 xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" 4 xmlns: d = "http://schemas.microsoft.com/expression/blend/2008" 5 xmlns: mc = "http://schemas.openxmlformats.org/markup-compatibility/2006" 6 7 xmlns: controls = "clr-namespace: ImageTools. controls; assembly = imageconls. controls "8 x: Class =" SilverlightApplication15.MainPage "9 10 mc: Ignorable =" d "11 d: DesignHeight =" 300 "d: designWidth = "400"> 12 13 <Grid x: Name = "LayoutRoot" Background = "White"> 14 <Controls: AnimatedImage x: name = "animatedImage1" HorizontalAlignment = "Left" Height = "236" Margin =, 319 "VerticalAlignment =" Top "Width =" "/> 15 </Grid> 16 </UserControl>View Code
3. write code in xaml. cs
1 using ImageTools; 2 using ImageTools. IO. gif; 3 using System; 4 using System. collections. generic; 5 using System. linq; 6 using System. net; 7 using System. windows; 8 using System. windows. controls; 9 using System. windows. statements; 10 using System. windows. input; 11 using System. windows. media; 12 using System. windows. media. animation; 13 using System. windows. media. imaging; 14 using System. windows. shapes; 15 16 namespace SilverlightApplication1517 {18 public partial class MainPage: UserControl19 {20 public MainPage () 21 {22 InitializeComponent (); 23 Initializedata (); 24} 25 private void Initializedata () 26 {27 ImageTools. IO. decoders. addDecoder <GifDecoder> (); 28 imagcols. extendedImage imgt = new ImageTools. extendedImage (); 29 imgt. uriSource = new Uri ("3.gif", UriKind. relativeOrAbsolute); 30 animatedImage1.Source = imgt; 31} 32} 33}View Code