March 12, 2012

Ditch the Grids and Use DockPanels

I have worked extensively with WinForms and WPF/Silverlight and noticed that docking/dock panels are not used that often.  At least this is the case where I work.  I find this surprising given their power and ease of use. Using XAML, why would a programmer choose a complex Grid/StackPanel setup over a DockPanel?  Or on the WinForms side, set the anchor properties for control rather than simplify things with the dock property? Read more

July 28, 2011

Best Practices for Creating and Consuming Modal Dialogs in WinForms

This is an article I wrote a few years ago after seeing some bad coding practices around modal dialogs in WinForms. Bad habits like explicitly closing the dialog form and using custom OK/Cancel flags irked me, so I came up with some best practices. I hope you find them useful. Tip 1: Set the AcceptButton and CancelButton properties Windows Forms have two properties, AcceptButton and CancelButton, for determining what should be done when the user presses the Enter or Escape keys. Read more

© Joe Buschmann 2020