HandyOrg / HandyOrg/HandyControl

RelativePanel 被错误实现

Open
#1,637 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
7.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the supplied XAML with HandyControl 3.5.1 on the stated WPF/.NET setup, then inspect the RelativePanel implementation and compare its measure and arrangement behavior with WinUI 3. Done means the sample sizes, aligns, and updates its preview consistently with the reported expectations.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.