gpt4 book ai didi

c# - 如何让两个按钮与通用 Windows 平台共享一半的应用程序屏幕宽度

转载 作者:可可西里 更新时间:2023-11-01 09:19:37 24 4
gpt4 key购买 nike

我试图通过构建 UWP 应用程序让两个按钮在 Visual Studio 的相对面板布局中共享相同的宽度,但似乎无法找到资源或任何东西来告诉我如何做到这一点。

任何人都可以帮助我或给我一些资源吗?请不要在没有建议的情况下降级这个问题。

最佳答案

虽然@al1Dima 提供的Grid 解决方案也是有效的,但这是一个使用RelativePanel 的解决方案

<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>

关于c# - 如何让两个按钮与通用 Windows 平台共享一半的应用程序屏幕宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37934622/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com