c# - WPF HitTest Window thumb area? -
i have wpf
window, custom 'header'/'thumb' template. custom meaning - couple of buttons added window 'thumb'
the problem i'm trying solve - 'turn off' window header double-click functionality (which maximizes window default)
what did - subscribed window.previewmousedoubleclick
event, , did following
void onpreviewmousedoubleclick(object sender, someargs e){ e.handled = true }
my problem - need if double click happened in thumb area. (the code above disables double click controls in window)
so question how reach thumb element code :
void onpreviewmousedoubleclick(object sender, someargs e){ var pos = e.getposition((uielement) sender); if (visualtreeehelper.hittest(xxxxxxxxxxxxxxxx, post)) e.handled = true }
any ideas should put instead of xxxxxxxxxxxxxxxx ?
i thought should work - null
var z = this.template.findname("headerborder", (frameworkelement)sender);
the answer case quite simpe
private void timerscollectionwindow_onmousedoubleclick(object sender, mousebuttoneventargs e) { //disable double click inside title bar var elem = visualtreehelper.hittest(floatingcontainerheader, e.getposition(floatingcontainerheader)); if (elem != null) e.handled = true; }
due fact devexpress exposes 'floatingcontainerheader' thingy :)
Comments
Post a Comment