The StackPanel in WPF Controls can arrange with each other.
The property Orientation = horizontal, it is possible to order the elements from left to right.
But there is no property stack items from = "Top ItemControl but requires a panel to represent the objects can be. The default is a StackPanel.
about the items property panel, we can define a ItemsPanelTemplate to specify the other derived from Panel "panel", in which now the items are arranged.
look like the objects determines a DataTemplate. For each item the ItemsControl generates a container (ContentPresenter for ListBox -> ListBoxItem). Since one of these containers can not be directly accessed, defines the ItemsControl a property to the style of the "ItemContainer Set can.
turvy world
To now order the items from the bottom up instead of top to below, as it makes the StackPanel, we need another panel. A DockPanel is suitable because there is more than one possibility, to arrange elements in it. (Top, Left, Right, Bottom).
Now we have to define in ItemContainerStyle that the items should be disposed of in each case below.
ItemsControl
>
\u0026lt; ItemsControl.ItemsPanel
>
< ItemsPanelTemplate
>
< DockPanel
VerticalAlignment
LastChildFill
="False" /> </ ItemsPanelTemplate
>
</ ItemsControl.ItemsPanel
>
< ItemsControl.ItemContainerStyle
>
< Style
>
< Setter
Property
Value
="Bottom"/> </ Style
>
</ ItemsControl.ItemContainerStyle
>
< Button
>
</
Button > < Button
>
\u0026lt;/
Button > \u0026lt; Button
>
\u0026lt;/
Button > \u0026lt;/ ItemsControl
>
Et Voila
0 comments:
Post a Comment