c# - WPF: How To Customize Generic Custom Window? -
this tough question, i'll try explain anyway...
i have custom control window used on applicaton. reason did because wanted various windows , dialog boxes customizable across program. i.e., minimize, maximize, close button , frame custom. window templated inside generic.xaml. works , it's good. idea got http://www.codeproject.com/kb/wpf/customframes.aspx
now users of custom window user controls in xaml use mywindow root element:
<mywindow> .... </mywindow>
but i'm trying "inject" elements mywindow user control's xaml. mywindow have container hosting them. example, might want inject toolbar button appears right next minimize button. example, might have user control following (where mywindow root element):
<mywindow> <mywindow.toolbar> <button x:name="blabla"/> </mywindow.toolbar> </mywindow>
this put "blabla" right next minimize button example. i'm wondering if it's possible this. i.e., whole mywindow.toolbar thing. there construct this, attached property or weirder?
it possible, depends on choice of types dependencyproperty
. use ienumerable
, bind mywindow.toolbar
dp itemssource
on internal toolbar
.
<controltemplate> <!-- ... snipped down toolbar ... --> <toolbartray> <toolbar x:name="part_toolbar" /> </toolbartray> </controltemplate>
with appropriate code in onapplytemplate
pull part_toolbar
, create new binding
itemssource
.
edit: rereading question appears missed wanted add elsewhere. suggestion use object
dependency property, contentpresenter
bound mywindow.toolbar
visibility
set if binding not {x:null}
.
Comments
Post a Comment