A WPF component for displaying a list of elements in a horizontal or vertical stack.
Questions tagged [stackpanel]
629 questions
210
votes
11 answers
How do I space out the child elements of a StackPanel?
Given a StackPanel:
Apple
Banana
Cherry
What's the best way to space out the child elements so that there are…

GraemeF
- 11,327
- 5
- 52
- 76
174
votes
9 answers
Align items in a stack panel?
I was wondering if I can have 2 controls in a horizontal-oriented StackPanel so that the right item should be docked to the right side of the StackPanel.
I tried the following but it didn't work:
…

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
127
votes
5 answers
How to add a ScrollBar to a Stackpanel
In my WPF application, I have a Stackpanel containing several controls inside them. How can I add a Scrollbar to this stackpanel.

Shamim Hafiz - MSFT
- 21,454
- 43
- 116
- 176
80
votes
5 answers
Aligning controls on both left and right side in a stack panel in WPF
I have the following code:

Michel Keijzers
- 15,025
- 28
- 93
- 119
79
votes
9 answers
How can I get ScrollViewer to work inside a StackPanel?
In the following WPF XAML the ScrollViewer does not work (it displays a scroll bar but you cannot scroll and the contents go off the window to the bottom).
I can change the outer StackPanel to a Grid and it will work.
However, in my application from…

Edward Tanguay
- 189,012
- 314
- 712
- 1,047
77
votes
5 answers
Padding on StackPanel?
I am trying to set padding of a StackPanel but there ain't such property.
I tried StackPanel.Border, but there is no such property either.
Any ideas?

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
58
votes
1 answer
What is the difference between a StackPanel and DockPanel in WPF?
What can a DockPanel do that a StackPanel cannot? If anyone has an image of something that can be achieved with a StackPanel, but not a DockPanel, than that would be great.

Casebash
- 114,675
- 90
- 247
- 350
54
votes
3 answers
Set a border around a StackPanel.
Here's my XAML code:
delete
41
votes
7 answers
How can a WPF StackPanel fill vertically from bottom to top?
I need to be able to fill a stackpanel with buttons but the buttons must appear at the bottom of the stackpanel first and populate upwards. The buttons are created dynamically and there's an unknown number of them so visual hackery just won't work.…

EightyOne Unite
- 11,665
- 14
- 79
- 105
39
votes
4 answers
Silverlight: stretching to remaining space in StackPanel
I have a vertical StackPanel with two elements: a Button and a ListBox. How can I have the ListBox stretch to the remaining page height?
36
votes
2 answers
WPF VirtualizingStackPanel for increased performance
I would like a simple description of how to implement a virtualizingstackpanel for an ItemsControl that is databound to an ObservableCollection in my MVVM.
I have an ItemsControl instance for each tab in a tab control, and switching tabs becomes…

bluebit
- 2,987
- 7
- 34
- 42
33
votes
5 answers
Let TextBox stretch to fill width in StackPanel
I have a StackPanel in my WinRT C# Metro app that I want to use as container for a label/value pair (TextBlock and TextBox) like this:

Matthias
- 3,403
- 8
- 37
- 50
28
votes
3 answers
VirtualizingStackPanel + MVVM + multiple selection
I have implemented a selection pattern similar to the one described in this post using a ViewModel to store the IsSelected value, and by binding the ListViewItem.IsSelected to the ViewModel IsSelected: