The Silverlight toolkit for Windows Phone 7.1 Control described earlier is essentially a user-defined control. You can define some controls as needed.
The following is a simple waitingbox with animations:
1. Create: usercontrol inherits the control class "usercontrol". That is to say, all attributes and methods of the control are available. What you need must be expanded by yourself.
XAML:
<Popup X: Name = "waitingwnd" isopen = "true"> <grid width = "300" Height = "400" background = "Transparent" X: name = "layoutroot"> <Image Height = "300" width = "300" horizontalalignment = "Left" name = "image1" stretch = "fill" verticalignment = "TOP"/> <textblock Height = "30" horizontalalignment = "Left" margin = "106,314, 0, 0 "name =" textblock1 "text =" Please wait... "verticalalignment =" TOP "/> </GRID> </popup>
Generally, the background color of the Container Control is set to transparent (background = "Transparent ")
CS:
public partial class WindowsPhoneControl1 : UserControl { DispatcherTimer timer = new DispatcherTimer(); int count = 0; public double Speed { get; set; } public WindowsPhoneControl1() { InitializeComponent(); } private void UserControl_Loaded(object sender, RoutedEventArgs e) { timer.Interval = TimeSpan.FromMilliseconds(Speed); timer.Tick += new EventHandler(timer_Tick); } void timer_Tick(object sender, EventArgs e) { image1.Source = new BitmapImage(new Uri("Images/" + count + ".png", UriKind.Relative)); count=(count==7?0:count+1); } public void WaitingBegin() { if (timer == null) { timer = new DispatcherTimer(); } timer.Start(); WaitingWnd.IsOpen = true; } public void WaitingEnd() { timer.Stop(); WaitingWnd.IsOpen = false; } }
You have extended a speed attribute and remember to set it when using it.
After compilation, you can see the defined control in the toolbar.
Use: drag and drop to set the speed attribute.
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <my:WindowsPhoneControl1 Speed="200" HorizontalAlignment="Left" Margin="82,96,0,0" x:Name="windowsPhoneControl11" VerticalAlignment="Top" Height="400" Width="300" /> </Grid>
Windowsphonecontrol11.waitingbegin ();//
Waitingbox1.waitingend ();
The World Wide Web is a good thing. The picture comes from the dark blue right hand. This animation was used in Silverlight game development before, so it can be used directly ~ I would also like to thank Xiao Zhen for his selfless dedication and learning and making progress together ~