Silverlight/XAML – Learning by Coding
1: <?xml version="1.0" encoding="UTF-8"?>
2: <!-- coded by Thomas Meinike 09/08 -->
3: <UserControl x:Class="sl2_color_resources.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: <Color x:Key="rot">#FFFF0000</Color>
10: <Color x:Key="gelb">#FFFFFF00</Color>
11:
12: <!-- Die offenbar gültige Alternative funktioniert nicht:
13: <Color x:Key="rot" A="255" R="255" G="0" B="0"/>
14: <Color x:Key="gelb" A="255" R="255" G="255" B="0"/>
15: -->
16:
17: <LinearGradientBrush x:Key="verlauf_rot_gelb">
18: <GradientStop Offset="0" Color="{StaticResource rot}"/>
19: <GradientStop Offset="1" Color="{StaticResource gelb}"/>
20: </LinearGradientBrush>
21: </UserControl.Resources>
22:
23: <Canvas>
24: <Rectangle Canvas.Left="30" Canvas.Top="30" Width="200" Height="100"
25: Fill="{StaticResource verlauf_rot_gelb}"/>
26: </Canvas>
27:
28: </UserControl>
[zum Anfang]