Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get two buttons to share half of the apps screen width with Universal Windows Platform

Tags:

c#

windows

xaml

uwp

I am trying to get two buttons to share the same width in a Relative Panel layout in Visual Studio with build UWP application but cannot seem to find resources or anything to show me how to do this.

Can any one help or give me some resources to go to? Please do not downgrade this question without suggestion.

like image 691
David Wruck Avatar asked Nov 27 '25 07:11

David Wruck


1 Answers

Here's a solution with RelativePanel although the Grid solution presented by @al1Dima is also valid

<RelativePanel>
    <Button x:Name="LeftButton" Content="Left" HorizontalAlignment="Stretch"
        RelativePanel.AlignLeftWithPanel="True" RelativePanel.LeftOf="Divider" />
    <Border x:Name="Divider" RelativePanel.AlignHorizontalCenterWithPanel="True"/>
    <Button x:Name="RightButton" Content="Right" HorizontalAlignment="Stretch"
        RelativePanel.AlignRightWithPanel="True" RelativePanel.RightOf="Divider" />
</RelativePanel>
like image 52
AlexDrenea Avatar answered Nov 29 '25 20:11

AlexDrenea



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!