Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 854259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:53:49+00:00 2026-05-15T07:53:49+00:00

I have discovered a strange bug with my WPF application and I am trying

  • 0

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, my primary on the left and secondary on the right. The problem occurs when I maximize then restore a child window of the main window on my primary monitor. The child window is sized correctly on the primary monitor, but it is drawn on my secondary monitor as if it were still maximized. Moving the child window around on the primary monitor moves it on the secondary one.

Restored child window is drawn on secondary monitor as if it were still maximized

I made a sample application (code is below) which induces this behavior.

  1. Start the application and ensure the main window is on your primary monitor.
  2. Double-click the main window. A green child window should appear.
  3. Click the green child window to maximize.
  4. Click the green child window to restore.

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)
        {
           if (e.ClickCount == 1)
           {
               if (this.WindowState == WindowState.Normal)
               {
                   this.DragMove();
               }
           }
           else
           {
               this.WindowState
                   = (this.WindowState == WindowState.Normal)
                   ? WindowState.Maximized
                   : WindowState.Normal;
           }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:53:50+00:00Added an answer on May 15, 2026 at 7:53 am

    OK, I try something today and it seems the problem happens because the maximizing activity extends the width to the second monitor before moving the window to top-left corner. Therefore, when you normalize the window, the extended part is still in the second monitor and will not be cleared until you drag the window to the second monitor.

    To work around this problem, before setting WindowState to Maximized, set Width and Height to zeros first. That will solve the problem. You may want to cache the current Top and Left so that when the window is normalized, it comes back to previous position:

    Maximized code:

     _oldTop = Top;
    _oldHeight = Height;
     Top = Height = 0;
     WindowState = WindowState.Maximized;
    

    Normalized code:

    Top = _oldTop;
    Height = _oldHeight;
    WindowState = WindowState.Normal;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with bindings in wpf. I've discovered a strange problem. I
I have recently discovered that I am affected by this bug http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71515.html Well, at
I have an e-commerce application that is exhibiting strange behavior. The product is a
I have some strange problem in my WPF app. I'm using a MVVM pattern
I have discovered a strange problem when using UIActionSheet on the iPhone (iOS 4.2).
I have discovered a strange behavior in postgres's crosstab function that I cannot explain,
I have over 30 aspx pages, i have discovered a problem recently that if
We have discovered that one of our auto generated assemblies is throwing a StackOverflowException
I have discovered that it is possible to populate resource strings with variable information
My testers have discovered that if you type free text into a file upload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.