nested binding WPF

依然范特西╮ 提交于 2020-01-17 07:36:12

问题


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>

回答1:


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>


来源:https://stackoverflow.com/questions/19519340/nested-binding-wpf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!