zoukankan      html  css  js  c++  java
  • Windows Phone关于 Llistpicker用法

    首先 你要确认 你有安装Toolkit,然后添加引用,在工程中添加引用。点击Project–Add Reference–.Net选项卡,下拉,找到Microsoft.Phone.Controls.Toolkit,双击添加

    第一种xaml里面添加

               <toolkit:ListPicker Header="Categories">
    <toolkit:ListPickerItem Content="Johnny" />
    <toolkit:ListPickerItem Content="Tommy" />
    <toolkit:ListPickerItem Content="Alumi" />
    </toolkit:ListPicker>

    CS里面不用写代码

    第二种 XAML里面添加

    <toolkit:ListPicker Header="Default" Height="229" Name="defaultPicker" Width="414" />

    CS里面

    this.defaultPicker.ItemsSource = new List<String>() { "London", "China", "Mexico" };

    第三种颜色选择控件 XAML 

    <toolkit:ListPicker Header="Full ListPicker" Height="217" Name="listPicker1" Width="410" ItemsSource="{Binding}">

    <toolkit:ListPicker.FullModeItemTemplate>

    <DataTemplate>

    <StackPanel Orientation="Horizontal">

    <Rectangle Fill="{Binding}" Width="40" Height="40" Margin="10, 10, 10, 10"/>

    <TextBlock Text="{Binding}" VerticalAlignment="Center"/>

    </StackPanel>

    </DataTemplate>

    </toolkit:ListPicker.FullModeItemTemplate>

    <toolkit:ListPicker.ItemTemplate>

    <DataTemplate>

    <StackPanel Orientation="Horizontal">

    <Rectangle Fill="{Binding}" Width="40" Height="40" Margin="10, 10, 10, 10"/>

    <TextBlock Text="{Binding}" VerticalAlignment="Center"/>

    </StackPanel>

    </DataTemplate>

    </toolkit:ListPicker.ItemTemplate>

    </toolkit:ListPicker>


    CS里面添加

    static readonly string[] AccentColors = { "magenta", "purple", "teal", "lime", "brown", "pink", "orange", "blue", "red", "green" };

    this.listPicker1.DataContext = AccentColors;

    显示效果如下

    ItemCountThreshold属性   设定 当项目大于几个的时候使用新的页面呈现 如上图所示

    SelectedIndex属性  设定 项目的索引





  • 相关阅读:
    Python资源大全中文版
    Python数据结构之字符串
    一头扎进Node系列
    MySQL的安装配置与卸载
    编程日常单词
    ping请求找不到主机 请检查该名称
    Node项目日志管理
    Node版本控制利器
    JavaScript 数据去重的常用几种方法
    一头扎进Node(一)
  • 原文地址:https://www.cnblogs.com/zhibin/p/2379568.html
Copyright © 2011-2022 走看看