Friday 15 August 2014

c# - WPF Windows Navigation -



c# - WPF Windows Navigation -

i'm in planning of creating windows wpf application of below image structure.

when take 'class creator', in right hand side want load classcreator.xaml , when take 'text replacer', in right hand side want load textreplace.xaml. how can navigate in above manner.

<grid> <dockpanel lastchildfill="true"> <listbox horizontalalignment="left" name="toolmenu" width="100"> <listboxitem content="class creator" /> <listboxitem content="text replacer" /> </listbox> <border borderbrush="silver" borderthickness="1" name="border1" /> </dockpanel> </grid>

use frame host navigate contents.

<grid> <dockpanel lastchildfill="true"> <listbox horizontalalignment="left" name="toolmenu" width="100"> <listboxitem content="class creator" /> <listboxitem content="text replacer" /> </listbox> <border borderbrush="silver" borderthickness="1" name="border1"> <frame x:name="frame1" source="classcreator.xaml" /> </border> </dockpanel> </grid>

then in listbox's selectionchanged event handler, navigate view following

frame1.navigate(new uri("textreplace.xaml", urikind.relative));

update: alternatively

the layout construction fits of tabcontrol. can style tabcontrol according layout, tab headers on left, , tab items on right.

<grid> <tabcontrol tabstripplacement="left"> <tabcontrol.resources> <style targettype="{x:type tabitem}"> <setter property="headertemplate"> <setter.value> <datatemplate> <contentpresenter content="{templatebinding content}"> <contentpresenter.layouttransform> <rotatetransform angle="270" /> </contentpresenter.layouttransform> </contentpresenter> </datatemplate> </setter.value> </setter> <setter property="padding" value="3" /> </style> </tabcontrol.resources> <tabitem header="class creator"> <local:classcreator /> </tabitem> <tabitem header="text replacer"> <local:textreplacer /> </tabitem> </tabcontrol> </grid>

c# wpf xaml

No comments:

Post a Comment