Ric*_*ães 2 wpf events itemscontrol observablecollection
我有一个ItemsControl对象绑定到ObservableCollection.
这是我的ItemsControl:
<ItemsControl x:Name="AvailableProjects" ItemsSource="{Binding ProjectsList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<CheckBox x:Name="IsProjectSelected" IsChecked="{Binding IsProjectSelected}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
这是我的ObservableCollection:
public ObservableCollection<ProjectInfo> ProjectsList { get; set; }
Run Code Online (Sandbox Code Playgroud)
我希望当用户按下checkBox时,observableCollection的"CollectionChanged"事件被触发但它不起作用.我注意到复选框项正在处理事件,似乎ObservableCollection没有注意到.有人可以帮我这个吗?提前致谢!
小智 6
ObservableCollection目的是通知更改集合,通知修改您必须INotifyPropertyChanged在集合中包含的对象中实现的对象.
| 归档时间: |
|
| 查看次数: |
2549 次 |
| 最近记录: |