WPF Window objects are blacked out on second screen in Windows 10 - wpf

Forgive me if this is a technical issue rather than a software-programming one, but I am having difficulty determining the probable cause here, be it the .NET Framework or something lower level, perhaps graphics hardware. Essentially, no WPF application will run on a second monitor using my Windows 10 Alienware 13 laptop. The same application, on the same monitor, running under my Windows 8 Alienware 15, will work fine. Visual Studio 2015 is a similar case, if there might be a common factor. Any experience with this sort of issue would be appreciated

For me, the issue seems to be in the hardware acceleration in WPF applications, as disabling it made it impossible to reproduce the problem (which previously I had no trouble doing using winkey+arrows to move WPF from primary to secondary screen)
The following registry edit can be used to disable hardware acceleration inside WPF applications:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Avalon.Graphics]
"DisableHWAcceleration"=dword:00000001
Sources:
https://support.microsoft.com/en-us/kb/963021
https://msdn.microsoft.com/en-us/library/aa970912.aspx

I faced the same problem with my Windows 10 and dual monitor ( laptop screen + second monitor connected by HDMI ).
The solution in my case to fix the "black window in the second monitor" was this:
Locate your graphic-card vendor configuration interface by right clicking your desktop. In this pop-up menu you will find something like "Intel graphics" or "nVidia configuration", "AMD Control center", etc...
Find the "scaling options" and change the value. I disabled the "scaling" (OFF) and the problem was fixed, so this issue is related with the auto-scaling of the windows when you move your application between screens.
Please find these screenshots as example from my computer:
Source: https://answers.microsoft.com/en-us/windows/forum/windows_10-start/dual-monitor-different-resolutions-black-program/58ec488a-b62d-4ce8-a058-5e01e2a54d9a

Disabling hardware acceleration for the application, worked for me. This can be executed at any point and works immediately. So you can call this when the wpf app is already running
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
Microsoft manual

Related

GUI elements are only shown when mouse is moved over them

in my company we developed a C#/WPF application and everything works fine. By request of our customer we are limited to the .NET 3.5 framework. In the application there is a settings dialog which is displayed correctly on our companies windows 7 systems. Now our customer has sent us a screenshot that shows the dialog (a window) which is totaly blank. He also wrote that the ui controls only appear if he moves the mouse over them.
We are not able to reproduce this. It looks like a missing repaint of the window or something like this. It is working perfectly on several of our systems. Does anyone know what could cause this effect? We do not have any informations about the computer systems that are used, except that they use windows 7.
Thanks in advance
This can be a hardware render bug.
Try a software render mode(this needs a change in your source code):
Software rendering mode - WPF
Or just ask client to enable software mode on his machine:
https://msdn.microsoft.com/en-us/library/aa970912(v=vs.90).aspx

WPF XAML slow start up for a small application

I'm using VS2010 WPF / XMAL to create a very detailed order form. It has about 50 data items on it all data-bound in xaml. All is fine in development on my win7 PC. When I deploy the app, via one click or an MSI, the application take seconds to download but up to 5 mins to prepare before the login screen is shown on a windows 7 pc. But on my XP machine it's done in seconds, for exactly the same app!. I've trouble shot the order form by commenting out some of the xaml I found that there is breaking point to the amount of items it can show before I get a start up problem. For example I have 30 items without issue but once you add one more then they very slow startup times occur. It doesn't matter which area of the xaml I comment out as soon as it goes to one extra I get the slow start up time?
I'm only using grids, stack panels and textboxes with single items of data. No lists
Very strange as XP doesn't have this problem. Any ideas?
What graphics cards do you have in each machine? It may be to do with there DirectX compatibility? Changing to software rendering might give you an insight (or at least some consistency.
Try the advice from this page:
http://blogs.msdn.com/b/jgoldb/archive/2010/06/22/software-rendering-usage-in-wpf.aspx
This is the profiling tool you should use for WPF:
http://msdn.microsoft.com/en-us/library/aa969767(v=vs.110).aspx
On my windows 7 pc I changed these setting in symantec antivirus; In Auto-protect I disable the Enable File System Auto-Protect option. Also in the global settings I disabled "Insight for" and " Enable bloodhound heuristic virus detection.
After this my app loaded in a second. When I enabled the virus settings back to what it was and did a reboot my app continued load up in seconds.
I'm not sure why Symantec was inconsistent with this issue... By just adding one extra line of xaml, be it a textbox or a label I get a massive difference in behaviour. My assemblies are sign on my build server with domain certificate so I would assume they are trusted.

Touchscreen Windows 7 WPF

I have an app which I need to make accessible for Windows Touch. It is not a multi-touch application. I've looked at Microsoft's guidelines for touch applications which is interesting. There is one thing I am not clear on though, that is text input.
I would like a keyboard to appear when I click in a TextBox field. Is there a way to use the built-in on screen keyboard for this?
The first monitor I tested with was a Wacom. It is an older unit that uses a pen. It had some software that pulled up an on screen keyboard whenever I clicked in any text field (in any application). It was very handy. I thought this feature was using built-in Windows Tablet software because it didn't look like it came from a third party. A newer monitor I just purchased (Elo) does not have this feature though.
Answering my own question so it won't show up as unanswered any longer... From my comment above:
Looks like I've found the problem. The general purpose driver for the monitor wasn't installing it as a Tablet PC monitor. The Windows 7 only driver will provide a Tablet PC control panel settings. Now a keyboard shows up whenever I click in a TextBox field. The Windows XP compatible driver must have been using a legacy sub-system...

Solution for WPF/Wacom compatibility problems, or can I disable WPF tablet support?

I sell a WPF (.net 3.5SP1) based time tracking application, this application has no tablet/pen/ink related features what so ever.
I have a compatibility problem with Wacom tablets, on computers with a Wacom tablet my application may freeze, crush or, in the latest case - override the user's tablet settings (but not on every computer with a Wacom tablet, some do work, at least part of the time).
In that latest case the problem seems to be that starting my application will also start wisptis.exe (Microsoft Pen and Touch Input Component), killing this process solves the problem.
Does anyone knows how to make WPF co-exist peacefully with Wacom tablets?
Again, my app does not have any pen features what so ever, so completely turning off WPF pen support to avoid conflicts can solve my problem.
I don't want my app to effect any other app on the system, so uninstalling Windows components, changing global machine-level settings or changing the Wacom drivers (except to the latest version) are not an option.
Thanks,
There's a few dependency properties you can explore
public MainWindow()
{
Stylus.SetIsTapFeedbackEnabled(this, false);
Stylus.SetIsPressAndHoldEnabled(this, false);
Stylus.SetIsTouchFeedbackEnabled(this, false);
InitializeComponent();
}
These can be used in Windows 8 to disable 'bubbles' in your own application.
Still looking for a way to disable 'bubbles' in Visual Studio.

WPF not rendering on remote desktop

I'm having problems with the rendering of a WPF app over a remote desktop connection.
The applications chrome is rendering, but none of the content is coming through, as if the window is not drawing. Instead the previous content of the screen is showing in it's place.
This has been a problem with the application running on both Vista & Win 7, with remote control being taken from XP and Win7.
The problem is not application specific, if I create a new WPF app, with just a textblock on the window, it will also not run. (Neather will the windows preview in VS2008 display.)
Is there some trick to getting WPF running under RDP?
I read on Kevin Dente's blog (from a twitter post) that he was having trouble with WPF apps in virtual machines. While not the same as Remote Desktop, it's possible the problem could be the same. Kevin was able to fix his problem by disabling hardware accelleration by creating a DWORD registry value at
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Avalon.Graphics\DisableHWAcceleration
and then setting it to 1.
His original blog post is here: http://weblogs.asp.net/kdente/archive/2009/10/19/visual-studio-2010-beta-2-editor-performance-fix-running-on-a-virtual-machine.aspx
That may not be your exact solution, but maybe it points you in the right direction.
WPF should render over RDP; it's smart enough to know when it can render in hardware, and when it can't it reverts to its own GDI+ based software rendering. I would make sure you're running .NET Framework 3.5 SP1 on the remote machine, since there were changes to remoting that might pose issues. (See link below.)
I've been developing a WPF app for the past 6 months and it works just fine over RDP. (From Vista and Win7 to XP, Vista and Server 2003.) One important caveat, however, is that it renders using the Classic theme. So if you're using controls that don't have a classic theme, they won't render. If you're just dropping a TextBox on a Window, then obviously that's not your problem.
Check out this question for some links that may be helpful: Are there problems with rendering WPF over Remote Desktop under Windows XP?
I just had this problem with the ribbonwindow not displaying correctly when testing for the first time via RDP - the transparent background was white, the close minimize/maximize buttons were missing, the rounded corners on the bottom of the window were square, and the top row of ribbon buttons were almost impossible to select.
Turns out there was a simple fix for me. Right-click the RDP connection icon (I have it saved on my desktop), select "Edit", then the "experience" tab, and change "detect connection quality automatically" to "LAN (10 Mbps or higher)".
This fixed it for me.
Ade
Did you also try Win7 latest RDP - Win7 connection? The thing is WPF doesn't use GDI to draw elements.
VNC clients (like UltraVNC) probably will do the trick for you as they using much simplier algorithms more like of sending bitmaps.
I have the same problem than the asker. The standard, out-of-the-box Checkbox is not rendering correctly. I can only see if it is checked when hoovering the checkbox. Otherwhise, no difference between checked and unchecked. Important note : It occurs when setting the foreground to white (see here : https://social.msdn.microsoft.com/Forums/vstudio/en-US/1c03db49-7e53-4cbb-9dd1-b328017c4453/wpf-checkbox-and-radiobutton-check-mark-not-showing-under-xp-windows-classic-theme-and-remote?forum=wpf)
Our application used to have this problem with a custom progress bar.
We fixed this by setting the background color of the Border control to White. This leads me to think there is an issue with transparent backgrounds
There is no special trick needed to get WPF content to show across remote desktop. Our WPF-based app renders just fine over RDP (tried from numerous machines) with no problems. We're even using animations, gradients, WriteableBitmap, etc. w/ no problems.

Resources