• Wpf checkboxlist


    <Window x:Class="WpfTests.CheckedListBox"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         Title="CheckedListBox" Height="300" Width="300">    <ListBox ItemsSource="{Binding TheList}">       <ListBox.ItemTemplate>          <DataTemplate>             <CheckBox IsChecked="{Binding IsSelected}" Content="{Binding TheText}"/>          </DataTemplate>       </ListBox.ItemTemplate>    </ListBox> </Window>

     
    using System; using System.Windows; using System.Collections.Generic; using System.Collections.ObjectModel;  namespace WpfTests {    public partial class CheckedListBox : Window    {       public ObservableCollection<BoolStringClass> TheList{ get; set; }              public CheckedListBox()       {          InitializeComponent();           TheList = new ObservableCollection<BoolStringClass>();          TheList.Add(new BoolStringClass { IsSelected = true, TheText = "Some text for item #1" });          TheList.Add(new BoolStringClass { IsSelected = false, TheText = "Some text for item #2" });          TheList.Add(new BoolStringClass { IsSelected = false, TheText = "Some text for item #3" });          TheList.Add(new BoolStringClass { IsSelected = false, TheText = "Some text for item #4" });          TheList.Add(new BoolStringClass { IsSelected = false, TheText = "Some text for item #5" });          TheList.Add(new BoolStringClass { IsSelected = true, TheText = "Some text for item #6" });          TheList.Add(new BoolStringClass { IsSelected = false, TheText = "Some text for item #7" });           this.DataContext = this;       }    }     public class BoolStringClass    {       public string TheText { get; set; }       public bool IsSelected { get; set; }    } }
  • 相关阅读:
    php中获取各种路径
    大型网站系统架构演化之路
    404、500、502等HTTP状态码介绍
    Linux 查看进程和删除进程
    mysql中FIND_IN_SET的使用方法
    PHP导出Excel 数字末尾变0或小数点解决办法
    PHP API接口测试小工具
    要慎用mysql的enum字段的原因
    mysql 导入&导出sql文件
    Linux下php安装memcache扩展
  • 原文地址:https://www.cnblogs.com/dodui/p/2507961.html
Copyright © 2020-2023  润新知