我使用以下代码片段来绑定 ItemsControl 的可见性。
<ItemsControl x:Name="PART_ItemsControl"
Margin="{Binding ExcelLikeFilterAdvVisibility, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource marginConverterForOldExcelLikeFiltering}, ConverterParameter=ItemsControl}"
ItemsSource="{TemplateBinding ItemsSource}"
Visibility="{Binding Path=Items.Count, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource itemsSourceCountConverter}}">
由于此代码段,我在输出窗口中收到以下错误。
错误:
System.Windows.Data Error: BindingExpression path error: 'Items' property not found on 'ToolTipsDemo.StocksViewModel' 'ToolTipsDemo.StocksViewModel' (HashCode=42842654). BindingExpression: Path='Items.Count' DataItem='ToolTipsDemo.StocksViewModel' (HashCode=42842654); target element is 'System.Windows.Controls.ItemsControl' (Name='PART_ItemsControl'); target property is 'Visibility' (type 'System.Windows.Visibility')..