What is best technique for switching Xaml views?

落花浮王杯 提交于 2019-12-11 12:53:44

问题


I have "alternative" xaml views for a viewmodel and I am currently using a technique where I set the style property on the view (containing a control template) and would like to know what is the best/preferred Caliburn technique to re-invoke conventions, bindings, etc., that are setup initially by Caliburn when showing the viewmodel.

I am using a View-Model-First approach, so possibly I am using the wrong technique and should be looking at a way (e.g. View contexts) to have the Viewmodel instigate the change?

Thanks


回答1:


<ContentControl cm:View.Context="{Binding CurrentView, Mode=TwoWay}" cm:View.Model="{Binding}" />

Multiple views over 1 viewmodel technique. Then the folder structure would be slightly different to help organize but namespace is how view is found to place into the contentcontrol content. I use this in multiple projects

Viewmodel logic facilitates the view "switching".



来源:https://stackoverflow.com/questions/22390698/what-is-best-technique-for-switching-xaml-views

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!