dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.83k stars 1.67k forks source link

Editor "layout" on windows is strange and flickers #12458

Open mattleibow opened 1 year ago

mattleibow commented 1 year ago

Description

I think I managed to narrow this down to us setting the vertical text alignment in the editor, but the same code works fine on a plain WinUI app.

https://user-images.githubusercontent.com/1096616/210906310-60a28360-13f6-45ba-9287-d095cdcbbb9b.mp4

Steps to Reproduce

  1. Clone the repo
  2. Drag the window small and then big
  3. Observe that the "contents" of the editor is all weird and cropped

Link to public reproduction project repository

https://github.com/mattleibow/maui-bug-repros/tree/repro-win-editor

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

All

Did you find any workaround?

No response

Relevant log output

No response

mattleibow commented 1 year ago

I was testing if this was the text box or the layout system and I think it is layout. To test I added an OnLoaded event handler to the editor and added this to the code behind:

<Grid Padding="20" Background="Orange">
    <Editor VerticalOptions="Fill" VerticalTextAlignment="Center" Background="White" Loaded="OnLoaded" />
</Grid>
private void OnLoaded(object sender, EventArgs e)
{
#if WINDOWS
    var window = Window.Handler.PlatformView as Microsoft.UI.Xaml.Window;

    var tb = ((Editor)sender).Handler.PlatformView as TextBox;
    var parent = tb.Parent as Panel;
    parent.Children.Clear();

    window.Content = new Microsoft.UI.Xaml.Controls.Grid
    {
        Padding = new Microsoft.UI.Xaml.Thickness(20),
        Children = { tb }
    };
#endif
}

I am basically taking the very same text box and just adding it to a grid at the root of the window. Same window, same app, same text box - just not on a maui layout.

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

homeyf commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on windows platform. https://github.com/mattleibow/maui-bug-repros/tree/repro-win-editor demo2