XAML:
<ListBox x:Name="Items"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Label Content="{Binding TimE}"/> <Label Content="{Binding Desc}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
码:
public BindableCollection<MyObject> Items { get { var collection = new BindableCollection<MyObject>(_MyObject); return collection; } } public MyObject SELEctedItem { get; set; }
public class MyObject : PropertyChangedBase { public datetiR_263_11845@e Time { get; set; } public String Desc { get; set; } bool _isSELEcted; public bool IsSELEcted { get { return _isSELEcted; } set { _isSELEcted = value; NotifyOfPropertyChange(); } } }
<ListBox x:Name="Items" SELEctionMode="Multiple"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Label Content="{Binding TimE}"/> <Label Content="{Binding Desc}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}" BasedOn="{Staticresource {x:Type ListBoxItem}}"> <Setter Property="IsSELEcted" Value="{Binding IsSELEcted,Mode=TwoWay}" /> </Style> </ListBox.ItemContainerStyle> </ListBox>
BindableCollection<MyObject> _items = new BindableCollection<MyObject>(); public BindableCollection<MyObject> Items { get { return _items; } } public BindableCollection<MyObject> SELEctedItems { get { _SELEctedItems.Clear(); _SELEctedItems.AddRange(Items.Where(mo => mo.IsSELEcted)); return _SELEctedItems; } }
以上是大佬教程为你收集整理的C#Caliburn.Micro多项选择全部内容,希望文章能够帮你解决C#Caliburn.Micro多项选择所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。