Class WindowUtilities

WPF Helpers for MM

System.Object
  MarkdownMonster.Windows.WindowUtilities
public class WindowUtilities : object

Class Members

MemberDescription

Constructor

BitmapSourceToBitmap

Converts a bitmap source to a bitmap Make sure to dispose the bitmap

public static Bitmap BitmapSourceToBitmap(BitmapSource source)

BitmapToBitmapSource

public static BitmapSource BitmapToBitmapSource(Bitmap bmp)

DoEvents

Idle loop to let events fire in the UI

Use SPARINGLY or not at all if there is a better way but there are a few places where this is required.

public static void DoEvents()

FindAnchestor

Finds a type of element in the parent chain of an element

public static T FindAnchestor(DependencyObject current)

FindVisualChild

Finds a particular type of control in the children of a top level control

public static T FindVisualChild(DependencyObject obj)

FixFocus

Forces lost focus on the active control in a Window to force the selected control to databind. Typical scenario: Toolbar clicks (which don't cause a focus change) don't see latest control state of the active control because it doesn't know focus has changed. This forces the active control to unbind

public static void FixFocus(Window window,     Control control)

GetDpi

public static UInt32 GetDpi(IntPtr hwnd,     DpiType dpiType)

public static UInt32 GetDpi(Point point,     DpiType dpiType)

public static UInt32 GetDpi(Window window,     DpiType dpiType)

GetDpiRatio

public static decimal GetDpiRatio(Window window)

public static decimal GetDpiRatio(IntPtr hwnd)

GetScreenDimensions

Returns the active screen's size in pixels

public static Rectangle GetScreenDimensions(Window window)

InvalidateMenuCommands

Invalidates a menu control and all of its subitems by checking Command.IsEnabled property if a command exists

public static void InvalidateMenuCommands(Menu menu)

InvalidateSubmenuCommands

public static void InvalidateSubmenuCommands(MenuItem menuItem)

IsDispatcherDisabled

public static bool IsDispatcherDisabled(Dispatcher dispatcher)

MakeWindowCompletelyTransparent

Call this to make a window completely click through including all controls on it.

public static void MakeWindowCompletelyTransparent(IntPtr hwnd)

SetPerMonitorDpiAwareness

IMPORTANT: This only works if this is called in the immediate startup code of the application. For WPF this means static App() { }.

public static bool SetPerMonitorDpiAwareness(ProcessDpiAwareness type)

xCreateKeyboardShortcutBinding

Creates a keyboard shortcut from a

public static KeyBinding xCreateKeyboardShortcutBinding(string ksc,     ICommand command,     object commandParameter)

Requirements

Namespace: MarkdownMonster.Windows
Assembly: markdownmonster.exe

© West Wind Technologies, 2019 • Updated: 01/06/19
Comment or report problem with topic