Padding a numeric display in WPF

前端 未结 2 944
清歌不尽
清歌不尽 2021-01-24 20:57

I\'ve got a position readout that\'s very simple -- it\'s just a TextBlock with a Style applied to it. In that Style, I just set it like so (there are more properties than this

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-24 21:47

    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.

提交回复
热议问题