Padding a numeric display in WPF

主宰稳场 提交于 2019-12-02 04:07:10

Try {}{0,10:#,0} for a field of 10 characters.

Note, however, that this will give odd results if the font is not fixed-width. I tried it in Kaxaml, and it works, but the text doesn't line up with a proportional font.

I think you need something like {0,7} (display argument on seven positions, padding to the left with spaces). However, even in this case, for the text not to jump, you need to use a monospaced font, or at least a font that has the width of the space character equal to the width of the digits.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!