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

  • Home
  • SEARCH
  • 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 7430007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:04:19+00:00 2026-05-29T09:04:19+00:00

I am a novice WPF programmer. My problem is as below. I have a

  • 0

I am a novice WPF programmer. My problem is as below.

I have a WPF application and on the home screen, when I click on the maximize button, it does not maximize the screen, instead repositions it to the top left column. If I increase/decrease the screen size through click and drag, the maximize button works just fine. The window properties are set up as follows:

<Window x:Class="MyApp.Home" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        x:Uid="Window_Main" 
        x:Name="HomeWindow" 
        WindowStyle="None" 
        AllowsTransparency="True" 
        WindowStartupLocation="CenterScreen" 
        Margin="0" 
        BorderBrush="Transparent" 
        BorderThickness="0" 
        Title="Home" 
        MinWidth="1000" MinHeight="800"  
        ResizeMode="CanResizeWithGrip" 
        HorizontalAlignment="Stretch" 
        VerticalAlignment="Stretch" 
        SizeToContent="WidthAndHeight" 
        Visibility="Visible" 
        d:DesignHeight="1080" d:DesignWidth="1200">

The XAML for button is:

<Button x:Uid="btnRestore" x:Name="btnRestore" Height="20" Width="20" Style="{DynamicResource Control_WindowControlBoxStyle}"  Margin="5,0,0,0" ToolTip="Toggle Restore" Click="btnRestore_Click" />

And the code for btnRestore_Click is simple:

    private void btnRestore_Click(object sender, RoutedEventArgs e)
    {
        WindowState = WindowState.Maximized;      
    }

I am sure there must be some silly mistake that I am committing but not able to figure out what that is. Seems simple but caught me in spin. Any help would be appreciated.

  • 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-29T09:04:20+00:00Added an answer on May 29, 2026 at 9:04 am

    You have SizeToContent="WidthAndHeight", which will make the window resize to whatever size the content in the Window is.

    Either remove this property, or make sure first child of your Window tag doesn’t have a size set

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the below LINQ statement, and get the error 'int' does not contain
I have a WPF application which has a DirectX component within it. This component
We are facing a strange problem. We have a user control written in WPF
I have a WPF application in which I'm moving data around on a Canvas.
I'm a novice WPF programmer. I'm trying to add some structure to my code:
I'm a newbie with WPF and c# and have a (probably very simple) problem.
I have a WPF application, and I subscribe to the event AppDomain.AssemblyResolve (this event
I'm binding an ItemsControl to an EntitySet in a WPF application. Its not acting
I have a WPF application rendering fonts to a larger size than I expect.
I am a novice programmer who is trying to teach myself to code, specifically

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.