嵌套绑定WPF

时间:2013-10-22 13:31:21

标签: wpf binding nested

我正在编写一个自动生成代码的工具。这个工具以这种方式为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>

1 个答案:

答案 0 :(得分:0)

使用

 <Binding Path="CmbColumnCollectionVergiTur">

  </Binding>

或者

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

对于multiBinding,语法应为

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