Giter Club home page Giter Club logo

Comments (5)

timunie avatar timunie commented on June 23, 2024

I think your RowDefiniton in WPF is wrong. AFAIK if you omit it, it will be Auto and not Star. So an unfair comparison.

from avalonia.

dgg1121 avatar dgg1121 commented on June 23, 2024

I think your RowDefiniton in WPF is wrong. AFAIK if you omit it, it will be Auto and not Star. So an unfair comparison.

What I mean is that the display of controls within rows or columns of Grid controls should be independent. Instead of when there are insufficient row or column controls, its internal controls will be displayed on other columns and rows.

If you set Avalonia's AXAML code to match WPF's XAML code, this display bug will still appear. You can give it a try!

from avalonia.

stevemonaco avatar stevemonaco commented on June 23, 2024

WPF default Height for RowDefinition is 1*. https://github.com/dotnet/wpf/blob/47efe4600a00ac059aeca109459e9a4e8132d907/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinition.cs#L1021-L1029

Also, please don't rely on previewers for correct display.

IMO, using explicit dimensions and expecting implicit clipping is a flawed design. Hiding bad math through implicit clipping is not really desirable. The layout design is screwed up in both Avalonia and WPF. You can simply brush it under the rug a bit better in WPF.

You could try checking/enabling ClipToBounds on the 2nd row Grid. You could also try removing the TextBlock to check if this is confusing Avalonia's sizing. Stacking content with different alignments in the same cell may be problematic and is not very grid-like.

from avalonia.

dgg1121 avatar dgg1121 commented on June 23, 2024

WPF default Height for RowDefinition is 1*. https://github.com/dotnet/wpf/blob/47efe4600a00ac059aeca109459e9a4e8132d907/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinition.cs#L1021-L1029

Also, please don't rely on previewers for correct display.

IMO, using explicit dimensions and expecting implicit clipping is a flawed design. Hiding bad math through implicit clipping is not really desirable. The layout design is screwed up in both Avalonia and WPF. You can simply brush it under the rug a bit better in WPF.

You could try checking/enabling ClipToBounds on the 2nd row Grid. You could also try removing the TextBlock to check if this is confusing Avalonia's sizing. Stacking content with different alignments in the same cell may be problematic and is not very grid-like.

I have tried many ways to verify whether the Grid control is displayed properly, but all the results are the same: when the height and width of RowDefinition or ColumnDefinition are smaller than the size of the control, the control will be displayed in other rows and columns. All tests are conducted in Debug environment instead of preview mode.

Setting the "ClipToBounds" property of the Panel to True can indeed solve this problem, but I believe this should be the default implementation effect of the Grid control, rather than being displayed and implemented by developers.

Perhaps this phenomenon should be optimized in the next Avalonia version!

6
1
5

Setting the "ClipToBounds" property of the Panel to “True”
4

from avalonia.

stevemonaco avatar stevemonaco commented on June 23, 2024

I'm not sure if this is by-design or not, so the team will have to speak to that. Introducing extra clipping implicitly for Grid cells may have perf concerns.

from avalonia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.