WOWW! In every time I watch a video and a question popups in my head you immediately answer it in the video as if you know exactly what I want! Thank youu for your ultimately helpful videoo ❤
I found a bug with the maximize button as the window will go below your taskbar, if you wanna fix it update the code behind to this if (WindowState == WindowState.Normal) { WindowStyle = WindowStyle.SingleBorderWindow; WindowState = WindowState.Maximized; WindowStyle = WindowStyle.None; } else WindowState = WindowState.Normal;
Hi Kampa! Very good video about a window customization!! Just a short question: it is possible to add a button inside the TitleBar but without modifying default window style? Thank you!!
I remember finding a way to do it a very long time ago, but all I really remember about doing it is that it ended up not being worth it. I know this is a bad answer --- but I found this, maybe you can tinker with it and see if it does what you are looking to do? www.codeproject.com/Tips/799302/WPF-Csharp-VB-NET-Additional-fourth-button-on-wind
@@KampaPlays Cool! Why I'm asking this: I like to create an app which can switch between touch mode and mouse mode and I like to customize the main window in this idea.
I suppose I could probably test this but when you make a custom title bar like this does it still allow snapping to left / right / top / bottom splits?
I will say, it *should* continue to allow default windows snapping behaviors, but I have seen issues where certain UI layouts prevent it from working. Great question.
There must be more going on here. I used the windowstyle just like you did and the title bar didn't disappear. In fact, in one case, it goes to the bottom of the window.
I just wonder. Once you create nice window, how can you reuse it without copying whole bunch of code every time? I can't inherit from custom window, can I?
Sorry for the delay - You could stick all of your custom window code in a C# library (.dll) and import it into each project. If you mean within the same project, you could create a parent window class and inherit from it.
@@KampaPlays Yes, exactly. So now that annoying white bar at the top (which I now know is 7px high) is gone but that also means your window is missing 7px at the top and the sides when you maximize it. Which means part of your buttons will look like they're cut off. I tried a quick fix with making the row 7px higher and then adding 7px margin at the top of the buttons and 7px on the right of the close button but it just ends up looking slightly less dorky than it did with the original white bar. ;)
Hey :) In most windows you can´t just dragmove, but also double klick to maximize the window. First of all, i didn´t use the windows MouseLeftButtonDown event, but a rectangle. DragMove worked. Then i tried to get the doubleClick event, but ractangles dont have those. So i switched it to a button, because those have both events. Now the doubleClick works, but DragMove doesn´t work with a button. Any ideas?
Good addition! If your control you are attempting to drag/hover/click handle isn't a simple space like a grid, the control where your mouse is may precedence of those events depending on what the control itself does. (So you can focus a textbox or enter a datagrid, for example, instead of dragmove taking over those abilities). Nice job figuring it out, this will probably help someone! :)
I actually had the dragmove event auto-complete as PreviewMouseLeftButtonDown instead of just MouseLeftButtonDown. Then I spent a few minutes clicking the X and reloading the app like an idiot without anything happening. :P