How can I create a basic custom window chrome for a WPF window, that doesn't include the close button and still a moveable and resizeable window?
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- Xamarin. The name 'authorEntry does not exist
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
I've just used the example below for .net 4.5 and it works very well. Interestingly, it uses a code behind for a resource dictionary for the click events. All you have to do is reference the resource dictionary in your
app.xaml
file and then assign the Window the StyleCustomWindowStyle
. This was shamelessly stolen from http://www.eidias.com/blog/2014/1/27/restyle-your-window.And for the code behind:
You set your Window's
WindowStyle="None"
, then build your own window interface. You need to build in your own Min/Max/Close/Drag event handlers, but Resizing is still maintained.For example:
And here's some example code-behind for common window functionality
.NET 4.5 added a new class that greatly simplifies this.
You can find a tutorial here.
And here's a short example usage.