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

     

  • 相关阅读:
    从输入网址到页面呈现的过程
    Git 常用命令合集
    Jquery浅克隆与深克隆
    CSS变量教程
    设计模式
    Servlet和JSP简述
    SQL Server,MySQL,Oracle三者的区别
    mysql事务处理
    计时器
    java中length,length(),size()区别
  • 原文地址:https://www.cnblogs.com/puncha/p/3877000.html
Copyright © 2011-2022 走看看