[Win10] Let TextBlock wrap By character, win10textblock
To automatically Wrap text in TextBlock, you only need to set the TextWrapping attribute to Wrap.
However, TextWrapping tries its best to wrap a line based on white spaces. Therefore, the following situation may occur:
Content at the same level must be aligned.
The preceding situation may mislead users into three sections:
Public class CharacterWrapConverter: IValueConverter {public object Convert (object value, Type targetType, object parameter, string language) {var str = (string) value; return string. join ("\ u200B", str. toCharArray ();} public object ConvertBack (object value, Type targetType, object parameter, string language) {throw new NotImplementedException ();}}
Effect:
Now, you will surely think that this text is a whole, rather than being divided into three parts as previously. It looks more beautiful.