是否有一种方法可以仅在纯视图中隐藏xaml中itemscontrol中的第一个项的(combobox(控件?
<ItemsControl ItemsSource="{Binding QueueConditionCollection.Collection,
NotifyOnSourceUpdated=True}"
AlternationCount="2">
<ItemsControl.ItemTemplate>
<DataTemplate>
<ComboBox Name="cmbLogicalOperator"
ItemsSource="{BindingLogicalOperatorCollection.Collection}"
SelectedItem="{Binding LogicalOperatorCollection.Selected,UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
<ItemsControl.ItemTemplate>
</ItemsControl>
实际场景:如果集合只有1个项目,则隐藏控件:请参阅此图片。
您可以声明一个布尔属性,如果Collection.Count((==1,该属性将返回false,并为您的组合框使用布尔到可见性转换器