1

I'm updating a WPF in a project. As I received it, here is how the base window is specified:

<Window x:Class="SomeProject.ButtonForm"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:SomeProject" 
        Title="ButtonForm" Height="647" Width="379" WindowStyle="None" ResizeMode="CanResizeWithGrip" 
        SnapsToDevicePixels="True" ShowInTaskbar="False" WindowStartupLocation="CenterScreen"
        SizeChanged="Resized" Closing="Window_Closing" AllowsTransparency="True" >

Some main things are that WindowStyle is None, ResizeMode is CanResizeWithGrip and AllowsTransparency is True.

What I would like to do is make this window resizable from all four edges without grips. Is there a way to do this directly in the markup? I've seen some projects that implement this, but they involve whole separate files and complicated code-behind. Certainly there is a simpler way.

kmarks2
  • 4,755
  • 10
  • 48
  • 77
  • 3
    if you create your custom window chrome, then you lose the Windows' default resizing capabilities. You have to implement it yourself. Otherwise get [this library](http://www.codeproject.com/Articles/131515/WPF-Custom-Chrome-Library) – Federico Berasategui Oct 17 '13 at 16:00
  • Okay. I'll guess I'll go the route of handling it all in code-behind. – kmarks2 Oct 17 '13 at 16:11
  • Just to check, what is the issue with WindowStyle="None" ResizeMode="CanResize"? You want no border at all? – tolanj Oct 17 '13 at 17:17
  • 1
    I just got this project and am not a WPF expert. At any rate, I just set it to `CanResize` and set `BorderThickness="5"` but I still can't resize. Am I missing something basic? – kmarks2 Oct 17 '13 at 17:38
  • 3
    `WindowStyle="None"` removes all of the built-in resizing functionality. You'll have to add invisible drag handles on all 4 sides and implement the resizing yourself. – kcnygaard Oct 17 '13 at 22:32

2 Answers2

2

Check out MahApps.Metro. It may not be exactly what you're looking for, but it'll give your application an updated look with the functionality you're looking for and takes almost no effort.

You may also want to check out this question for some more discussion about custom window chrome.

Community
  • 1
  • 1
Daniel
  • 10,864
  • 22
  • 84
  • 115
0

You have to set ResizeMode to "CanResize" and AllowTransparency to "False" to be able to see the chrome to resize it.

Andra Ciorici
  • 301
  • 1
  • 7