Silverlight/XAML – Learning by Coding
1: <?xml version="1.0" encoding="UTF-8"?>
2: <!-- coded by Thomas Meinike 08/08 -->
3: <UserControl x:Class="sl2_styling_1.Page"
4: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6: Width="800" Height="600">
7:
8: <UserControl.Resources>
9: <Style TargetType="Rectangle" x:Key="rectstyle">
10: <Setter Property="Stroke" Value="#F00"/>
11: <Setter Property="StrokeThickness" Value="2"/>
12: <Setter Property="Fill" Value="#FFC"/>
13: <Setter Property="Opacity" Value="0.9"/>
14: </Style>
15: </UserControl.Resources>
16:
17: <Canvas>
18: <Rectangle Canvas.Left="30" Canvas.Top="30" Width="200" Height="100"
19: Style="{StaticResource rectstyle}" />
20: <Rectangle Canvas.Left="250" Canvas.Top="42.5" Width="150" Height="75"
21: Style="{StaticResource rectstyle}"/>
22: <Rectangle Canvas.Left="420" Canvas.Top="55" Width="100" Height="50"
23: Style="{StaticResource rectstyle}"/>
24: </Canvas>
25:
26: </UserControl>
[zum Anfang]