WPF form inheritences issue -


i have questions concerning issue of form inheritance in wpf. have read there no visual inheritance in wpf forms. write project base form, other forms inheriting it.

some possible solutions use usercontrol, , use inside son form. problem have define again , again in every new form inherits base one.

can implement way, without defining in son-form?

you can use style handle less markup usercontrol (you have set style="{staticresource mywindowstyle}" in every window element). using style can override template of window, putting whatever chrome around window content. add contentcontrol content="{templatebinding content}" wherever want sepcific window's content appear.

unfortunately can't apply windows easily, because setting generic style apply base window control, , each of application's windows of type derives window.

edit: if want specify templated controls in window, can following style:

<style x:key="mywindowstyle" targettype="window">   <setter property="template">     <setter.value>       <controltemplate targettype="window">         <stackpanel>           <button>this button appear on every window</button>           <contentcontrol content="{templatebinding content}" />         </stackpanel>       </controltemplate>     </setter.value>   </setter> </style> 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -