Is there any recommended way with WPF to create a common window style to be used across an application? I have several dialogs that appear in my app, and I would like them all to be styled the same (same window border, ok/cancel button position, etc) and simply have different ‘content’ in each, depending on the situation. So, one dialog might have a list box in it, one might have a textbox, and so on.
I understand how to make base .cs usercontrol files, but I can’t for the life of me work out a good way to create a single window which can host different content when launched?
Cheers,
rJ
One way to do it would be a new custom control, let’s call it
DialogShell:This now needs a template which would normally be defined in
Themes/Generic.xaml, there you can create the default structure and bind theContent:This is just an example, you probably want to hook up those buttons with custom events and properties you need to define in the cs-file.
This shell then can be used like this:
Event wiring example (not sure if this is the “correct” approach though)