How to change character spacing in XAML in a textbox?

*爱你&永不变心* 提交于 2019-12-17 20:45:44

问题


How do I change the character spacing in a WPF application within a textblock. Also known as kerning or tracking for characters.


回答1:


An answer on social.msdn suggests the use of Glyphs.

Other than that FontStretch allows for some adjustment.




回答2:


Maybe you can add a Behavior for that TextBox that would go over every character and add a space after it.

Alternatively, If you're using DataBinding, use a Converter with the same logic.

And if you want to go for an overkill, you can make a custom control, that will inherit from TextBox and implement that spacing logic That would also allow you to add a Dependency Property, something like "NumOfSpaces" and you could control how many spaces it would put



来源:https://stackoverflow.com/questions/6158199/how-to-change-character-spacing-in-xaml-in-a-textbox

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