我可以在同一TextBox Text属性上使用MultiBinding和Binding吗?

时间:2018-04-12 11:01:59

标签: c# wpf xaml mvvm

喜欢标题。我TextBox名为 tbFirstName ,其Text属性与其他属性进行了多重绑定:

<local:CustomContentDialogBox.CommandParameter>
                <MultiBinding Converter="{StaticResource newPerson}">
                    <Binding ElementName="tbID" Path="Text" Mode="OneWay"/>
                    <Binding ElementName="tbFirstName" Path="Text" Mode="OneWay"/>
                    <Binding ElementName="tbSecondName" Path="Text"/>
                    <Binding ElementName="cbHeight" Path="Text" />
                </MultiBinding>
            </local:CustomContentDialogBox.CommandParameter>

稍后在XAML中,我尝试将 tbFirstName 上的Binding用于ICommand,即处理方法blank = new ModelTextClear("");

<TextBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2"
         x:Name="tbFirstName"
         Text="{Binding ClearText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"/>

它不起作用。绑定是问题的两倍吗?

0 个答案:

没有答案