'WPF Control lagging behind children WebView2 control
I am trying to make a draggable window sort of thing in wpf (.net core 6) and I am using webview2 to make a browser window. However I discovered this strange behavior while trying to make the window move with the mouse cursor.
The parent user control (eg. the window) which has a frame that as the frame content has a webview2 lags behind webview2, which almost instantly moves to the cursors position. (video here, if that helps: https://github.com/Vadkarika2/help/blob/main/2022-05-13%2018-05-40.mp4?raw=true).
This is how the moving the control works:
private void Page_MouseMove(object sender, MouseEventArgs e)
{
if (draging)
{
activeWindow.RenderTransform = new TranslateTransform { X = Mouse.GetPosition(grid_windows).X, Y = Mouse.GetPosition(grid_windows).Y };
}
}
And this is the xaml code for the window class
<UserControl ...>
<Grid Background="Transparent">
<Grid VerticalAlignment="Top" x:Name="grid_windowHandle" Height="20" Background="Gray" MouseDown="Grid_MouseDown" MouseUp="Grid_MouseUp" >
</Grid>
<Frame x:Name="content" Margin="0,20,0,0" Background="White">
</Frame>
</Grid>
I would appreciate anyone's help! Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|