I have a UserControl (MVVM pattern) and a MainWindow. The UserControl Model get all Data and hold it, now i want to access this data from the MainWindow and bind it to a Control.
But how?
EDIT
UserControl.cs:
public UserControl()
{
InitializeComponent();
DataContext = new ViewModel.UserControlViewModel(
new Model.UserControlModel(this.facade));
}
the ViewModel.cs (from UserControl.cs)
public string Status
{
get { return _model.Status; }
set
{
if (value == _model.Status)
{
return;
}
_model.Status = value;
base.NotifyPropertyChanged();
}
}
MainWindow.xaml
<StatusBarItem Grid.Column="1">
<TextBlock x:Name="txtStatus" Text="{Binding Path=???,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
</StatusBarItem>
So it's not so easy (maybe only for me ;) ) to set the DataContext for this