zoukankan      html  css  js  c++  java
  • 一个“>”导致我调试了1个小时才解决问题

    在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."}

     

  • 相关阅读:
    Android的各版本间的区别总结
    深入浅出Android开发之Surface介绍
    android中完全退出当前应用程序的四种方法
    android离线地图源码
    坐标系
    mysql安装
    linux磁盘空间清理
    HttpClient教程
    TIME_WAIT过多
    c3p0配置详解
  • 原文地址:https://www.cnblogs.com/puncha/p/3877000.html
Copyright © 2011-2022 走看看