Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: Multiples views - viewModel mapping, with custom naming conventions

$
0
0
Hi,
Here's my problem:
I have a ViewModel which should be displayed in two locations at the same time, using two differents views (a mainView and a ToolBarView).
So I had 3 files:
  • SomeWorkspace.MyViewModel
  • SomeWorkspace.MyView
  • SomeWorkspace.My.ToolBarView
<ContentControl cal:View.Model="{Binding MyViewModel" cal:View.Context="ToolBarView"/>
Everything worked fine, ToolBarView and MyView were displayed correctly.

Yesterday, I needed to support a new ViewModel naming: MyViewModel => MyDocument, but MyViewModel should still be supported.
So I added a rule in the BootStrapper.Configure():
ViewLocator.NameTransformer.AddRule("Document$", "View");
Now the ToolBar isn't displayed anymore (but MyView is).
The arborescence is:
  • SomeWorkspace.MyDocument
  • SomeWorkspace.MyView
  • SomeWorkspace.My.ToolBarView
I'm trying to figure out what happens, but in debug mode I already saw that the documentRule is messing up the ToolBar location.

Can someone helps me ? Maybe the way I added the rule was bad, I'm still on it at the moment.

You can easily reproduce the problem, but I can upload a sample project somewhere if you need.

Thanks,

Ph

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>