您的位置:首页 > 其它

一个“>”导致我调试了1个小时才解决问题

2012-04-02 13:23 323 查看
在XAML里面写了如下的代码:

<DataTemplate x:Key="DT_HintCategory">
<Expander HorizontalContentAlignment="Stretch"
ExpandDirection="Down"
Expanded="Expander_Expanded"
Header="AAA"
IsExpanded="{Binding Path=IsExpanded,
Mode=TwoWay}">
<Expander.Content>
<ListBox x:Name="PART_HINTS" IsSynchronizedWithCurrentItem="False">>
<ListBox.ItemsSource>
<PriorityBinding>
<Binding Path="HintsSlow" IsAsync="True" />
<Binding Path="HintsFast" IsAsync="False" />
</PriorityBinding>
</ListBox.ItemsSource>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Expander.Content>
</Expander>
</DataTemplate>


原因就是: <ListBox x:Name="PART_HINTS" IsSynchronizedWithCurrentItem="False">>(多写了一个大于号!)

结果在设计界面显示:An Unhandled Exception has occured: Click here to reload the designer.

在调试过程中,报:

{"Add value to collection of type 'System.Windows.Controls.ItemCollection' threw an exception."}

Inner Exception: {"Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead."}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐