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.