私は何年もの間これを理解しようとしてきましたが、困惑しています。
次の XAML があります。
<TextBox x:Name="MyTextBox" Text="{Binding MyName, Mode=TwoWay}" Width="200">
<WinRtBehaviors:Interaction.Behaviors>
<Win8nl_Behavior:EventToCommandBehavior Event="TextChanged"
Command="TextChangedCommand"
CommandParameter="{Binding Text, ElementName=MyTextBox, Mode=OneWay}"/>
</WinRtBehaviors:Interaction.Behaviors>
</TextBox>
そして私のView Modelでは:
public ICommand TextChangedCommand
{
get
{
return new RelayCommand<string>((p) =>
{
var msg = new MessageDialog(string.Format("Hi there {0}", p));
msg.ShowAsync();
});
}
}
しかし、CommanParameter (p) に表示されることを望んでいる文字列値は常に null です。
私は何を間違っていますか?