Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's a good guide to WPF Panels & layout in general?

Tags:

layout

wpf

panel

Is there a good, concise guide to the various behaviors of the controls that inherit from System.Windows.Controls.Panel? Or just a WPF layout guide in general?

In particular, I'm interested in how the panels handle child objects that have width or height set to "Auto" and Horizontal or Vertical Alignment set to "Stretch". Some layouts cause the objects to fill the size of their container, others just cause them to size based on their own content.

like image 455
John Noonan Avatar asked Apr 13 '09 04:04

John Noonan


People also ask

Which panel would be most appropriate to display child elements in columns and rows?

WrapPanel. WrapPanel is used to position child elements in sequential position from left to right, breaking content to the next line when it reaches the edge of its parent container. Content can be oriented horizontally or vertically.

Which panel in WPF is well suited to place elements in an ordered and aligned manner?

Stack panel is a simple and useful layout panel in XAML. In stack panel, child elements can be arranged in a single line, either horizontally or vertically, based on the orientation property.

Can WPF be targeted to Web browser?

WPF Browser applications (or XAML Browser applications, or XBAP) are a specific kind of application that are compiled into . xbap extensions and can be run in Internet Explorer.

What are the basic features of WPF?

WPF provides a comprehensive set of application-development features that include Extensible Application Markup Language (XAML), controls, data binding, layout, 2D and 3D graphics, animation, styles, templates, documents, media, text, and typography.


2 Answers

See http://msdn.microsoft.com/en-us/library/ms754152.aspx for a start... it sounds like you may be particularly interested in the table in the "User Interface Panels" section.

like image 173
kvb Avatar answered Oct 11 '22 11:10

kvb


I would recommend looking at the MSDN entry about panels and this example in particular first. The methods MeasureOverride and ArrangeOverride handle all layout related logic.

like image 23
Simon Broadhead Avatar answered Oct 11 '22 10:10

Simon Broadhead