I have Windows 10 upgraded from Windows 8.1 (64 bit). In WPF applications (developed by me or by others, like todotxt.net on the screenshots) child windows are blank most of the time.
If I move a mouse over the controls, some of them appear (I guess because they handle WM_MOUSEHOVER message to repaint themselves). Sometimes windows are OK (~10-20% of launches). I have temporarily fixed the issue by hiding and showing the controls (please read below).
Fresh installation of Windows 10 on Hyper-V does not reproduce the error.
Has anyone faced with the similar issue? How have you solved it?
Here how it looks (blank child window):
After mouse move:
My solution
I was not able to find any other solution on the Internet. If you find any other solution, please let me know.
First, simple repainting (via InvalidateVisual()) did not solve the problem.
I decided to handle the ContentRendered event and hide and then show back all the controls. The trick works, but it "smells".
In the code below mainGrid is a name of the topmost Grid of my child window:
XAML:
<Window x:Class="MyApp.About"
.........
ContentRendered="Window_ContentRendered"
...... >
<Grid x:Name="mainGrid" ... >
CS:
private void Window_ContentRendered(object sender, EventArgs e)
{
InvalidateVisual(); // Just in case
var childCount = VisualTreeHelper.GetChildrenCount(mainGrid);
for (int i = 0; i < childCount; ++i)
{
var child = VisualTreeHelper.GetChild(mainGrid, i) as UIElement;
if (child != null)
{
child.Visibility = Visibility.Hidden;
child.Visibility = Visibility.Visible;
}
}
}
From my observation, this is an Intel GPU driver issue on Windows 10 only (windows 8 were fine). We have a WPF desktop application with thousands of users that runs well in Windows 7, 8, 8.1 but when installed in Windows 10, some of the Windows 10 are working well but some will appear exactly what this thread explains.
To resolve this issue, the simplest method is to update the Intel GPU driver of the problematic machine. If you are desperately finding it doesn't help even you have run the latest Windows updates and the problem still persists, try to update the driver manually by:
For some machine, e.g. Microsoft Surface 3 (not surface pro) that running kinda new CPU/GPU (Atom X7), update driver seems not possible yet and I am still finding resolution for this kind of machines.
In other cases, most of my Intel HD GPU solved this problem after updating to driver version 10.18.15.4278
Note 1: I have not seen this problem appear in other GPU, so far, say Nvidia or ATI. Note 2: In general, i would say, other than the latest Intel Atom X5/X7, most of the other Intel HD Graphic should be able to perform driver update and get this problem solved.
I have now updated my video drivers and this appears to have solved the issue.
I face the same issue since upgrading from 8.1 to Windows 10. I altered the window load method:
WindowState = WindowState.Maximized;
WindowState = WindowState.Normal;
This seems to "redraw" the window elements so that they display. I've tested this several times and each time the window appears correctly after instantly restoring itself from maximized. I didn't set window state in xaml.
(Another "fix" was to set dimension bindings such as width by specific name to all the one object of that type).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With