Skip to content

RelativePanel does not measure Correctly #794

Closed

Description

@danwalmsley

Describe the bug
A clear and concise description of what the bug is.

image

Top is UWP, bottom is WPF handycontrol version,

Since the recent fix we do not return the measured size or minimum size the content takes up.
This is because we are returning the maximum available size from MeasureOverride, regardless of Horizontal and VerticalAlignment.
To Reproduce

```
<handy:RelativePanel Background="Gray" HorizontalAlignment="Left" VerticalAlignment="Top">
    <Rectangle x:Name="RedRect" Fill="Red" Height="44" Width="44"/>
    <Rectangle x:Name="BlueRect" Fill="Blue"
           Height="44" Width="88"
           handy:RelativePanel.RightOf="RedRect" />

    <Rectangle x:Name="GreenRect" Fill="Green" 
           Height="44"
           handy:RelativePanel.Below="RedRect" 
           handy:RelativePanel.AlignLeftWith="RedRect" 
           handy:RelativePanel.AlignRightWith="BlueRect"/>
    <Rectangle Fill="Orange"
           handy:RelativePanel.Below="GreenRect" 
           handy:RelativePanel.AlignLeftWith="BlueRect" 
           handy:RelativePanel.AlignRightWithPanel="True"
           handy:RelativePanel.AlignBottomWithPanel="True"/>
</handy:RelativePanel>
```

Activity

  1. NaBian commented on Apr 19, 2021

    @NaBian
    Member

    As shown, I think the UWP rendering is wrong(the left image is UWP, which has a gray background on the right)

    <RelativePanel Background="Gray" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Rectangle x:Name="RedRect" Fill="Red" Height="44" Width="44"/>
        <Rectangle x:Name="BlueRect" Fill="Blue"
                   Height="44" Width="88"
                   RelativePanel.RightOf="RedRect" />
    
        <Rectangle x:Name="GreenRect" Fill="Green" 
                   Height="44"
                   RelativePanel.Below="RedRect" 
                   RelativePanel.AlignLeftWith="RedRect" 
                   RelativePanel.AlignRightWith="BlueRect"/>
    </RelativePanel>
    

    demo

  2. danwalmsley commented on Apr 19, 2021

    @danwalmsley
    Author

    Awesome, I agree UWP is wrong, and the behavior is now as I expect. Thankyou for your hard work!

  3. added a commit that references this issue on Mar 28, 2024
    916d3d1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址