wpf - Changing how Caliburn.micro places your usercontrol on a window -


i have app using caliburn.micro , custom window manager. window manager creating own base window can customize , feel across application.

i add controls on window like:

<dockpanel>     <contentpresenter content="{binding customcontent}" />     <statusbar height="20" dockpanel.dock="bottom" background="blue"/> </dockpanel> 

i have caliburn put usercontrol viewmodel in contentpresenter, caliburn replacing entire content of window.

i did in window:

using system.windows;  namespace caliburncustomwindow {     public partial class windowbase     {         public static readonly dependencyproperty customcontentproperty = dependencyproperty.register("customcontent", typeof (object), typeof (windowbase));          public object customcontent         {             { return getvalue(customcontentproperty); }             set { setvalue(customcontentproperty, value); }         }          public windowbase()         {             initializecomponent();         }     } } 

and modified windowmanager this:

using system.windows; using caliburn.micro;  namespace caliburncustomwindow {     internal class appwindowmanager : windowmanager     {         protected override window ensurewindow(object model, object view, bool isdialog)         {             window window = view window;              if (window == null)             {                 if (view.gettype() == typeof (mainview))                 {                     window = new windowbase                     {                         customcontent = view,                         sizetocontent = sizetocontent.manual                     };                      window.height = 500;                     window.width = 500;                 }                  window.setvalue(view.isgeneratedproperty, true);             }             else             {                 window owner2 = inferownerof(window);                 if (owner2 != null && isdialog)                 {                     window.owner = owner2;                 }             }             return window;         }     } } 

but doesn't work. binding customcontent dependency property doesn't seem work.

is possible this? if how?

could not either use default windowmanager implementation, , pass in new instance of wrapper dialogviewmodel (and create associated dialogview):

this.windowmanager.showdialog(new dialogviewmodel(myviewmodel)); 

or abstract code in implementation of idialogpresenter or similar if wanted simplify client code:

this.dialogpresenter.show(myviewmodel); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -