Consider HorizontalAlignment and VerticalAlignment when creating a custom panel

I am trying to create a custom panel in wpf. Here I doubt

  • How can I consider Horizontal Alignment and Vertical Factors by placing elements inside my panel. Should I check these flags in my ArrangeOverride Method?
  • Consider what I want to write a WrapPanel Clone. If the width of the panel is set to "Auto", how to get the actual width of the panel to suit my child's items. I always get ActualWidth / ActualHeight as 0. Am I missing something ???

Please, help.

+3
source share
3 answers

, / , . , StackPanel VerticalAlignment .

Measure() Child. .

+2

, MeasureOverride ArrangeOverride. , . Size, MeasureOverride, . . . , , Measure , , , .

, , , , , , , , .

+1
  • . FrameworkElement .
  • ArrangeOverride , . . , "" - , MeasureOverride.

InternalChildren Children.

0

Source: https://habr.com/ru/post/1785847/


All Articles