zoukankan      html  css  js  c++  java
  • SilverLight学习笔记泛型数据绑定

    泛型数据绑定

    数组绑定

     

    首先拖放一个ComboBox:            <ComboBox x:Name="QYLX" Width="170"></ComboBox>

    定义数组:            int[] myIntArray = new int[5] { 1, 2, 3, 4, 5 };

    Page代码绑定:

                QYLX.ItemsSource = myIntArray;

     

    List<T>) 类绑定

     

                List<string> ListLX=new List<string>();

                ListLX.Add("一般纳税人");

                ListLX.Add("小规模纳税人");

     

                QYLX.ItemsSource = ListLX;

                QYLX.SelectedIndex = 1;

     

    Dictionary<(Of <(TKey, TValue>)>) 类绑定

     

                Dictionary<string, string> openWith = new Dictionary<string, string>();

     

                openWith.Add("txt", "notepad.exe");

                openWith.Add("bmp", "paint.exe");

                openWith.Add("dib", "paint.exe");

                openWith.Add("rtf", "wordpad.exe");

     

               

                QYLX.ItemsSource = openWith.Values;

                QYLX.SelectedIndex = 1;

    Queue<(Of <(T>)>)

     

                Queue<string> numbers = new Queue<string>();

                numbers.Enqueue("one");

                numbers.Enqueue("two");

                numbers.Enqueue("three");

                numbers.Enqueue("four");

                numbers.Enqueue("five");

     

     

                QYLX.ItemsSource = numbers;

                QYLX.SelectedIndex = 1;

     

    Stack<(Of <(T>)>)

     

                Stack<string> numbers = new Stack<string>();

                numbers.Push("one");

                numbers.Push("two");

                numbers.Push("three");

                numbers.Push("four");

                numbers.Push("five");

     

     

                QYLX.ItemsSource = numbers;

                QYLX.SelectedIndex = 1;

     

     


     

    关于作者: 王昕(QQ:475660) 在广州工作生活30余年。十多年开发经验,在Java、即时通讯、NoSQL、BPM、大数据等领域较有经验。
    目前维护的开源产品:https://gitee.com/475660
  • 相关阅读:
    关于unicode编码问题——[ASIS 2019]Unicorn shop
    cve-2020-7066 ssrf漏洞——GKCTF2020
    updatexml()报错注入——[极客大挑战 2019]HardSQL
    用户名和密码分开检验产生的mysql注入——[GXYCTF2019]BabySQli
    安恒月赛——Ezunserialize(反序列化字符逃逸)
    记一次Flask模板注入学习 [GYCTF2020]FlaskApp
    [CISCN2019 华北赛区 Day2 Web1]Hack World
    [SUCTF 2019]CheckIn(user.ini文件构成的php后门)
    sql注入用<>绕过被过滤的select ——百度杯9月第二场SQL
    剑指offer32 从上到下打印二叉树(叁)
  • 原文地址:https://www.cnblogs.com/starcrm/p/1351254.html
Copyright © 2011-2022 走看看