外部控件 Windows Phone Toolkit

network | | 访问(46)

下载并引用

在窗体里加入下面的引用

xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

ToggleSwitch 使用

<toolkit:ToggleSwitch Name="OpenPassword" Click="Init_Click" Header="开启密码"
Height="140" HorizontalAlignment="Stretch" Margin="10,200,10,0" VerticalAlignment="Top">
    <toolkit:ToggleSwitch.HeaderTemplate>
        <DataTemplate>
            <ContentControl FontSize="{StaticResource PhoneFontSizeMedium}" Foreground="{StaticResource PhoneForegroundBrush}"
            Content="{Binding}" />
        </DataTemplate>
    </toolkit:ToggleSwitch.HeaderTemplate>
    <toolkit:ToggleSwitch.ContentTemplate>
        <DataTemplate>
            <ContentControl FontSize="{StaticResource PhoneFontSizeLarge}" Foreground="{StaticResource PhoneForegroundBrush}"
            Content="{Binding}" />
        </DataTemplate>
    </toolkit:ToggleSwitch.ContentTemplate>
</toolkit:ToggleSwitch>
<toolkit:ToggleSwitch Name="WifiNoPicModel" Click="Init_Click" Header="仅在Wifi下显示图片"
Margin="10,400,10,0" HorizontalAlignment="Stretch">
    <toolkit:ToggleSwitch.HeaderTemplate>
        <DataTemplate>
            <ContentControl FontSize="{StaticResource PhoneFontSizeLarge}" Foreground="{StaticResource PhoneForegroundBrush}"
            Content="{Binding}" />
        </DataTemplate>
    </toolkit:ToggleSwitch.HeaderTemplate>
    <toolkit:ToggleSwitch.ContentTemplate>
        <DataTemplate>
            <StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="状态: " FontSize="{StaticResource PhoneFontSizeSmall}"
                    />
                    <ContentControl HorizontalAlignment="Left" FontSize="{StaticResource PhoneFontSizeSmall}"
                    Content="{Binding}" />
                </StackPanel>
                <TextBlock Text="Wifi情况下,文章详情,显示图片" FontSize="{StaticResource PhoneFontSizeSmall}"
                Foreground="{StaticResource PhoneSubtleBrush}" />
            </StackPanel>
        </DataTemplate>
    </toolkit:ToggleSwitch.ContentTemplate>
</toolkit:ToggleSwitch>
public void Init() {

    if (OpenPassword.IsChecked == true) {
        OpenPassword.Content = "开启";
    } else {
        OpenPassword.Content = "关闭";
    }

    if (NoPicModel.IsChecked == true) {
        NoPicModel.Content = "开启";
    } else {
        NoPicModel.Content = "关闭";
    }

    if (WifiNoPicModel.IsChecked == true) {
        WifiNoPicModel.Content = "开启";
    } else {
        WifiNoPicModel.Content = "关闭";
    }

    if (DoubleClickReturnKeyQuit.IsChecked == true) {
        DoubleClickReturnKeyQuit.Content = "开启";
    } else {
        DoubleClickReturnKeyQuit.Content = "关闭";
    }

}
<toolkit:ListPicker Name="VoiceReading" Header="语音朗读" Margin="10,680,10,0"
SelectionChanged="VoiceReading_SelectionChanged" Height="300">
    <toolkit:ListPickerItem Content="中国大陆 - 女生" />
    <toolkit:ListPickerItem Content="中国大陆 - 男生" />
    <toolkit:ListPickerItem Content="中国香港 - 女生" />
    <toolkit:ListPickerItem Content="中国香港 - 男生" />
</toolkit:ListPicker>
private void VoiceReading_SelectionChanged(object sender, SelectionChangedEventArgs e) {
    ///在放置ListPicker控件时,需要将下方拉大些,留下足够的空间来显示列表中的内容,否则list中内容无法显示或显示不全。
}