In my .xaml I have a textbox "textBox_Input" that is bound to a string
<Grid x:Name="LayoutRoot">
<Button Content="{Binding Source={StaticResource LocStrings}, Path=ConnectDongle}" Command="{Binding ConnectDongleCommand}" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="155" Height="21"/>
<Button Content="{Binding Source={StaticResource LocStrings}, Path=ReadDongleFile}" Command="{Binding ReadDongleFileCommand}" HorizontalAlignment="Left" Margin="11,36,0,0" VerticalAlignment="Top" Width="154"/>
<Button Content="{Binding Source={StaticResource LocStrings}, Path=WriteDongleFile}" Command="{Binding WriteDongleFileCommand}" HorizontalAlignment="Left" Margin="10,63,0,0" VerticalAlignment="Top" Width="155"/>
<TextBox x:Name="textBox_Input" Text="{Binding Path=TextBoxInputText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Height="170" Margin="10,90,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="218"/>
<TextBox Text="{Binding Path=TextBoxInputText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Height="170" Margin="233,90,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="218"/>
</Grid>
The related ViewModel:
public RelayCommand ReadDongleFileCommand { private set; get; }
public void ReadDongleFileCommandExecute()
{
TextBoxInputText += "a"; //this if just for testing
}
private String _textBoxInputText;
public String TextBoxInputText
{
get
{
return _textBoxInputText;
}
set
{
_textBoxInputText = value;
}
}
When pressing the second Button bound to "ReadDongleFileCommand" both get and set of my TextBoxInputText are fired, so the command is working properly, but my TextBox is never updated. I never see any text in this TextBox.
I'm quite new to MVVM so probably I just forgot something simple, but I have no idea what it is.