Microsoft.Toolkit.Win32 icon indicating copy to clipboard operation
Microsoft.Toolkit.Win32 copied to clipboard

WebView - Resize form makes webview jump out of screen

Open Symbai opened this issue 7 years ago • 7 comments

I'm submitting a...

Bug report (I searched for similar issues and did not find one)

Current behavior

Resizing WPF application will make the webview jump out of screen and never comes back.

ezgif com-optimize

Expected behavior

Webview resizes like all other controls

Minimal reproduction of the problem with instructions

repo.zip

  1. Launch
  2. Resize form

Environment

Nuget Package(s): Microsoft.Toolkit.Win32.UI.Controls 4.0.1 System.Net.Http 4.0.0

Windows 10 Build Number:

  • [ X] Update (1803)
  • [ ] Insider Build (build number: )

App min and target version:

  • [ X] Update (1803)
  • [ ] Insider Build (xxxxx)

Device form factor:

  • [ X] Desktop
  • [ ] Mobile
  • [ ] Xbox
  • [ ] Surface Hub
  • [ ] IoT

Visual Studio

  • [X ] 2017 (version: 15.8.3)
  • [ ] 2017 Preview (version: )

Symbai avatar Sep 09 '18 19:09 Symbai

Note to devs: Putting webview in a grid like below solves the problem, but I guess its still a bug as it has been already inside a grid.

<Grid Grid.Column="2" Margin="5">
                <wpf1:WebView x:Name="wvc" />
            </Grid>

Symbai avatar Sep 09 '18 19:09 Symbai

@rjmurillo Can you investigate this?

azchohfi avatar Sep 10 '18 22:09 azchohfi

I tried leaving only the WebView and the problem persist. It seems to be a WebView issue. Also, I tried the Symbai solution with the same result.

lucaasrojas avatar Sep 11 '18 15:09 lucaasrojas

The issue appears to be of when we translate the display rect in WPF to the XAML rect: https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebView.cs#L1192-L1196

rjmurillo avatar Oct 09 '18 23:10 rjmurillo

May be related to #2077

rjmurillo avatar Oct 09 '18 23:10 rjmurillo

@joshholmes FYI

rjmurillo avatar Oct 24 '18 18:10 rjmurillo

@Symbai Thanks you. you are a lifesaver.

I just want to add. even if you are using a web view within the grid. still, you need to add it to the new grid having only a single review as a child

just adding some keywords here for other devs. I have given 3 days before coming to this page.

WPF webview got grayed out when WPF window resizes, WPF web-view got cleaned out. WPF web-view clear on resize

RakeshYadvanshi avatar Mar 21 '20 07:03 RakeshYadvanshi