WPF Layout

The past week , I have been working on Tong Hin’s inventory module layout .

Why is layout important ?
Setting a layout is so important to an application usability . Arranging controls based on explicit coordination may work for one environment , but as soon as we change its screen resolution or with different font sizes it will fail .

Therefore , I realized the best practices when creating any layout is to :-

  1. Avoid fixated sizes of height/width . Use the HorizontalAlignment/VerticalAlignment properties together with Margin to position elements in the layout
  2. Practice using a StackPanel to layout buttons of a dialog
  3. Practice using Grid to layout static data entry form . Create Auto sized columns and Star(Asterisk) sized columns for the elements

Additionally , if the layout is too big to fit the resolution size , we can add a scroll bar by using the ScrollViewer property. The visibility of the ScrollViewer can be set using the ScrollbarVisibility properties .

Any beginners should practice these useful tips before starting a UI layout development in WPF . That is all for this week .

Leave a Reply