c# - wpf customized windows unable to set neat maximize window -


i have created custom window in wpf using rectangles this link refrence issue maximize button click, have done alot of r&d maximizing neatness below code maximize:

this.rectmain.width = systemparameters.workarea.width;             //this.rectmain.height = system.windows.systemparameters.virtualscreenheight - 35;              this.rectmain.height = systemparameters.workarea.height;              this.recttitlebar.width = systemparameters.workarea.width;             this.windowstartuplocation = windowstartuplocation.centerowner;             //this.recttitlebar.height = systemparameters.workarea.height;              this.dockmenu.width = systemparameters.workarea.width;             this.frmcontent1.width = systemparameters.workarea.width;              this.windowstate = windowstate.maximized; 

when maximize window used little inside above screen please suggest solution set form maximized normal window form gets maximized. below main fromcode:

<window x:class="wpfnavigation.window2"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     title="window2" windowstyle="none" background="transparent"     windowstartuplocation="centerscreen" allowstransparency="true" loaded="window_loaded_1"> <window.commandbindings>     <commandbinding command="navigationcommands.gotopage" executed="gotopageexecutehandler" canexecute="gotopagecanexecutehandler"/> </window.commandbindings> <window.resources>     <style x:key="mybutton" targettype="button">         <setter property="overridesdefaultstyle" value="true" />         <setter property="cursor" value="hand" />         <setter property="template">             <setter.value>                 <controltemplate targettype="button">                     <border name="border" borderthickness="0" borderbrush="black" background="{templatebinding background}">                         <contentpresenter horizontalalignment="center" verticalalignment="center" />                     </border>                     <controltemplate.triggers>                         <trigger property="ismouseover" value="true">                             <setter property="opacity" value="0.8" />                         </trigger>                     </controltemplate.triggers>                 </controltemplate>             </setter.value>         </setter>     </style> </window.resources> <grid>    <rectangle name="rectmain" height="539" stroke="black" verticalalignment="top" margin="2,1,1,-5" fill="white" strokethickness="0"/>     <canvas>         <rectangle x:name="recttitlebar" canvas.top="0"  canvas.right="0"  fill="white" height="19" stroke="black" width="763" strokethickness="0" mousedown="recttitlebar_mousedown" canvas.left="4"/>          <button x:name="minimizebutton" borderbrush="transparent" style="{staticresource mybutton}" canvas.right="57" canvas.top="4" width="20" height="12" click="minimizebutton_click">             <button.background>                 <imagebrush imagesource="resources/minimize.png"></imagebrush>             </button.background>         </button>         <button x:name="maximizebutton" style="{staticresource mybutton}" borderbrush="transparent" canvas.right="30" canvas.top="4" width="20" height="12" click="maximizebutton_click">             <button.background>                 <imagebrush imagesource="resources\maximize.png"></imagebrush>             </button.background>         </button>         <button x:name="closebutton" style="{staticresource mybutton}" borderbrush="transparent" canvas.right="2" canvas.top="4" width="20" height="12" click="closebutton_click">             <button.background>                 <imagebrush imagesource="resources/close.png"></imagebrush>             </button.background>         </button>         <textblock canvas.left="5" fontweight="extrabold" textwrapping="wrap" text="airport portal" canvas.top="0"/>           <dockpanel canvas.top="20" name="dockmenu" grid.rowspan="2" width="763">             <menu name="mainmenu" verticalalignment="top" fontsize="16" borderthickness="1"               fontweight="bold" height="28" dockpanel.dock="top" foreground="white">                 <menu.bitmapeffect>                     <outerglowbitmapeffect></outerglowbitmapeffect>                 </menu.bitmapeffect>                 <menu.background>                     <lineargradientbrush endpoint="0,1" startpoint="0,0">                         <gradientstop color="#ff3a60ad" offset="0.528"/>                         <gradientstop color="#ff6a85d8" offset="0.01"/>                         <gradientstop color="#ff3464c4" offset="1"/>                         <gradientstop color="#ff202e7e" offset="1"/>                     </lineargradientbrush>                 </menu.background>                  <menuitem header="home" command="navigationcommands.gotopage" commandparameter="pages/home.xaml" commandtarget="{binding elementname=frmcontent}" />                 <menuitem header="masters" >                     <menuitem.tooltip>                         <tooltip>                             masters                         </tooltip>                     </menuitem.tooltip>                     <menuitem name="submenuemp"  background="#ff3a60ad" header="employee master">                         <menuitem.icon>                             <image width="20" height="20" source="c:\apps\r&amp;d\wpfnavigation\wpfnavigation\images\employee_master.ico" />                         </menuitem.icon>                         <menuitem.tooltip>                             <tooltip>                                 employee master                             </tooltip>                         </menuitem.tooltip>                         <menuitem name="subsubmenuemp" header="create employee" command="navigationcommands.gotopage" commandparameter="empmaster.xaml" commandtarget="{binding elementname=frmcontent}" background="#ff3a60ad" >                             <menuitem.tooltip>                                 <tooltip>                                     create employee                                 </tooltip>                             </menuitem.tooltip>                         </menuitem>                     </menuitem>                 </menuitem>                 <menuitem header="page 3" command="navigationcommands.gotopage" commandparameter="pages/home.xaml" commandtarget="{binding elementname=frmcontent}" />                 <menuitem header="page without master" command="navigationcommands.gotopage" commandparameter="pages/home.xaml" commandtarget="{binding elementname=frmcontent}" width="174" />             </menu>             <frame navigationuivisibility="visible" name="frmcontent1" grid.column="0" grid.row="1" source="pages/home.xaml" width="764" />         </dockpanel>     </canvas> </grid> 

this should trick , maximize form:

 <window x:class="wpfapplication1.mainwindow"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     title="mainwindow" height="350" width="525"  windowstate="maximized"  windowstyle="none"> 

only these properties! dont use else.

goodluck.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -