toggleSwitch控制項為Silverlight for Windows Phone Toolkit 控制項包中的開關控制項。
其Xaml代碼為:
View Code
1 <Grid x:Name="LayoutRoot" Background="Transparent">
2 <Grid.RowDefinitions>
3 <RowDefinition Height="Auto"/>
4 <RowDefinition Height="*"/>
5 </Grid.RowDefinitions>
6 <toolkit:ToggleSwitch IsChecked="true" Grid.Row="1" Header="開關控制項" Height="116" HorizontalAlignment="Left" Margin="12,28,0,0" Name="toggleSwitch1" VerticalAlignment="Top" Width="456" />
--自訂樣式控制項
View Code
1 <toolkit:ToggleSwitch Grid.Row="1" Header="ToggleSwitch" Height="140" HorizontalAlignment="Left" Margin="12,150,0,0" Name="toggleSwitch2" VerticalAlignment="Top" Width="456">
2 <toolkit:ToggleSwitch.HeaderTemplate>
3 <DataTemplate>
4 <ContentControl FontSize="30" Content="測試"></ContentControl>
5 </DataTemplate>
6 </toolkit:ToggleSwitch.HeaderTemplate>
7 <toolkit:ToggleSwitch.ContentTemplate>
8 <DataTemplate>
9 <TextBlock Text="更改其主體"></TextBlock>
10 </DataTemplate>
11 </toolkit:ToggleSwitch.ContentTemplate>
12 </toolkit:ToggleSwitch>
13 </Grid>