Free 30 days to Launch!
(not a paid advertisement)
30 Day to Launch Phone
To build games using Silverlight, knowing XAML and how it works is important. Let’s read some existing code, I have gone over code here very carefully, with a bunch of links to references.
>>Tutorial on XML<<
Let’s get the XAML definition out of the way:
Now let’s read the code line by line
1: <UserControl x:Class="RotateThingie.MainPage"
2: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4: Width="400" Height="300">
5: <Canvas Height="200" Width="200">
6:
7: <!-- Rotates the Polyline 45 degrees about the point (0,0). -->
8: <Polyline x:Name="thingie" Points="25,25 0,50 25,75 50,50 25,25 25,0"
9: Stroke="Blue" StrokeThickness="10"
10: Canvas.Left="75" Canvas.Top="50">
11: <Polyline.RenderTransform>
12: <RotateTransform CenterX="0" CenterY="0" Angle="270" />
13: </Polyline.RenderTransform>
14: </Polyline>
15: </Canvas>
16:
17: </UserControl>
Line 1: <UserControl: x:Class=”RotateThingie.MainPage”
Line 2: xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
Line 3: xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
Line 4: Width="400" Height="300">
Line 5: <Canvas Height="200" Width="200">
Line 6: <!-- Rotates the Polyline 45 degrees about the point (0,0). –>
Line 7: <Polyline Points="25,25 0,50 25,75 50,50 25,25 25,0" Line 8: Stroke="Blue" StrokeThickness="10"Line 9: Canvas.Left="75" Canvas.Top="50">
Line 10: <Polyline.RenderTransform>Line 11: <RotateTransform CenterX="0" CenterY="0" Angle="270" />
Line 12: </Polyline.RenderTransform>
Line 13: </Polyline>
Line 14: </Canvas>
Line 15: </UserControl>
That’s it for today.