elementhost

How do I convert a WPF size to physical pixels?

好久不见. 提交于 2019-12-27 19:13:09
问题 What's the best way to convert a WPF (resolution-independent) width and height to physical screen pixels? I'm showing WPF content in a WinForms Form (via ElementHost) and trying to work out some sizing logic. I've got it working fine when the OS is running at the default 96 dpi. But it won't work when the OS is set to 120 dpi or some other resolution, because then a WPF element that reports its Width as 96 will actually be 120 pixels wide as far as WinForms is concerned. I couldn't find any

How do I convert a WPF size to physical pixels?

久未见 提交于 2019-12-27 19:12:51
问题 What's the best way to convert a WPF (resolution-independent) width and height to physical screen pixels? I'm showing WPF content in a WinForms Form (via ElementHost) and trying to work out some sizing logic. I've got it working fine when the OS is running at the default 96 dpi. But it won't work when the OS is set to 120 dpi or some other resolution, because then a WPF element that reports its Width as 96 will actually be 120 pixels wide as far as WinForms is concerned. I couldn't find any

MouseEnter event in Winform ElementHost

自作多情 提交于 2019-12-24 19:19:51
问题 I have a Winform with an elementHost in it to contain a WPF UserControl. What I need, is to do something when the mouse enters the elementHost, not the child. I was trying to use MouseEnter event in the elementHost but it does not exists. Is there any chance I can do this? Or is it just not possible? It´s curious to not have mouse events on them. This are all the events I have: And if I want to do it programatically I just dont have any MouseEvent: 回答1: MouseEnter event located in

WPF Scrollviewer DesiredSize does not increase when ScrollBar gets Visible

試著忘記壹切 提交于 2019-12-23 04:59:10
问题 I have a WPF UserControl (inside an ElementHost ) with a ScrollViewer that contains an ItemsControl . The HorizontalScrollbarVisibility is set to Auto , so if no scrolling is necessary, the ScrollBar gets hidden. My requirement is, that if the ScrollBar gets shown/hidden, the ElementHost does adjust it's height accordingly. To achieve that, I'm listening to the SizeChanged event, I get the DesiredSize of the ScrollViewer in the EventHandler , then I pass DesiredSize.Height to the ElementHost

ElementHost size causes slow wpf open/load with high memory usage

天大地大妈咪最大 提交于 2019-12-18 15:36:13
问题 The Problem: We have a Winforms application, which can open up another WPF Window. This window contains various icons and text and isnt overly complex. Back to the main window, the winforms one, this also has a WPF control embedded using ElementHost(ElementHost is specifically designed to make it possible for Winforms to host a WPF Control). We have noticed however, that once the memory usage of this application get quite high, this second WPF Window can take a considerable amount of time to

WPF control not displaying in ElementHost in WinForms app

时光毁灭记忆、已成空白 提交于 2019-12-18 04:47:12
问题 I have a problem with a WPF control that I'm trying to host in an ElementHost in a WinForms app. The control is a lookless custom control that I originally developed in a separate test project, which was a WPF app. In there it obviously works fine, but in my WinForms app all I get is a blank grey box where the ElementHost is displayed. Here's my C# code for creating, populating, and adding the ElementHost to the parent Control: // This is my WPF control m_TabHostPanel = new TabHostPanel(); m

WPF ShowDialog and ElementHost

↘锁芯ラ 提交于 2019-12-12 10:45:32
问题 is it possible to display a Modal Window from a WPF User Control, that is a child of an ElementHost, and set the owner/parent of the Modal Window to the containing Form control? I'm guessing you can't do this, as the Owner property takes an instance of Window, where as I want to set it to the parent of the Element Host control, which is an old Windows Forms Form control. Just wondering if there is a work around or alternative approach. The problem is when the Modal Window is displayed and the

Problems with Prism hosted in a WinForm ElementHost

牧云@^-^@ 提交于 2019-12-08 13:09:21
问题 I am having problems with hosting a WPF prism app in an ElementHost control and am desparate for help. The PRISM app runs fine in silverlight and in a standalone WPF. The main Shell seems to setup fine in the elementHost on a WinForm however other views only load with the “RegisterViewWithRegion” and not the “Add,Activate” procedure. I need “Add,Activate” for scoping. However I beleive the problem is that I am loading my shell twice … not on purpose. I cannot find a way to call the

ElementHost blocks mouse events

非 Y 不嫁゛ 提交于 2019-12-07 22:46:29
问题 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

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

风格不统一 提交于 2019-12-07 07:23:42
问题 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