Reputation: 281
Is there a way to make all item in WrapPanel alignment to center?
WrapPanel Normal Behavior
|1234567 |
|890 |
Desired Behavior
| 1234567 |
| 890 |
Possible duplicate link
I just don't understand how to use the code on the answer (on link).
Upvotes: 2
Views: 6554
Reputation: 2133
The link is a custom WrapPanel. just copy it into an empty class and be sure to set all the using
classes at the first lines.
Use this custom panel as you use a normal WrapPanel. (in Xaml is a little bit different).
in this panel there is an extra propert: HorizontalContentAlignment
. Its default value is HorizontalAlignment.Left
. You should set HorizontalAlignment=HorizontalAlignment.Center
.
There is no need to deal with MeasureOverride or ArrangeOverride methods.
Upvotes: 2