zulqarnain
zulqarnain

Reputation: 1735

Make WPF MahApps MetroWindow non-draggable

I've just started using MahApps with WPF. After converting my WPF Window to a MetroWindow it's no more locked. With standard WPF and the following settings WindowStyle="None" ResizeMode="NoResize the window is not movable.

However with MetroWindow it is movable. I don't want users to be able to move the window around. How can I achieve this with MetroWindow?

Upvotes: 1

Views: 1583

Answers (1)

Ramin Bateni
Ramin Bateni

Reputation: 17415

As @Mathew said, you can set IsWindowDraggable property of your MetroWindow to false. A sample code can be like this:

<controls:MetroWindow 
             x:Class="MyNameSpace.Window1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"

             IsWindowDraggable="False"
             ResizeMode="NoResize"
             WindowStyle="None"
             ShowTitleBar="False"
             >

             .....

</controls:MetroWindow>

Upvotes: 2

Related Questions