
January 28, 2010 18:47 by
Brian Keating |
Extension Method
internal static class InteropExtensions
{
public static bool? ShowDialog(this System.Windows.Window win, IntPtr handle)
{
WindowInteropHelper helper = new WindowInteropHelper(win);
helper.Owner = handle;
return win.ShowDialog();
}
}
Usage
var win = new WpfWindow();
win.ShowDalog(windowsFormOwnerHandle);
047a28dc-ca7c-4797-b3ce-b879e3a6d1d7|0|.0

December 23, 2009 07:32 by
Brian Keating |
Recently I used PInvoke to check if the SHIFT key was pressed while i was doing a drag operation......
what I should have done then and have done now is
if((Keyboard.Modifiers & ModifierKeys.Shift) != ModifierKeys.None)
Trace.WriteLine("Shift is pressed");
b4e7db5b-222b-4dad-910f-e7fcd6afa33a|0|.0

November 5, 2009 17:53 by
Brian Keating |
One approach for validating child controls on windows froms is to
Validation.
- Add a Validated event handler to all child controls you're interested in.
- On a button event handler call this.ValidateChildren();
This will ensure the validation routine on all child controls will be called, if for example you've added an ErrorProvider control extender to your form you can set it up in the validated event handlers.
18d4c088-00f2-469e-9368-7308a8a013ad|0|.0