In my ViewModel I have made a property name MessageError, and in the View I make a binding. But somehow the message doesn't get to the view - leave the label/textblock blank.
No matter what I'm trying I cann't see where the problem is. When "run to cursor" I try to step into everything, but doesn't show me any kind of error. It set the message, but doesn't shop up in the view.
I hope one of you can see, where I make an error?
Best regards
Simsen :-)
My viewModel property:
private string _messageError;
public string MessageError
{
get => _messageError;
set
{
_messageError = value;
OnPropertyChanged("MessageError");
}
}
In the viewmodel I have a method witch set the text (no errors when run to cursor)
public void SaveChangesNew()
{
string name = CategoryName;
bool global = CategoryIsGlobal;
bool obsolete = CategoryIsObsolete;
int projectId = ProjectId;
MessageError = "Den er ikke gemt";
}
And the view look likes this
<TextBlock x:Name="TblMessage" Text="{Binding MessageError, Mode=TwoWay}" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" />
<!--<Label x:Name="LblMessage" Content="{Binding Path=MessageError}" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" />-->