Freigeben über


Tricks and tips

IsHitTestVisible – want to draw something on the screen, but have the mouse input pass right through that drawing?  Then set IsHitTestVisible=”false” on it.

Disabling default styling -- Controls actually have two styles for looking up its values - the one specified by Control.Style and the one in the theme.  To ignore the theme style, set OverridesDefaultStyle=”true” (or inside a style, <Setter Property="OverridesDefaultStyle" Value="true" />).  The element’s DefaultStyleKey is used to find the themes style, the key is the entry in the resource dictionary, and means that a subclass will use its base class’s default theme unless the subclass provides a different value for DefaultStyleKey.

Getting an hwnd for a Popup -- ((HwndSource)PresentationSource.FromVisual(popUp)).Handle