Easily extend controls by adding textbox, buttons… on either side.
1
| public class ElementGroup : ItemsControl
|
Attributes
Styles
Name |
ElementGroupBaseStyle |
ElementGroupSolid |
Case
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <hc:UniformSpacingPanel Margin="32" VerticalAlignment="Center" Orientation="Vertical" Spacing="16"> <hc:ElementGroup Orientation="Horizontal" Layout="Stack"> <Button HorizontalAlignment="Stretch" Width="auto" Content="Button"/> <Button HorizontalAlignment="Stretch" Width="auto" Content="Button"/> <Button HorizontalAlignment="Stretch" Width="auto" Content="Button"/> <Button HorizontalAlignment="Stretch" Width="auto" Content="Button"/> </hc:ElementGroup> <hc:ElementGroup Orientation="Horizontal" Width="500"> <ToggleButton HorizontalAlignment="Stretch" Width="auto" Content="ToggleButton"/> <Button HorizontalAlignment="Stretch" Width="auto" Content="Button"/> <ToggleButton HorizontalAlignment="Stretch" Width="auto" Content="ToggleButton"/> <Button HorizontalAlignment="Stretch" Width="auto" Content="Button"/> </hc:ElementGroup> <hc:ElementGroup Orientation="Horizontal" Layout="Stack"> <Border Style="{StaticResource BorderRegion}" Padding="6,0"> <Path Data="{StaticResource ClockGeometry}" Width="16" Height="16" Stretch="Uniform" Fill="{DynamicResource BorderBrush}"/> </Border> <TextBox MinWidth="200"/> <Button Content="Button"/> <ToggleButton Content="ToggleButton"/> </hc:ElementGroup> <hc:ElementGroup> <hc:ElementGroup.ItemsPanel> <ItemsPanelTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> </Grid> </ItemsPanelTemplate> </hc:ElementGroup.ItemsPanel> <TextBox HorizontalAlignment="Stretch" DockPanel.Dock="Left"/> <Button Grid.Column="1" Width="100" Content="Button" DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource ButtonPrimary}"/> </hc:ElementGroup> </hc:UniformSpacingPanel>
|