Is it correct to change model instances in runtime? My control was bound to first instance, but during the program execution I d like to bind them to another instance.
somewheere in ViewModel class :
//ViewDefault - already initialized
// View - will be ready later
public string TextProperty
{
get
{
if (View != null)
{
return View.Model.text;
} return ViewDefault.Model.text;
}
set
{
if(View != null)
{
//.. logic with View.Model.text
}else{
// logic with ViewDefault.Model.text
}
RaiseOnPropertyChanged("TextProperty");
}
The question is - what I must do to notify my View that a binding content is changed?
<Setter Property="Text" Value="{Binding MyViewModel.TextProperty, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
*ViewDefault.Model and View.Model have one type