Alastair Pitts
Alastair Pitts

Reputation: 19601

Right align WPF window title

I'm currently creating a WPF Exception Window, much in the style of the MessageBox (static show methods). In attempting to Style it similarly, I have created an ExceptionWindowOptions enum which contains the value, RightAlign.

When the RightAlign flag is tagged in the MessageBox class, the window title is aligned to the right (next to the control box (minimize, max, close)), so i'm attempting to emulate this behaviour.

I have investigated as much as possible and I cannot find a WPF solution.

I am familiar with interop with native methods as I am using GetWindowLong and SetWindowLong for the RtlReading option, but I haven't managed to find anything to change the location of the window title.

Any help is appreciated.

Upvotes: 1

Views: 1896

Answers (2)

Chris Shain
Chris Shain

Reputation: 51329

I believe that you want to set Window.FlowDirection. That will set it for all content in the window however, including buttons, text boxes, etc, so if you ONLY want to make the title bar RTL, you could then have the window contain a panel which would reset it to LTR (or whatever).

Ack- on testing this, maybe not. It looks like it RTL's ALL of the title bar, including the control box and the icon!

Upvotes: 0

Anvaka
Anvaka

Reputation: 15823

Take a look on FluidKit library from Pavan Podila. Particularly, you may be interested in GlassWindow. The main idea here is that you override window style from scratch. Sure, this requires you to customize style for different themes, but at least it's a solution, if you don't find anything else.

Upvotes: 1

Related Questions