Padding a numeric display in WPF

前端 未结 2 913
清歌不尽
清歌不尽 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:33

    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.

提交回复
热议问题