嵌套绑定WPF [英] nested binding WPF

查看:189
本文介绍了嵌套绑定WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个工具,可以自动生成code。该工具生成一个XAML(WPF)code我这样。我该如何解决的情况下这个问题像嵌套绑定?

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

请帮助我:)

 <电网的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/$p$psentation的xmlns:装配=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高度=自动/>
    < RowDefinition高度=自动/>
  < /Grid.RowDefinitions>
  <装配:UComboBox的SelectedValue ={绑定路径= DtoVergiTuru.VergiTurKodu}的DisplayMemberPath =code,说明ParameterGroup code =VRGVergiTurKodlariValueMemberPath =codeSortMemberPath =code标题=Vergi TUR KoduIsRequiredForRead =真脚本={X:空}BehaviourType =密钥页边距=8,2.5,22,2.5>
    <装配:UComboBox.VisibleColumns>
      <&绑定GT;
        <绑定路径=CmbColumnCollectionVergiTur/>
      < /装订>
    < /装配:UComboBox.VisibleColumns>
    <装配:UComboBox.InputBindings>
      <按键绑定手势=返回修饰符=键为返回>
        < KeyBinding.Command>
          < assembly0:DelegateCommand />
        < /KeyBinding.Command>
      < /按键绑定>
    < /装配:UComboBox.InputBindings>
  < /装配:UComboBox>
< /网格和GT;


解决方案

使用

 <绑定路径=CmbColumnCollectionVergiTur>  < /装订>

或者

 <&绑定GT;
     < Binding.Path> CmbColumnCollectionVergiTur< /Binding.Path>
  < /装订>

有关multiBinding,语法应为

 < MultiBinding转换器={StaticResource的myConverter}
              >
  <绑定路径=CmbColumnCollectionVergiTur/>
  <绑定路径=XYZProperty/>
< / MultiBinding>

I'm writing a tool that automatically generate code. This tool generates code for a XAML (WPF) me this way. How can I solve this problem in a situation like that have nested Binding?

i received the error that : System.windows.data.binding does not have a content property .

Pls help me :)

    <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>

解决方案

Use

 <Binding Path="CmbColumnCollectionVergiTur">

  </Binding>

Or

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

For multiBinding, the syntax should be

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

这篇关于嵌套绑定WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆