Comments (5)
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.
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.
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.
WPF default
Height
forRowDefinition
is 1*. https://github.com/dotnet/wpf/blob/47efe4600a00ac059aeca109459e9a4e8132d907/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinition.cs#L1021-L1029Also, 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 rowGrid
. You could also try removing theTextBlock
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!
Setting the "ClipToBounds" property of the Panel to “True”
from avalonia.
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)
- Inconsistent Gesture event names HOT 1
- Consider unsealing the Render() of the Panel? HOT 6
- Alt codes do not produce expected characters
- "Call from invalid thread" process crash after tray icon menu item is invoked HOT 5
- Browser mvvm error HOT 4
- Setting `FontSize` = 0 crashes the previewer in VS 2022
- Possibly wrong pattern match in `VirtualizingStackPanel.GetControl` HOT 3
- A Fullscreen window that is returned to WindowState.Normal or Maximized when ExtendClientAreaToDecorationsHint="True" will move up and to the left slightly
- Numeric access keys not working HOT 1
- ListBox do not change selected item then PageUp/PageDn keys used HOT 4
- Infinite IterationCount does not apply with DelayBetweenIterations
- Prefer always adding the `attachDevTools` parameter in generated `InitializeComponent` of a `Window` HOT 5
- DevTools Tree Jumps HOT 4
- [FEATURE] ComboBox support for multiple selection mode (Dropdown/Select) HOT 2
- the ItemsControl elements leave when the window opens WindowState="FullScreen" HOT 3
- Memory leak on Popup with ItemsControl and UserControl with empty Binding
- Can we get an offical FlatLaf dark theme port for avalonia ui? HOT 4
- :loaded PseudoClass for initial transitions HOT 2
- Stuck due to Android soft keyboard HOT 7
- The text display is offset upwards in the Ubuntu system HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avalonia.