C# WPF Tutorial #18 - Custom Application Window and Title Bar

  Рет қаралды 25,887

Kampa Plays

Kampa Plays

Күн бұрын

Пікірлер: 49
@noname4011
@noname4011 Жыл бұрын
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 ❤
@KampaPlays
@KampaPlays Жыл бұрын
Thanks so much!!
@guilhermebiolchi1179
@guilhermebiolchi1179 6 ай бұрын
I'm here to say thanks from Brazil. Your tutorial is very clear and direct to the point. Thank you for the help.
@ErictheOldLearner
@ErictheOldLearner 2 ай бұрын
At time 4:14 you add a maximize emoji to the content of the btnMaximize - how do you do that please?
@JackieRoxs
@JackieRoxs Жыл бұрын
Thank you so much, I've used WinForms for years, but decided to move to WPF for more UI customizations
@KampaPlays
@KampaPlays Жыл бұрын
Awesome! It was a hard jump at first, feeling like reinventing the wheel sometimes, but once I was into it, I was hooked!
@jurgenmarkus1345
@jurgenmarkus1345 Жыл бұрын
Thanks!
@KampaPlays
@KampaPlays Жыл бұрын
Thanks so much! Appreciate that!!
@wookyumkim4669
@wookyumkim4669 Жыл бұрын
That is another very practically useful tip! Thank you very much!! 😆😆
@KampaPlays
@KampaPlays Жыл бұрын
Glad it helped!
@nssalon
@nssalon 9 ай бұрын
I love your tuitorial.
@KampaPlays
@KampaPlays 8 ай бұрын
Thanks so much!
@14768
@14768 Жыл бұрын
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?
@KampaPlays
@KampaPlays Жыл бұрын
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.
@bartsworkshop
@bartsworkshop 11 ай бұрын
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;
@KampaPlays
@KampaPlays 11 ай бұрын
I'll check this out, thanks for the info!!
@trerouploads8169
@trerouploads8169 3 ай бұрын
thanbk u so much for the chrome fix stuff
@bioanu
@bioanu Жыл бұрын
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!!
@KampaPlays
@KampaPlays Жыл бұрын
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
@bioanu
@bioanu Жыл бұрын
@@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.
@thecoweggs
@thecoweggs 5 ай бұрын
GOAT
@webdesignsbytom
@webdesignsbytom Жыл бұрын
I will remember to go backk and like every video
@KampaPlays
@KampaPlays Жыл бұрын
Really appreciate it!
@sajmonator7325
@sajmonator7325 10 ай бұрын
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?
@KampaPlays
@KampaPlays 9 ай бұрын
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.
@WIckedOmenOfThunder
@WIckedOmenOfThunder Жыл бұрын
Hey Kampa! Could you make a video about MVVM, and how you keep things nice and separated yet functional?
@KampaPlays
@KampaPlays Жыл бұрын
Hey! Yes, I will be getting to a few videos about MVVM very shortly!
@Jumph96
@Jumph96 Жыл бұрын
@@KampaPlays Looking forward to those..👍👍
@fooballers7883
@fooballers7883 Жыл бұрын
Brilliant tutorials.... Thank you
@KampaPlays
@KampaPlays Жыл бұрын
Thank you!!
@dakloafitz6347
@dakloafitz6347 Жыл бұрын
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?
@dakloafitz6347
@dakloafitz6347 Жыл бұрын
Got it, I have to use PreviewMouseLeftButtonDown and PreviewMouseDoubleClick :)
@KampaPlays
@KampaPlays Жыл бұрын
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! :)
@robinheyer708
@robinheyer708 Жыл бұрын
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
@KampaPlays
@KampaPlays Жыл бұрын
@@robinheyer708 Ahhhh! Auto-complete has burned me more times than I'd like to admit 🤣
@GuitarAge
@GuitarAge Жыл бұрын
Thank you! )
@KampaPlays
@KampaPlays Жыл бұрын
Glad to help!!
@frednicholson
@frednicholson Жыл бұрын
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.
@KampaPlays
@KampaPlays Жыл бұрын
Whaaaat? I can't say that I've ever seen that happen. Can you share your window code with me?
@robinheyer708
@robinheyer708 Жыл бұрын
That WindowChrome setting put me in a 7px nightmare lol. Maybe I'll just remove the maximize button... :P
@KampaPlays
@KampaPlays Жыл бұрын
🤔 Interesting! What exactly is it doing? You are using WindowStyle.None?
@robinheyer708
@robinheyer708 Жыл бұрын
@@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. ;)
@KampaPlays
@KampaPlays Жыл бұрын
@@robinheyer708 Ah!! Yes!! Thank you for pointing this out, it just slipped my mind! (Sorry!) Hopefully your comment will help others as well!!
@rajivlather8918
@rajivlather8918 Жыл бұрын
👍
@tranguyentruc7033
@tranguyentruc7033 Жыл бұрын
how to write symbol maximize?
@KampaPlays
@KampaPlays Жыл бұрын
You can use codes, but honestly sometimes, I just search for and copy and paste the unicode character itself: 🗖
@ion4798
@ion4798 4 ай бұрын
oh, that is simple, but there is one more thing, when window is maximized you must be able to drag window , that is tricky
@CapPat855
@CapPat855 6 ай бұрын
🗖
-5+3은 뭔가요? 📚 #shorts
0:19
5 분 Tricks
Рет қаралды 13 МЛН
$1 vs $500,000 Plane Ticket!
12:20
MrBeast
Рет қаралды 122 МЛН
Непосредственно Каха: сумка
0:53
К-Media
Рет қаралды 12 МЛН
Java (lvl2) lessons: 040
22:59
Tech 42
Рет қаралды 8
The Basics of Data Binding in WPF
20:53
Tactic Devs
Рет қаралды 51 М.
C# WPF Tutorial #21 - Styles and ControlTemplates
12:53
Kampa Plays
Рет қаралды 23 М.
WPF C# MVVM Sample Application
13:16
MpCodes
Рет қаралды 20 М.
C# WPF and GUI - Pages and Navigation
7:48
Ilford Grammar School
Рет қаралды 286 М.
Custom Title Bar in WPF
14:33
WPF UI Example
Рет қаралды 2,4 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,4 МЛН
C# WPF Modern UI Flat Design Tutorial
20:25
Payload
Рет қаралды 224 М.
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 146 М.
How To Use PowerShell and WPF To Create Advanced GUIs
17:06
ITPro Today
Рет қаралды 2,6 М.
-5+3은 뭔가요? 📚 #shorts
0:19
5 분 Tricks
Рет қаралды 13 МЛН