WPF custom control looking weird on deployment - wpf

I use a custom numericUpDown control in my WPF application which works fine in my local development environment. However when i deploy my application the control looks strange, to be more specific, all the elements within the control seem to be in place but without the styles. What could be the reason for this?

Related

How can I use transition themes (e.g. EntranceThemeTransition) in WPF?

I created a Universal Windows Application that performed a basic transition between my MainPage and 3 other BasicPages. Each BasicPage had a Grid and I was able to animate the items in the Grid when it was loaded using EntranceThemeTransition in XAML. So good so far. The problem, however, is that I can't run this like a normal Windows application. My understanding is that it must be loaded as a Metro app in order to run. This is problem because I would like to run this program on a Windows 7 machine.
Now I'm re-creating the project in WPF, but I can't use EntranceThemeTransition like I did before. There is no TransitionCollection or EntranceThemeTransition in the XAML for VB.NET.
Is there some way to access this prebuilt transition or will I have to use a combination of DoubleAnimation on the *.Left property *.Opacity property?

Odd WinForm behavior after introduction of WPF control

I recently introduced a WPF control to my VB.net WinForms application. The control looks good and works great. However, depending on which environment I run the application, I will get different behavior. The two machines that differ are both running Windows 8.1 with the default theme.
I have read a few questions about adding proper theme settings and I don't believe that is the issue.
In the environment that is incorrect I have observed the following behavior:
Upon loading the form containing the WPF control, the calling form will resize and move around the screen
Controls contained within the form that also contains the WPF control will often "ghost" upon resizing the application
Both the calling form and the form containing the WPF control shrank upon loading the containing form. By shrank I mean window size, control size of all controls, font size, etc...
I'm wondering if the application was built against one version of the library and the DLL versions differ on the deployment environments. But I'm not sure how to look for this.
Has anyone encountered this before?
I found the problem.
This was the result of DPI scaling. The application was acting out anytime the DPI settings were set to anything other than 100%. WPF controls scale differently from Winform controls causing the strange behavior. The following stackoverflow Q/A explains how to remove the DPI dependency
Disable DPI awareness for WPF application

Using ActiveX control in WPF

I'm attempting to host an ActiveX control in a WPF app. After attempting to use existing info on the web and here, I've hit a dead-end.
I need to use an ActiveX control provided to communicate with a UV power meter. They provide an application that registers and uses the control and even includes some useful demo apps. I stripped out the OCX file and put it here if needed. You won't have the power meter to talk to, but the app and demos will still load the ActiveX control successfully.
I created a simple Windows Forms application. I was able to bring the ActiveX control into the toolbar, drop it into my form, and everything is fine. The demo apps they provide do this as well.
However, getting this to work in a WPF environment is another story. The control can't be added to the toolbox and "dragged" into the app.
So far I've tried two techniques:
Technique found here. I am able to add a reference to the control, but then I enter namespace hell. The xmlns:ax namespace it suggests making cannot find the information. Here's my attempt based on what the object viewer tells me: xmlns:ax="clr-namespace:OphirUsbXLib;assembly=Interop.OphirUsbXLib"
Technique found here. This is essentially to create a new project that creates a library based on Windows Forms, which contains the ActiveX control (yikes). I am able to add the Windows Forms Host, but I cannot get access to the ActiveX control within. I can make the control public, but I still cannot call methods etc. This doesn't look like the right solution.
In short, I have an ActiveX control that works beautifully in Forms, but is a real bitch to get working in WPF.
Any insight is appreciated!
In this situation I would consider making a WinForms usercontrol which wraps the ActiveX control you are trying to use.
You could make public properties and methods which expose each of the required properties and methods on the ActiveX control, and then host this WinForms UC on the in a WPF WinFormsHost control.
I have already done something similar to this, in reverse, hosting a WPF UserControl in a WinForms UserControl, then hosting that on a VB6 Form in a legacy application.

windows application user control in wpf

I have created a user control in windows application and used it in wpf.
The user control is in a seperate project and solution than that of wpf.
I have exposed some properties in the user control and tried to use it in a wpf form.
I have used it in the WindowsFormsHost element and also added WindowsFormsIntegration reference.
I am facing the following problems:
I am able to see the user control in the toolbox but it is disabled.
I am able to design the user control in xaml and give values to properties. I am also getting the properties in intellisense but the same is not getting reflected/applied during design as well as run time.
I am not able to see the control in the properties window even after selecting it. I am just able to see WindowsFormsHost in the property window.
I am not able to find any sample project or explanation of this in code project. If there is any then please do let me know.
Also I am able to use this user control in a windows application very easily and it is working fine. Am i missing anything for wpf?
I can give the source code if required but i dont think it will be of much help as i have not done anything fancy.
Is the control project compiled or just added in the solution?
Is the control project compiled as Debug or Release?
What language is the control compiled in?
"Walkthrough: Hosting a Windows Forms Control in WPF"
Possible help:
http://social.msdn.microsoft.com/forums/en-US/wpf/thread/2fd0d9dd-eaa9-494d-8ec4-d896c33732d6

How to run Google Earth Inside a WPF Control

I’m trying to run Google earth inside WPF but I don’t know how. Basically I have managed to run Google Earth in a Windows Form Control inside a Windows Form, everything was OK.
Trying to do the same thing in WPF, well, give strange result a small Google Earth screen placed anywhere in the form an not inside the User Control I have created, and there is now way to make this Google Earth Control grow, or shrink, when I grow or shrink the WPF Form.
Any help would be appreciated, I really mean any!
If you have a Windows Forms control that already works exactly as you want, you could always use WindowsFormsHost to put that control on your WPF form. That might be the easiest thing to do... or is that what you're already doing that isn't working?
I also wrote an application that placed Google Earth inside a WinForms WebBrowserControl that was based on the more-or-less official example hosted by Google. It worked fine. I struggled to recreate the same application inside a WPF WebBrowserControl. My experience confirms what appears to be the general consensus that the WPF WebBrowserControl is harder to use because it provides less control. (e.g. With the WinForms WebBrowserControl you can use the properties to remove the scroll bar and eliminate the IE security question on startup, but with WPF WebBrowserControl you have to use kludges inside to HTML file loaded to get the same effect.) If you are following the Google GE plugin WinForms example, you have to move the JavaScript callback functions into a separate class because of WPF window cant be a parent of the .Net-COM interop between JavaScript and C#. Maybe the other artifacts you described are due to how you resolved this latter limitation. Before finding this solution, I was tempted to put the WinForms WebBrowser control inside the WPF window, but others have posted of unpleasing side-effects of doing this.

Resources