question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MetroWindow with webview2 content not easy to resize

See original GitHub issue

Describe the bug

Sample project: WebView2WpfBrowser.zip

Can only resize window when mouse pointer just on window border, which is just 1 px width. Very hard to locate.

Steps to reproduce

  1. clone https://github.com/MicrosoftEdge/WebView2Samples
  2. import MahApps.Metro
  3. Import styles
  4. Change MainWindow base class to MetroWindow

Environment

MahApps.Metro version: v2.4.5
Windows build number: Win10 20H2 [Version 10.0.19042.928]
Visual Studio: 2019 16.9.4
Target Framework: .Net Core 3.0

Screenshots

Gif Animation: Resize with MetroWindow (Please watch mouse pointer)

test_难以resize

Gif Animation: Resize with normal wpf window:

test_resizewithnormalWindow

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cuiliangcommented, Apr 28, 2021

Report: Set margin not work, GlowBrush works. Thank you.

0reactions
cuiliangcommented, Apr 28, 2021

Find a solution without GlowBrush:

 public MainWindow()
        {
            InitializeComponent();

            WindowChrome.SetWindowChrome(this, new WindowChrome()
            {
                CaptionHeight = 30,
                GlassFrameThickness = new Thickness(5),
                ResizeBorderThickness = new Thickness(5),
                NonClientFrameEdges = NonClientFrameEdges.Bottom| NonClientFrameEdges.Left
                | NonClientFrameEdges.Right 
            });
        }

NonClientFrameEdges does the trick. This code has some problem: cause buttons on title bar not working. but resize works. and there is a strange border 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

objective c - WebView dynamic resize to content size
The problem looks the same to me. You want to find out the size of the web view's content and resize the web...
Read more >
I cannot change the size of WebView2 · Issue #2411
I changed the form size, but the webView2 size did not change ... property getting changed to properly tell the web content what...
Read more >
UWP Webview2 Size shrinks - Extended displays
Iam trying with a simple test UWP app which is having a UWP webview2 control , noticed an issue where in the extended...
Read more >
Resizing WebView2 browser content doesn't work
In VO we have a window that shows an OLEWebbrowser in the right half, with OA_WIDTH_HEIGHT as Owner Alignment. It shows e.g. a...
Read more >
What causes small white spots on skin
However, when the window is enlarged, the calendar control will not resize; it maintains its current size.with some steps as following: 1- Create...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found