0
我已經使用下面的代碼片段來綁定ItemsControl的可視性。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')..
該代碼是完全不可讀的,請格式化...謝謝:) – 2013-04-24 16:49:25
羅伯特你好,請立即檢查。 – 2013-04-24 16:50:26
你的itemscontrol的datacontext似乎是Type StocksViewModel,並且該viewmodel沒有Items屬性 – 2013-04-24 16:51:55