Secondary monitor bug: a problem in WPF or in the graphics driver?
Posted
by emddudley
on Stack Overflow
See other posts from Stack Overflow
or by emddudley
Published on 2010-04-21T14:59:24Z
Indexed on
2010/04/21
15:03 UTC
Read the original article
Hit count: 722
I have discovered a strange bug with my WPF application and I am trying to determine whether it is a problem with WPF or my graphics driver so that I can report it to the appropriate company. I have a Quadro FX 1700 with the latest drivers (197.54) on a Windows XP system, running a .NET 3.5 SP1 application.
I have dual monitors, and when I maximize then minimize a child window of the main window on my primary monitor, the child window gets drawn on the secondary monitor as well. It appears in both places.
I made a sample application (code is below) which induces this behavior.
- Start the application and ensure the main window is on your primary monitor.
- Double-click the main window. A green child window should appear.
- Click the green child window to maximize.
- Click the green child window to minimize.
Can anyone else reproduce this problem? On my system the green child restores, but then it's drawn on both my primary and secondary monitors, rather than just the primary monitor.
App.xaml
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="DualMonitorBug.App"
StartupUri="Shell.xaml" />
App.xaml.cs
using System.Windows;
namespace DualMonitorBug { public partial class App : Application { } }
Shell.xaml
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="DualMonitorBug.Shell"
Title="Shell" Height="480" Width="640"
MouseDoubleClick="ShowDialog" />
Shell.xaml.cs
using System.Windows;
using System.Windows.Input;
namespace DualMonitorBug
{
public partial class Shell : Window
{
public Shell()
{
InitializeComponent();
}
private void ShowDialog(object sender, MouseButtonEventArgs e)
{
DialogWindow dialog = new DialogWindow();
dialog.Owner = this;
dialog.Show();
}
}
}
DialogWindow.xaml
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="DualMonitorBug.DialogWindow"
Title="Dialog Window" Height="240" Width="320"
AllowsTransparency="True"
Background="Green"
MouseLeftButtonDown="ShowHideDialog"
WindowStyle="None" />
DialogWindow.xaml.cs
using System.Windows;
using System.Windows.Input;
namespace DualMonitorBug
{
public partial class DialogWindow : Window
{
public DialogWindow() { InitializeComponent(); }
private void ShowHideDialog(object sender, MouseButtonEventArgs e)
{
this.WindowState
= (this.WindowState == WindowState.Normal)
? WindowState.Maximized
: WindowState.Normal;
}
}
}
© Stack Overflow or respective owner