-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Description:
When using Avalonia 11.2.3 with WebView 3.120.8, there are two layout-related issues:
Incorrect page layout on startup: The initial page rendering does not match the window size, resulting in a layout issue.
Context menu misplacement: When right-clicking inside the WebView without manually resizing the window first, the context menu often appears at incorrect coordinates.
Steps to Reproduce:
- Create a basic Avalonia app with WebView (e.g., Avalonia 11.2.3 and WebView 3.120.8).
- Set WebView to fill the window.
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:AvaloniaApplication2.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:webview="clr-namespace:WebViewControl;assembly=WebViewControl.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="AvaloniaApplication2.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
Icon="/Assets/avalonia-logo.ico"
Title="AvaloniaApplication2">
<Design.DataContext>
<vm:MainWindowViewModel/>
</Design.DataContext>
<webview:WebView x:Name="webview" Focusable="True" Address="{Binding Address}" />
</Window>
- Set code of view model like this:
public partial class MainWindowViewModel : ViewModelBase
{
public string Address { get; set; } = "http://your.web/site";
}
- Run the application (without resizing the window).
- Observe the page layout.
- Right-click inside the WebView to open the context menu.
Expected Behavior:
The page should be rendered correctly to fit the window on startup.
The context menu should appear at the correct position under the cursor.
Actual Behavior:
The page layout is incorrectly sized on startup.
The context menu appears at the wrong coordinates if the window size has not been manually adjusted.
Environment:
Avalonia: 11.2.3
WebView: 3.120.8
OS: ALT Linux Starterkit 11 (Salvia)
.NET: 8
Additional Context:
It seems the WebView component is not recalculating its layout properly on the initial window creation. Manually resizing the window corrects both the page layout and context menu placement.