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