WPF窗口-中心窗口标题 [英] WPF Window - Center Window Title

查看:84
本文介绍了WPF窗口-中心窗口标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在构建WPF Windows应用程序.它与功能区工具栏一起运行-因此,它实际上是功能区窗口

我目前已将窗口配置为标题为测试窗口"

标题在窗口栏中左对齐

有人知道我可以将窗口标题文本居中吗?例如Office 2010 ...

我猜可能有一种讨厌的方式,可以通过编程方式在实际文本之前在Title值中插入空格-如果用户调整窗口大小,这很讨厌.
有人知道主意吗?

非常感谢您的帮助,

干杯,
Dan

Hi All,
Im building a WPF Windows Application. This is running with a Ribbon Toolbar - so its affectively a Ribbon Window

I have the Window configured with a title of "Test Window" at present

The title is left aligned in the Window Bar

Does anyone know of a way I can center the window title text? Like Office 2010 for example...

I guess there is probably a nasty way of programatically inserting spaces into the Title value before the actual text - which is nasty if the User resizes the window

Anyone know of ideas ?

Greatly appreciate your help,

Cheers,
Dan

推荐答案

我还没有完全了解 [ ^ ],但是它具有与您要执行的操作类似的功能.

玩一玩:)
I haven''t looked all the way through this[^] but it has stuff similar to what you want to do.

Have a play. :)


您应该记住,WPF控件中的窗口由GDI部分(包括标题栏,外边界等)和中间的WPF部分组成.

如果要处理功能区控件,通常需要禁用标题"栏并重新创建自己的标题.

像这样的东西:
http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!345.entry [ ^ ]

要了解Ribbon,您可以阅读以下内容:
http://www.abhisheksur.com/2010/08/introducing- ribbon-ui-control-for-wpf.html [ ^ ]
:rose:
You should remember, a Window in WPF control is composed of GDI portion (which includes the Title bar, outer boundary etc) and the WPF portion in the middle.

If you are dealing with Ribbon control, generally you need to disable the Title bar and recreate the title of your own.

something like this :
http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!345.entry[^]

To know about Ribbon you can go through :
http://www.abhisheksur.com/2010/08/introducing-ribbon-ui-control-for-wpf.html[^]
:rose:


这篇关于WPF窗口-中心窗口标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆