I have a very simple MVVM Light application which has a textblock and a textbox. What I'm trying to do is set the textblock value to the textbox value using the MVVM Light Toolkit and data binding. When I run the program, the textblock text does not update.
private string _name = "Test Name";
public string Name
{
get
{
return _name;
}
set
{
_name = value;
RaisePropertyChanged("NameChanged");
}
}
Here's the XAML. "Test Name" appears fine but doesn't change to the value of the textbox. Textblock:
<TextBlock x:Name="NameTitle"
Text="{Binding Name}"
Margin="-3,-8,0,0"/>
TextBox:
<TextBox Text="{Binding Name, Mode="TwoWay"}" x:Name="tb"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="40" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="LostFocus">
<commands:EventToCommand Command="{Binding Name}"
CommandParameter="{Binding Text, ElementName=tb}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>