c# - WPF Caliburn.Micro/mvvm Navigation -
i'm building project, , 1 of biggest problems i've come across until navigation.
i've been looking time examples of caliburn.micro/mvvm navigation, seem long , couldn't understand of (beginner here!).
some info project:
want there outer window/shell, menu links/tabs open pages according button clicked inside inner part of shell, , able open change page within one.
i have: shellviewmodel.cs, mainviewmodel.cs, models, , views. for now, need know how make mainviewmodel load inside shellviewmodel on startup(using contentcontrol/frames...), , how move 1 page another.
you write in points, , link me useful examples, , believe continue there. it'd best thorough explanation of stuff if possible.
have read conductors , screens on official documentation.
as simple example, shellviewmodel
conductor
of 1 active screen (i.e. 1 screen becomes active/inactive @ time):
public class shellviewmodel : conductor<iscreen>.collection.oneactive
you can set activeitem
of conductor
view model instance wish active:
this.activateitem(mymainviewmodel);
a collection conductor
type provides items
collection can populate instantiate new windows. viewmodels in items
collection may deactivated not yet closed, , can activate them using activateitem
above. makes easy create menu of open windows using itemscontrol
x:name="items"
in shellview
.
then, create shellview
, can use contentcontrol
, set name same activeitem
property, , caliburn.micro rest:
<contentcontrol x:name="activeitem" />
you can respond activation/deactivation in mainviewmodel
overriding onactivate
/ondeactivate
in class.
Comments
Post a Comment