我正在显示从 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()}"/>