Stack​Panel Class

Definition

Arranges child elements into a single line that can be oriented horizontally or vertically.

public class StackPanel : System.Windows.Controls.Panel, System.Windows.Controls.Primitives.IScrollInfo
Inheritance
Derived
Implements

Inherited Members

System.Object

System.Windows.Controls.Panel

System.Windows.DependencyObject

System.Windows.FrameworkElement

System.Windows.Media.Visual

System.Windows.Threading.DispatcherObject

System.Windows.UIElement

Remarks

A StackPanel contains a collection of UIElement objects, which are in the Children property.

The default value is stretch for both HorizontalAlignment and VerticalAlignment of content that is contained in a StackPanel.

Panel elements do not receive focus by default. To compel a panel element to receive focus, set the Focusable property to true.

StackPanel implements the IScrollInfo interface to support logical scrolling. Logical scrolling is used to scroll to the next element in the logical tree. This is in contrast to physical scrolling, which scrolls content by a defined physical increment in a given direction. If you require physical scrolling instead of logical scrolling, wrap the host StackPanel element in a ScrollViewer and set its CanContentScroll property to false.

Constructors

Stack​Panel()

Initializes a new instance of the StackPanel class.

Fields

Orientation​Property

Identifies the Orientation dependency property.

Properties

Can​Horizontally​Scroll

Gets or sets a value that indicates whether a StackPanel can scroll in the horizontal dimension.

Can​Vertically​Scroll

Gets or sets a value that indicates whether content can scroll in the vertical dimension.

Extent​Height

Gets a value that contains the vertical size of the extent.

Extent​Width

Gets a value that contains the horizontal size of the extent.

Has​Logical​Orientation

Gets a value that indicates if this StackPanel has vertical or horizontal orientation.

Horizontal​Offset

Gets a value that contains the horizontal offset of the scrolled content.

Logical​Orientation

Gets a value that represents the Orientation of the StackPanel.

Orientation

Gets or sets a value that indicates the dimension by which child elements are stacked.

Scroll​Owner

Gets or sets a value that identifies the container that controls scrolling behavior in this StackPanel.

Vertical​Offset

Gets a value that contains the vertical offset of the scrolled content.

Viewport​Height

Gets a value that contains the vertical size of the content's viewport.

Viewport​Width

Gets a value that contains the horizontal size of the content's viewport.

Methods

Arrange​Override(​Size)

Arranges the content of a StackPanel element.

Line​Down()

Scrolls content downward by one logical unit.

Line​Left()

Scrolls content by one logical unit to the left.

Line​Right()

Scrolls content by one logical unit to the right.

Line​Up()

Scrolls content by one logical unit upward.

Make​Visible(​Visual, ​Rect)

Scrolls to the specified coordinates and makes that part of a Visual visible.

Measure​Override(​Size)

Measures the child elements of a StackPanel in anticipation of arranging them during the ArrangeOverride(Size) pass.

Mouse​Wheel​Down()

Scrolls content logically downward in response to a click of the mouse wheel button.

Mouse​Wheel​Left()

Scrolls content logically to the left in response to a click of the mouse wheel button.

Mouse​Wheel​Right()

Scrolls content logically to the right in response to a click of the mouse wheel button.

Mouse​Wheel​Up()

Scrolls content logically upward in response to a click of the mouse wheel button.

Page​Down()

Scrolls content logically downward by one page.

Page​Left()

Scrolls content logically to the left by one page.

Page​Right()

Scrolls content logically to the right by one page.

Page​Up()

Scrolls content logically upward by one page.

Set​Horizontal​Offset(​Double)

Sets the value of the HorizontalOffset property.

Set​Vertical​Offset(​Double)

Sets the value of the VerticalOffset property.