Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Floating Panel (overlapping with align)

Tags:

c#

wpf

Is it somehow possible to float (overlapping with align) children in a panel in wpf. I have 4 Buttons that overlap each other. They need to align to the left, right, top and bottom and grow with the parent container. Please take a look on the image for more information.

enter image description here

like image 818
MR.ABC Avatar asked Aug 29 '26 01:08

MR.ABC


1 Answers

How about this?

<Grid>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Button Grid.Row="1" Grid.Column="0" Content="Left"/>
        <Button Grid.Row="1" Grid.Column="1" Content="Right"/>
    </Grid>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>

        <Button Grid.Row="0" Grid.Column="1" Content="Top"/>
        <Button Grid.Row="1" Grid.Column="1" Content="Bottom"/>
    </Grid>
</Grid>

which results in

enter image description here

like image 149
Phil Avatar answered Aug 31 '26 16:08

Phil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!