opened
OmidID
username_0
WinFormsAvaloniaControlHost is freezing until I resize the control. This issue started after I upgraded to v0.8
WinFormsAvaloniaControlHost does not update/repainting v0.8
issue
created
OmidID
username_0
@username_2 Is there any temporary solution exists?
comment
created
OmidID
username_0
For the moment I create my own WinForm host control. 
1. Load default Window
2. Remove border and set location 0,0
3. Show window
4. Apply WS_CHILD to the window
5. Set parent to the current control

```cs
      [DllImport("user32.dll")]
      static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

      [DllImport("user32.dll")]
      public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

      [DllImport("user32.dll")]
      public static extern int GetWindowLong(IntPtr hWnd, int nIndex);

      public static int GWL_STYLE = -16;
      public static int WS_CHILD = 0x40000000; 
```

```cs
         var window = Window = (MainWindow)_bootstrapper.GetShell(); // Get Window from Prism
         window.HasSystemDecorations = false; // Remove border
         window.Position = new PixelPoint(0, 0); // Set position to 0,0

         // Set window size to the control
         Window.MinWidth = Window.MaxWidth = Window.Width = Width;
         Window.MinHeight = Window.MaxHeight = Window.Height = Height;

         window.Show(); // Show show window before change styles

         var handler = ((WindowImpl)window?.PlatformImpl)?.Handle?.Handle ?? IntPtr.Zero;
         SetWindowLong(handler, GWL_STYLE, GetWindowLong(handler, GWL_STYLE) | WS_CHILD);
         SetParent(handler, this.Handle);
```

To fix resize problem:
```cs
      protected override void OnResize(EventArgs e)
      {
         base.OnResize(e);
         if (Window != null)
         {
            Window.MinWidth = Window.MaxWidth = Window.Width = Width;
            Window.MinHeight = Window.MaxHeight = Window.Height = Height;
         }
      }
```
comment
created
ThomasRizzo
username_1
@username_2, I'm having this issue too and the work around above didn't help me. Any ideas where I should start looking for this bug? Thanks!
comment
created
kekekeks
username_2
IIRC the renderer doesn't start automatically anymore, so `Renderer.Start()` has to be called on the `TopLevel`
comment
created
ThomasRizzo
username_1
That was it! Thank you!!
comment