WPF 刷新右侧文本 - 可能很容易吗?
这对我们的设计师来说是一件好事。她的布局中,表单标题位于表单横幅的右上角,是两个英文单词。有多种形式,因此每次的单词都略有不同。所以效果是这样的:
| firstword|
| form|
在这个和左边的其他一些字段下面有一个奇特的俯冲东西。当然,对于几种不同的形式,单词的长度不同,所以有时单词在一行上,因为它们适合宽度:
| short form|
她希望单词始终在两行上,基本上是经典的“右对齐”。据我所知,这实际上是不可能的,尤其是在本地化方面。如果您喜欢某些用换行符替换空格的代码隐藏,那么您的单词会消失或在本地化中不会使用所有空格。
所以我的问题是,在 WPF 中(也许在某些排版功能中)是否有一种方法可以轻松地获得右对齐外观 - 如果“form”一词始终位于底部并右对齐,与上面的任何其他单词对齐正确的。
This is a nice-to-have for our designer. She has a layout where a form title, on the top right of the form banner, is two words in English. There are several forms so the words are a little different each time. So the effect is something like:
| firstword|
| form|
There is a fancy swoopy thing underneath this and some other fields to the left. Of course with several different forms, the words are different lengths, so sometimes the words are on one line, because they fit in the width:
| short form|
She wants the words to always be on two lines, basically classic 'flush right'. AFAIK this isn't really possible, especially with localization. If you get fancy with some codebehind that replaces the spaces with linebreaks, you'll have words that disappear or don't use all the space in localization.
So my question is if there is a way in WPF (maybe in some of those typography functions) to get a flush right look easily--if the word 'form' is always on the bottom and flush right, with whatever other words above flush right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样的东西吗?
Something like this?
听起来组成这两条线的数据是提前分开的。因此,最好将其分开,而不是将其组合起来以便稍后解析。我认为正是这让你走到了现在的位置。
如果数据保持独立,那么您无需担心尾随空格(或者很容易修剪)。将其放到显示器上时,只需将换行符插入其中即可。
Sounds like the data that make up the 2 lines is separate ahead of time. As such it would be best to keep it separate rather than have it combined only to have to parse out later. Which I think is what led you to where you are now.
If the data is kept separate then you don't need to worry about trailing spaces (or it is easily trimmed). Simply stick a line feed in there when putting it to the display.