Plus Edition. Incorrect window position restoration after returning from the maximized state.

Open
#1,804 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp
Domain
desktop

Research direction

Start in Child_MaximizedChanged and compare the supplied current and corrected code paths. Reproduce the child-window sequence by moving it, maximizing it, and restoring it; done means the prior Left and Top are restored while the window remains restricted to the valid container area.

Written by the indexing model from the issue text.

Description

Sequence of actions:

  1. Child window. Left > 0 and Top > 0.
  2. Maximize the window to full screen.
  3. Restore the window position to the previous state.
    Left = 0 and Top = 0. That is, the previous position is not restored.

Source code:

        private void Child_MaximizedChanged(object sender, EventArgs e) {
		...
                WindowContainerChildData initialData = (WindowContainerChildData)windowControl.InitialData;
                windowControl.Left = initialData.Left;
                windowControl.Top = initialData.Top;
                windowControl.Width = initialData.Width;
                windowControl.Height = initialData.Height;
                windowControl.UpdateLayout();
                windowControl.Left = this.GetRestrictedLeft(windowControl);
                windowControl.Top = this.GetRestrictedTop(windowControl);
            }
        }

Corrected code:

        private void Child_MaximizedChanged(object sender, EventArgs e) {
		...
                WindowContainerChildData initialData = (WindowContainerChildData)windowControl.InitialData;
                windowControl.Width = initialData.Width;
                windowControl.Height = initialData.Height;
                windowControl.UpdateLayout();
                windowControl.Left = initialData.Left;
                windowControl.Top = initialData.Top;
                windowControl.Left = this.GetRestrictedLeft(windowControl);
                windowControl.Top = this.GetRestrictedTop(windowControl);
            }
        }

Dominant language
C#
Stars
4.2k
Forks
912
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xceedsoftware/wpftoolkit

All issues in xceedsoftware/wpftoolkit

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.