elementhost

ElementHost blocks mouse events

守給你的承諾、 提交于 2019-12-06 05:54:39
NOTE: I AM TRYING TO SOLVE THE MOUSE ISSUE, NOT THE KEYBOARD PROBLEM, WHICH IS ALREADY SOLVED So I am creating a Visual Studio 2015 extension, working on the Options pages. I am using WPF, so I use ElementHost to host a UserControl. At first it wasn't receiving keyboard events, so I implemented the solution at: WPF TextBox not accepting Input when in ElementHost in Window Forms A quick run down of the solution: A) on the UserControl's Loaded event, I do: var s = HwndSource.FromVisual(this) as HwndSource; s?.AddHook(ChildHwndSourceHook); B) In ChildHwndSourceHook(), I do something like: static

Dynamic Application-level resources are not dynamic when hosted in ElementHost

我只是一个虾纸丫 提交于 2019-12-06 02:53:41
问题 I'm hosting a WPF UserControl in a WinForms container. Now, I want to be able to theme/skin the UserControl. To do this, I've got several resource dictionaries that define the "skins." When my app starts up I create a "new System.Windows.Application()" so that Application.Current exists. To change the theme the old skin is removed and a new skin is merged into the Application level resource dictionary at runtime. However, this does not change any of the dyanamically referenced resources in

Any disadvantage to using an ElementHost to host a WPF UserControl in a Winform application?

半城伤御伤魂 提交于 2019-12-05 14:31:21
Curious if there are any disadvantages to using an ElementHost to host a WPF UserControl in a Winform application? I ask because in general I feel that it takes to much time for me create a new WPF application with a basic interface that looks decent. Decent in the sense that if I create a new Winforms application and throw some controls on it I end up with a basic interface that looks and behaves similar to many other applications but doesn't look plain. If I do the same thing with a WPF application I don't feel I achieve the same results, I end up with a "plain" application with a white

Dynamic Application-level resources are not dynamic when hosted in ElementHost

a 夏天 提交于 2019-12-04 07:26:57
I'm hosting a WPF UserControl in a WinForms container. Now, I want to be able to theme/skin the UserControl. To do this, I've got several resource dictionaries that define the "skins." When my app starts up I create a "new System.Windows.Application()" so that Application.Current exists. To change the theme the old skin is removed and a new skin is merged into the Application level resource dictionary at runtime. However, this does not change any of the dyanamically referenced resources in the UserControl. I tried this in a straight WPF application and it worked just fine. Am I missing

Rendering issue with WPF controls inside ElementHost

醉酒当歌 提交于 2019-12-03 09:06:29
问题 I am having a WinForms control, inside that I have a TableLayoutPanel which holds multiple ElementHosts and each ElementHost contains a WPF control. Everything works fine except when the size of controls is bigger then window and ScrollBar is there; when I scroll down, the controls get rendered distorted, like this - On maximizing the window or re-sizing it, controls render properly (reducing the size such that controls go out of visible area and then increase the size again to bring them

Text renders differently on WPF window and inside ElementHost

匆匆过客 提交于 2019-12-03 08:19:37
问题 I use WPF interoperability to host WPF user control inside WinForms form. Everything works OK except ugly text rendering: <Label Content="Normal text" Name="labelNormal"/> <Label Content="Bold text" Name="labelBold" FontWeight="Bold" /> -- here is simple Labels on WPF Window: WPF Window http://img525.imageshack.us/img525/7049/wpfwindow.png -- and the same labels shown when the WPF user control is hosted in WinForms: Interop variant is quite different: intercharacter interval is zero and the

Rendering issue with WPF controls inside ElementHost

陌路散爱 提交于 2019-12-02 23:17:48
I am having a WinForms control, inside that I have a TableLayoutPanel which holds multiple ElementHosts and each ElementHost contains a WPF control. Everything works fine except when the size of controls is bigger then window and ScrollBar is there; when I scroll down, the controls get rendered distorted, like this - On maximizing the window or re-sizing it, controls render properly (reducing the size such that controls go out of visible area and then increase the size again to bring them back in visible area) This doesn't happen with WinForms control in the same window just the WPF ones; any

Black background before loading a wpf controll when using ElementHost

萝らか妹 提交于 2019-12-01 01:21:57
I'm using WPF in WinForms with ElementHost. When the form loads, there is a flash of black background where the ElementHost is about to load. This looks kind of bad. Any suggestions on how to get rid of this? Hide the element (Visibility = Hidden) until the WinForms control is fully loaded... Yuriy you need first show control with empty bounds first time to avoid black flickering if (!_control.Created && _control.BackColor != Color.Transparent) { _control.Bounds = Rectangle.Empty; _control.Show(); } // set control bounds and show it Rectangle bounds = GetBounds(context, rect); if (_control

Black background before loading a wpf controll when using ElementHost

我与影子孤独终老i 提交于 2019-11-30 20:53:01
问题 I'm using WPF in WinForms with ElementHost. When the form loads, there is a flash of black background where the ElementHost is about to load. This looks kind of bad. Any suggestions on how to get rid of this? 回答1: Hide the element (Visibility = Hidden) until the WinForms control is fully loaded... 回答2: you need first show control with empty bounds first time to avoid black flickering if (!_control.Created && _control.BackColor != Color.Transparent) { _control.Bounds = Rectangle.Empty;

Application.Current in ElementHost is null

眉间皱痕 提交于 2019-11-30 11:21:37
I use a WPF UserControl in my personal Libs. The Libs are included in my WPF and WindowsForms programs. Now my UserControl has to show a new (WPF) Window. At the new Window I want to set the Owner. I do it like this: dialog.Owner = Application.Current.MainWindow; This works fine, if i use the UserControl in a WPF program. When I use the UserControl in my WindowsForms program (I set the UserControl in a ElementHost elementHost.Child = ... ) is Application.Current null. This is not good and my program throws an exception. Why is Application.Current null? Application.Current is Specific for WPF