c# - Prism 5.0 Interactivity Call Window -


i way prism 5.0 interactivity works, can open usercontrols , panels , such inside window creates. since cannot place window inside window can't pass view has window root element.

the problem is, when places usercontrol inside window created, window has not minwidth or minheight or resizemode="noresize" option selected, thus, user interface becomes horrible.

are there ways control window's properties can customize want?

ps: amazes me how big , important company microsoft can release best practices library stuff missing that.


as requested, here comes code example:

in order open view in new window in prism, have add current view (the view that's going invoke creation of new window in it's viewmodel):

    <prism:interactionrequesttrigger sourceobject="{binding itemselectionrequest, mode=oneway}">             <!-- popupwindowaction has custom view defined. when action executed view shown inside new window -->             <!-- take account view , view model created once , reused each time action executed -->             <prism:popupwindowaction>                 <prism:popupwindowaction.windowcontent>                     <views:itemselectionview />                 </prism:popupwindowaction.windowcontent>             </prism:popupwindowaction>     </prism:interactionrequesttrigger> 

if change itemselectionview usercontrol window, exception:

window inside window exception

since prism try place window inside window when creates new window , new itemselectionview , tries put 1 inside other...and windows suppose root always, in case window itemselectionview placed child of new window.

more information how works, please go link posted.


for using code behind tweak window, check if usercontrol root of window, , in case teak window's settings (this isn't ideal, still isn't violation of mvvm):

 private void onloaded(object sender, system.windows.routedeventargs e)  {     window parentwindow = window.getwindow(this);     if (parentwindow != null && parentwindow.content == this)     {          parentwindow.resizemode = resizemode.noresize;          parentwindow.sizetocontent = sizetocontent.height;          parentwindow.minheight = this.minheight;                          parentwindow.minwidth = this.minwidth;                     } } 

there pretty simple solution.

since popupwindowaction creates wrapper windows instances of window class, can apply default style type window in app.xaml.

<application.resources>     <style targettype="{x:type rectangle}"/>     <style targettype="{x:type window}">         <setter property="width" value="500"/>         <setter property="resizemode" value="noresize"/>         <setter property="showintaskbar" value="false"/>     </style> </application.resources> 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -