c# - Access methods of a class from a control template in a resource dictionary -


i want make windowbaseclass derives window has few custom functionalities. such windowstyle none, have own color scheme applied , have resize logic.

here snippet of xaml contains 1 of 'borders' has mousemove , previewmousedown events.

<rectangle stroke="{x:null}" x:name="top" verticalalignment="top" height="5"   grid.column="1" grid.row="0" previewmousedown="resize"    mousemove="displayresizecursor">                 <rectangle.fill>                     <solidcolorbrush color="{staticresource ocean}"/>                 </rectangle.fill> 

in code behind have methods such resize, drag etc. when contained in window1.xaml/.cs it's working nice.

now want create custom template (in resource dictionary example) color schemes , want previewmousedown rectangle point method defined in class extends window.

can done? appreciated.

i don't think you'd approach quite that. think you'd subclass window , add in custom previewmousedown logic, etc. , set styles new subclass in resource dictionary.

you might want custom attached property.

if previewmousedown, etc. doing logic specific 1 window opposed general functionality, isn't going work out great either way.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -