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属性  设定 项目的索引





  • 相关阅读:
    SQL 查询两个时间段是否有交集的情况 三种写法
    c# 时间区间求并集
    uniapp 身份证识别 微信 百度 图片前端压缩 图片后端压缩
    Git命令大全
    构建android studio项目
    如何查tomcat进程和杀死进程
    mysql 备份 还原不了
    解决git extensions每次要输入用户名和密码
    JS string 转 Byte64[]
    Git cmd
  • 原文地址:https://www.cnblogs.com/zhibin/p/2379568.html
Copyright © 2011-2022 走看看