HandyOrg / HandyControl

Contains some simple and commonly used WPF controls
https://handyorg.github.io/
MIT License
6.11k stars 1.03k forks source link

RelativePanel 被错误实现 #1637

Open SlimeNull opened 2 months ago

SlimeNull commented 2 months ago

Describe the bug

  1. 不能正确 Measure 大小
  2. 布局在某些行为上与 WinUI3 不一致
  3. 编写 XAML 时, 预览不会更新

明明是居中, 它却占满了整个宽度, 明明有内容, 却没有被撑起来

image

同时指定靠左, 以及水平居中, 理论上它应该忽略其中一个设置, 但在这里, 它既不是在左边, 也不是在中间

image

Steps to reproduce the bug

示例代码:

<hc:RelativePanel Height="100">
    <Border x:Name="hfirstBD"
            hc:RelativePanel.AlignLeftWithPanel="True"
            hc:RelativePanel.AlignHorizontalCenterWithPanel="True"
            BorderBrush="Red"
            BorderThickness="2"
            Width="50"
            Height="50"/>
    <Border x:Name="hsecondBD"
            hc:RelativePanel.RightOf="hfirstBD"
            BorderBrush="Green"
            BorderThickness="2"
            Width="50"
            Height="30"/>
    <Border x:Name="hthirdBD" hc:RelativePanel.RightOf="hsecondBD"
            BorderBrush="#00a2ea"
            BorderThickness="2"
            Width="50"
            Height="60"/>
    <Border x:Name="hforthBD"
            hc:RelativePanel.Below="hfirstBD"
            BorderBrush="#9c4e9a"
            BorderThickness="2"
            Width="60"
            Height="55"/>
    <Border hc:RelativePanel.RightOf="hforthBD"
            hc:RelativePanel.Below="hthirdBD"
            BorderBrush="#ffca0a"
            BorderThickness="2"
            Width="76"
            Height="55"/>
</hc:RelativePanel>

Expected behavior

No response

Screenshots

No response

NuGet package version

None

IDE

Visual Studio 2022

Framework type

.Net 6.0

Windows version

Windows 11 (22000)

Additional context

nuget 版本 3.5.1 (截止到 20224/8/23, 该版本为最新版本) 框架使用 .NET8 操作系统 Windows11 23H2 22631.4037