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 9272489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:53:19+00:00 2026-06-18T15:53:19+00:00

I am creating a WPF window with a custom chrome, so I setted ResizeMode=NoResize

  • 0

I am creating a WPF window with a custom chrome, so I setted ResizeMode="NoResize" and WindowStyle="None" to implement my own chrome. However, there is an issue while maximizing the borderless window: it takes the whole screen.

I found the following trick to fix part of the issue:
http://chiafong6799.wordpress.com/2009/02/05/maximizing-a-borderlessno-caption-window/

This successfully restrain the window size to prevent from covering a taskbar. However, if the user have his taskbar positionned at the left or at the top, this won’t work, as the window is at position 0,0.

Is there any way to retrieve more accurately the available area, or to query the user taskbar’s position so I can position the maximized window accordingly?

  • 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-06-18T15:53:20+00:00Added an answer on June 18, 2026 at 3:53 pm

    I had a quick play around and it seems that setting the Windows Left and Top properties is ignored when setting WindowState.Maximized with a borderless form.

    One workaround would be to ignore the WindowState functions and create your own Maximize/Restore functions

    Rough example.

    public partial class MainWindow : Window
    {
        private Rect _restoreLocation;
    
        public MainWindow()
        {
            InitializeComponent();
        }
    
        private void MaximizeWindow()
        {
            _restoreLocation = new Rect { Width = Width, Height = Height, X = Left, Y = Top };
            System.Windows.Forms.Screen currentScreen;
            currentScreen = System.Windows.Forms.Screen.FromPoint(System.Windows.Forms.Cursor.Position);
            Height = currentScreen.WorkingArea.Height;
            Width = currentScreen.WorkingArea.Width;
            Left = currentScreen.WorkingArea.X;
            Top = currentScreen.WorkingArea.Y;
        }
    
        private void Restore()
        {
            Height = _restoreLocation.Height;
            Width = _restoreLocation.Width;
            Left = _restoreLocation.X;
            Top = _restoreLocation.Y;
        }
    
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            MaximizeWindow();
        }
    
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            Restore();
        }
    
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                DragMove();
            }
            base.OnMouseMove(e);
        }
    }
    

    Xaml:

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="74.608" Width="171.708" ResizeMode="NoResize" WindowStyle="None">
        <Grid>
            <Button Content="Max" HorizontalAlignment="Left" Margin="0,29,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1"/>
            <Button Content="Restore" HorizontalAlignment="Left" Margin="80,29,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_2"/>
        </Grid>
    </Window>
    

    Obviously you will want to clean this code up, but it seems to work wherever the Taskbar is located, However you may need to add some logic to get the correct Left, Top if the users font DPI is larger than 100%

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

Sidebar

Related Questions

I am creating a WPF/xaml application with WindowStyle=None So because of this I am
If you are creating a WPF window or a WPF page, you can bind
Is there any good tutorial for creating WPF controls entirely at runtime? Thanks
I am creating a WPF custom control, a Button with an Image and Text
I am creating a WPF window with a DataGrid , and I want to
When creating a Navigation Application in WPF, How can I create a custom style
I am creating a page-based WPF application using MVVM. I have created a custom
In my WPF application, I host Win32 content using HwndHost. However, creating a HwndHost
In a WPF application, I am creating a setting window to customize keyboard shortcuts.
In WPF, I am creating a simple custom control for my TODO program. It

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.