Fun with Silverlight2.0系列之三 -- Skinnable动态换肤效果
2008-10-11 11:41:49 来源:WEB开发网资源文件
1<ResourceDictionary
2 xmlns="http://schemas.microsoft.com/client/2007"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:controls="clr-namespace:Skinnable;assembly=Skinnable"
5 xmlns:d="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data">
6
7 <Style TargetType="controls:BasicSkin">
8 <Setter Property="Width" Value="1000" />
9 <Setter Property="Height" Value="800" />
10 <Setter Property="Foreground">
11 <Setter.Value>
12 <SolidColorBrush Color="#FFAF17" />
13 </Setter.Value>
14 </Setter>
15 <Setter Property="ButtonStyle" Value="{StaticResource BubblyButtonStyle}" />
16 <Setter Property="ToggleStyle" Value="{StaticResource BubblyToggleStyle}" />
17 <Setter Property="ToolTipStyle" Value="{StaticResource BubblyToolTipStyle}" />
18 <Setter Property="CheckBoxStyle" Value="{StaticResource BubblyCheckBoxStyle}" />
19 <Setter Property="RadioStyle" Value="{StaticResource BubblyRadioStyle}" />
20 <Setter Property="TextBoxStyle" Value="{StaticResource BubblyTextBoxStyle}" />
21 <Setter Property="CalendarStyle" Value="{StaticResource BubblyCalendarStyle}" />
22 <Setter Property="DayButtonStyle" Value="{StaticResource BubblyDayButtonStyle}" />
23 <Setter Property="MonthButtonStyle" Value="{StaticResource BubblyMonthButtonStyle}" />
24 <Setter Property="DatePickerStyle" Value="{StaticResource BubblyDatePickerStyle}" />
25 <Setter Property="LinkStyle" Value="{StaticResource BubblyLinkStyle}" />
26 <Setter Property="DataGridStyle" Value="{StaticResource BubblyDataGridStyle}" />
27 <Setter Property="ColumnHeaderStyle" Value="{StaticResource BubblyColumnHeaderStyle}" />
28 <Setter Property="RowHeaderStyle" Value="{StaticResource BubblyRowHeaderStyle}" />
29 <Setter Property="RowStyle" Value="{StaticResource BubblyRowStyle}" />
30
31 <Setter Property="Template">
32 <Setter.Value>
33 <ControlTemplate TargetType="controls:BasicSkin">
34 <Grid>
35 <Grid Background="#FFE0E4C1">
36 <Grid.ColumnDefinitions>
37 <ColumnDefinition Width="5*"/>
38 <ColumnDefinition Width="20*"/>
39 <ColumnDefinition Width="5*"/>
40 <ColumnDefinition Width="30*"/>
41 <ColumnDefinition Width="30*"/>
42 <ColumnDefinition Width="5*"/>
43 <ColumnDefinition Width="5*"/>
44 </Grid.ColumnDefinitions>
45 <Grid.RowDefinitions>
46 <RowDefinition Height="5*"/>
47 <RowDefinition Height="10*"/>
48 <RowDefinition Height="10*"/>
49 <RowDefinition Height="14*"/>
50 <RowDefinition Height="14*"/>
51 <RowDefinition Height="10*"/>
52 <RowDefinition Height="10*"/>
53 <RowDefinition Height="22*"/>
54 <RowDefinition Height="5*"/>
55 </Grid.RowDefinitions>
56
57 <Button Grid.Column="1" Grid.Row="1" Margin="2" Height="27" Width="79" Content="Button" Style="{TemplateBinding ButtonStyle}">
58 <Button.ToolTip>
59 <ToolTip Content="Button tooltip" Style="{TemplateBinding ToolTipStyle}"/>
60 </Button.ToolTip>
61 </Button>
62
63 <ToggleButton Grid.Column="1" Grid.Row="2" Margin="5" Height="26" Width="65" Content="toggle" Style="{TemplateBinding ToggleStyle}">
64 <ToggleButton.ToolTip>
65 <ToolTip Content="toggle tooltip" Style="{TemplateBinding ToolTipStyle}"/>
66 </ToggleButton.ToolTip>
67 </ToggleButton>
68
69 <Grid Grid.Column="1" Grid.Row="3">
70 <Grid.RowDefinitions>
71 <RowDefinition Height="10*"/>
72 <RowDefinition Height="20*"/>
73 <RowDefinition Height="20*"/>
74 <RowDefinition Height="20*"/>
75 <RowDefinition Height="20*"/>
76 <RowDefinition Height="10*"/>
77 </Grid.RowDefinitions>
78
79 <CheckBox Content="Checkbox One" Grid.Row="1" IsThreeState="True" Style="{TemplateBinding CheckBoxStyle}"/>
80 <CheckBox Content="Checkbox Two" Grid.Row="2" IsThreeState="True" Style="{TemplateBinding CheckBoxStyle}"/>
81 <CheckBox Content="Checkbox Three" Grid.Row="3" IsThreeState="True" Style="{TemplateBinding CheckBoxStyle}"/>
82 </Grid>
83
84 <Grid Grid.Column="1" Grid.Row="4">
85 <Grid.RowDefinitions>
86 <RowDefinition Height="10*"/>
87 <RowDefinition Height="20*"/>
88 <RowDefinition Height="20*"/>
89 <RowDefinition Height="20*"/>
90 <RowDefinition Height="20*"/>
91 <RowDefinition Height="10*"/>
92 </Grid.RowDefinitions>
93
94 <RadioButton Content="Radio One" Grid.Row="1" Style="{TemplateBinding RadioStyle}" GroupName="a"/>
95 <RadioButton Content="Radio Two" Grid.Row="2" Style="{TemplateBinding RadioStyle}" GroupName="a"/>
96 </Grid>
97
98 <TextBox Grid.Column="1" Grid.Row="5" Width="150" Style="{TemplateBinding TextBoxStyle}"/>
99
100 <Calendar Grid.Column="3" Grid.Row="1" Grid.RowSpan="3" Style="{TemplateBinding CalendarStyle}" DayStyle="{TemplateBinding DayButtonStyle}"
101 MonthStyle="{TemplateBinding MonthButtonStyle}" />
102
103 <DatePicker Grid.Column="3" Grid.Row="4" Grid.RowSpan="3" Margin="10" Style="{TemplateBinding DatePickerStyle}" CalendarStyle="{TemplateBinding CalendarStyle}"/>
104
105 <Grid Grid.Column="1" Grid.Row="6">
106 <Grid.ColumnDefinitions>
107 <ColumnDefinition Width="Auto"/>
108 <ColumnDefinition Width="Auto"/>
109 <ColumnDefinition Width="*"/>
110 </Grid.ColumnDefinitions>
111 <TextBlock Grid.Column="0" Text="This is a " Foreground="#FF1E2B33" FontFamily="Trebuchet MS" FontSize="10.5"/>
112 <HyperlinkButton Grid.Column="1" Content="hyperlink" FontFamily="Trebuchet MS" Style="{TemplateBinding LinkStyle}"/>
113 </Grid>
114
115 <Grid Grid.Column="4" Grid.Row="1" Grid.RowSpan="6" Grid.ColumnSpan="3" Margin="30">
116 <d:DataGrid x:Name="dataGridInstance"
117 Style="{TemplateBinding DataGridStyle}"
118 ColumnHeaderStyle="{TemplateBinding ColumnHeaderStyle}"
119 RowHeaderStyle="{TemplateBinding RowHeaderStyle}"
120 RowStyle="{TemplateBinding RowStyle}"
121 AutoGenerateColumns="True"
122 GridlinesVisibility="Horizontal"
123 HeadersVisibility="All"
124 ColumnHeadersHeight="30">
125 <d:DataGrid.ItemsSource>
126 <controls:CustomerList />
127 </d:DataGrid.ItemsSource>
128 </d:DataGrid>
129 </Grid>
130
131 </Grid>
132 </Grid>
133 </ControlTemplate>
134 </Setter.Value>
135 </Setter>
136 </Style>
137
138</ResourceDictionary>
139
Tags:Fun with Silverlight
编辑录入:爽爽 [复制链接] [打 印]- ››silverlight全屏显示图片
- ››Silverlight MVVM 模式(一) 切近实战
- ››Silverlight for Windows Phone 7开发系列(1):...
- ››Silverlight for Windows Phone 7开发系列(2):...
- ››Silverlight for Windows Phone 7开发系列(3):...
- ››Silverlight for Windows Phone 7开发系列(4):...
- ››Silverlight for Symbian
- ››Silverlight3系列(四)数据绑定 Data Binding 1
- ››silverlight2 游戏 1 你能坚持多少秒
- ››Silverlight开发实践--PicZoomShow
- ››Silverlight自定义控件开发 - 令人懊恼的OnApplyT...
- ››Silverlight 2 RTW中ToolTipService.ToolTip不继承...
更多精彩
赞助商链接