Edw*_*uay 7 wpf xaml observablecollection
我正在显示我从ComboBox中的ViewModel ObservableCollectoin属性获得的所有客户,如下所示:
<ComboBox
ItemsSource="{Binding Customers}"
ItemTemplate="{StaticResource CustomerComboBoxTemplate}"
Margin="20"
HorizontalAlignment="Left"
SelectedItem="{Binding SelectedCustomer, Mode=TwoWay}"/>
Run Code Online (Sandbox Code Playgroud)
有没有办法在不创建另一个ViewModel属性的情况下获取ObservableCollection中的项目数,例如:
伪代码:
<TextBlock Text="{Binding Customers.Count()}"/>
Run Code Online (Sandbox Code Playgroud)
Joa*_*mer 17
ObservableCollection类型公开了一个可以使用的Count属性.我不知道ObservableCollection是否引发了PropertyChanged事件,以便通知UI有关此属性的更新.
归档时间: |
|
查看次数: |
9965 次 |
最近记录: |