❔ wpf custom window
I want to design a custom window in wpf. The window should behave normally, i.e. animations, gestures, etc., but the edge of the window should be up to me. What's the best way to do this?
15 Replies
it SHOULD just be a matter of finding all the styling/templating options that you want to change
what you're probably wanting to know about, and where the interesting part of this is, is in the WindowChrome
give this a read
WindowChrome Class (System.Windows.Shell)
Represents an object that describes the customizations to the non-client area of a window.
you can create "custom" windows in two main ways
A) set WindowStyle="None", which essentially removes the chrome entirely, and requires you to implement your own minimize/maximize/close/etc functionality, if you want it
B) set WindowChrome to your own custom
WindowChrome
subclass, where you put whatever customizations you canThanks
does not work with wpf i guess
What makes you say it doesn't work with WPF?
errror message:
"Schweregrad Code Beschreibung Projekt Datei Zeile Unterdrückungszustand
Fehler XDG0008 "WindowChrome" wird in einem Windows Presentation Foundation (WPF)-Projekt nicht unterstützt. "
translated:
Severity Code Description Project File Line Suppression state
Error XDG0008 "WindowChrome" is not supported in a Windows Presentation Foundation (WPF) project.
is it possible?
i only want to change the color of the window menu border, is there any fast way to do that?
@WPF
you mean this thing?
No
the actual window border itself? or like an actual menu with File, Edit, etc?
you should be able to set the BorderBrush property on most things
The border above
ah the titlebar border... yeah you have to use WindowChrome for that because it's a part of the non-client area
not sure why it says it's unsupported for you though
could try restarting visual studios, that usually fixes those problems
worst case, create a new WPF project and it should fix it
Tried that
Didnt work
you have .NET Framework installed right?
e.g. 4.7.2
should be able to define the window chrome as something like
then you can just use a DockPanel containing a custom titlebar and the content
just put it in the window as general item or where should i put it?
i set this using a setter in a style:
now i have these problems:
1. in fullscreen a part of the window isn't visible
2. clicks on buttons on top of the window dont be recognized
3. the window animations for maximizing and minimizing dont play
4. By resizing the window on the right or top side it laggs
How can I fix this or is there any better way to do this?
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.