【发布时间】:2009-06-18 12:50:54
【问题描述】:
我正在显示从 ComboBox 中的 ViewModel ObservableCollectoin 属性获得的所有客户,如下所示:
<ComboBox
ItemsSource="{Binding Customers}"
ItemTemplate="{StaticResource CustomerComboBoxTemplate}"
Margin="20"
HorizontalAlignment="Left"
SelectedItem="{Binding SelectedCustomer, Mode=TwoWay}"/>
有没有办法在不创建另一个 ViewModel 属性的情况下获取 ObservableCollection 中的项目数,例如像这样:
伪代码:
<TextBlock Text="{Binding Customers.Count()}"/>
【问题讨论】:
标签: wpf xaml observablecollection