Hello,
I am facing a design problem and would like your point of view.
I have the following shell :
This ViewModel interface is the following :
But I would like SourceRegion to update the field SourceText of the ParentRegion context and the DestRegion to update the field DestText of the ParentRegion.
What is the best way to do that?
The goal of my question is : what is the best way to solve this problem?
Sincerely,
Linvi
I am facing a design problem and would like your point of view.
I have the following shell :
<ItemsControl prism:RegionManager.RegionName="ParentRegion">
<ContentControl prism:RegionManager.RegionName="SourceRegion" />
<ContentControl prism:RegionManager.RegionName="DestinationRegion" />
</ItemsControl>
An interface of the ViewModel contained in a "core" library shared across the libraries.This ViewModel interface is the following :
public interface IMainRegionViewModel
{
string SourceText { get; set; }
string DestText { get; set; }
}
In my Module my initialize method set the 2 regions with the same type (MyView) :public void Initialize()
{
_regionManager.RegisterViewWithRegion("SourceRegion", typeof(MyView));
_regionManager.RegisterViewWithRegion("DestinationRegion", typeof(MyView));
}
Consequently, during the creation of the MyView class, Unity injects a ViewModel of the same type in both my Views.But I would like SourceRegion to update the field SourceText of the ParentRegion context and the DestRegion to update the field DestText of the ParentRegion.
What is the best way to do that?
- Create 2 different view class inheriting from the same base view which only difference would be a function to override
-
Not using Unity for injecting the View in the regionManager and calling the View constructor with an argument of mine
- I have some thoughts about implementing a delegate function as argument
-
Continue with the same code and share an event in the "Core" library that will use an EventArgs containing an information related with the View.
The goal of my question is : what is the best way to solve this problem?
Sincerely,
Linvi