c# - avalonDock : how to align the tabs to the top right? -
i creating dockingmanager avalondock in xaml file , can't figure out way align tabs creats on top right. on top left side.
like :
i have seen : how set avalondock dockablepane right in wpf not find "resizingpanel" under "dockingmanager"
does knows how ?
here sample of xaml :
<grid> <avalondock:dockingmanager x:name="dockingmanager" margin="0,10,0,-10" documentssource="{binding files}" grid.row="0" > <avalondock:dockingmanager.layoutitemtemplateselector> <panel:paneltemplateselector> <panel:paneltemplateselector.fileviewtemplate> <datatemplate> <view:shooting/> </datatemplate> </panel:paneltemplateselector.fileviewtemplate> </panel:paneltemplateselector> </avalondock:dockingmanager.layoutitemtemplateselector> <avalondock:dockingmanager.layoutitemcontainerstyleselector> <panel:panelstyleselector> <panel:panelstyleselector.startpagestyle> <style targettype="{x:type avaloncontrol:layoutitem}"> <setter property="title" value="{binding model.title}"/> <setter property="tooltip" value="{binding model.startpagetip}"/> <setter property="closecommand" value="{binding model.closecommand}"/> <setter property="iconsource" value="{binding model.iconsource}"/> <setter property="contentid" value="{binding model.contentid}"/> <setter property="canclose" value="false"></setter> </style> </panel:panelstyleselector.startpagestyle> </panel:panelstyleselector> </avalondock:dockingmanager.layoutitemcontainerstyleselector> <avalondock:dockingmanager.layoutupdatestrategy> <panel:layoutinitializer/> </avalondock:dockingmanager.layoutupdatestrategy> </avalondock:dockingmanager>
tabitems hosted in documentpanetabpanel flowdirection property has been set lefttoright in constructor,
i recommend following:
copy following in form dockingmanager located:
private void dockingmanager_layoutupdated(object sender, eventargs e) { var q = findvisualchild<xceed.wpf.avalondock.controls.documentpanetabpanel>(dockingmanager); if (q != null) { q.flowdirection = flowdirection.righttoleft; dockingmanager.layoutupdated -= dockingmanager_layoutupdated; } } public t findvisualchild<t>(dependencyobject obj) t : dependencyobject { (int = 0; < visualtreehelper.getchildrencount(obj); i++) { dependencyobject child = visualtreehelper.getchild(obj, i); if (child != null && child t) return (t)child; else { t childofchild = findvisualchild<t>(child); if (childofchild != null) return childofchild; } } return null; }
copy following in form's constructor after initializecomponent:
dockingmanager.layoutupdated += dockingmanager_layoutupdated;
now , codebehind looks this:
public mainwindow() { initializecomponent(); dockingmanager.layoutupdated += dockingmanager_layoutupdated; } private void dockingmanager_layoutupdated(object sender, eventargs e) { var q = findvisualchild<xceed.wpf.avalondock.controls.documentpanetabpanel>(dockingmanager); if (q != null) { q.flowdirection = flowdirection.righttoleft; dockingmanager.layoutupdated -= dockingmanager_layoutupdated; } } public t findvisualchild<t>(dependencyobject obj) t : dependencyobject { (int = 0; < visualtreehelper.getchildrencount(obj); i++) { dependencyobject child = visualtreehelper.getchild(obj, i); if (child != null && child t) return (t)child; else { t childofchild = findvisualchild<t>(child); if (childofchild != null) return childofchild; } } return null; }
Comments
Post a Comment