I have a project solution as below
solution with different project in MVVM
The Start Window is MainWindowStart.xaml located in ProjectStart.View with Datacontext ProjectStartViewModel.cs.
MainWindowStart.xaml includes 2 UserControls (MyUC1.xaml, MyUC2.xaml) that are located in a different project (Project1) with DataContext Project1ViewModel.cs as showen. The properties are correctly binded on InitializeComponent() of MainWindow but not working when the property change. It works fine when the user controls are included in a window that is located in a some project of user control
This is the code of Property in a ViewModel ViewModel
private int _IndexTabMain;
public int IndexTabMain
{
get { return _IndexTabMain; }
set
{
if (_IndexTabMain != value)
{
_IndexTabMain = value;
this.RaisePropertyChanged("IndexTabMain");
}
}
}
and this is the code of property binded in MyUC2.xaml that is notified from a selection change in MyUC1.xaml
<TextBlock Text="{Binding DataContext.IndexTabMain, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=UserControl}}">
In advance thank you Manuel