【问题标题】:nested binding WPF嵌套绑定 WPF
【发布时间】:2013-10-22 21:45:37
【问题描述】:

我正在编写一个自动生成代码的工具。此工具以这种方式为 XAML (WPF) 生成代码。在嵌套 Binding 的情况下如何解决这个问题?

我收到以下错误:System.windows.data.binding 没有内容属性。

请帮帮我:)

    <Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:assembly="http://www.vakifbank.com/windows/usercontrols" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:assembly0="http://www.vakifbank.com/windows/commands">
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="442" />
    <ColumnDefinition Width="376*" />
  </Grid.ColumnDefinitions>
  <Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
    <RowDefinition Height="Auto" />
  </Grid.RowDefinitions>
  <assembly:UComboBox SelectedValue="{Binding Path=DtoVergiTuru.VergiTurKodu}" DisplayMemberPath="Code, Description" ParameterGroupCode="VRGVergiTurKodlari" ValueMemberPath="Code" SortMemberPath="Code" Caption="Vergi Tür Kodu" IsRequiredForRead="True" Script="{x:Null}" BehaviourType="Key" Margin="8,2.5,22,2.5">
    <assembly:UComboBox.VisibleColumns>
      <Binding>
        <Binding Path="CmbColumnCollectionVergiTur" />
      </Binding>
    </assembly:UComboBox.VisibleColumns>
    <assembly:UComboBox.InputBindings>
      <KeyBinding Gesture="Return" Modifiers="" Key="Return">
        <KeyBinding.Command>
          <assembly0:DelegateCommand />
        </KeyBinding.Command>
      </KeyBinding>
    </assembly:UComboBox.InputBindings>
  </assembly:UComboBox>
</Grid>

【问题讨论】:

  • 问题是多重绑定。作为绑定> **

标签: wpf binding nested


【解决方案1】:

使用

 <Binding Path="CmbColumnCollectionVergiTur">

  </Binding>

或者

  <Binding>
     <Binding.Path>CmbColumnCollectionVergiTur</Binding.Path>
  </Binding>

对于multiBinding,语法应该是

<MultiBinding Converter="{StaticResource myConverter}"
              >
  <Binding Path="CmbColumnCollectionVergiTur"/>
  <Binding Path="XYZProperty"/>
</MultiBinding>

【讨论】:

  • 我不编写 XAML 代码。工具自动生成。我该如何解决这个问题?
  • 多重绑定语法在我更新的答案中......您将不得不分享您的工具代码,您可以在其中分析多重绑定并为其创建节点
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-19
  • 2010-11-01
相关资源
最近更新 更多