This is a very short post discussing about how to accommodate the overflown text in a text block when we don't want to wrap. Let's see what I am talking about. Here we have a Text Block showing the first name of a user. Since names can be longer than whatever we plan for in this view. We don't want to wrap them into a new line. We also want to show ellipsis at the end to show the presence of hidden text part.
In order to do that, WPF has provided TextTrimming property in TextBlock. In order to get the above result, we can just provide the TextBlock definition as follows:
Here we are using the ellipsis on word boundaries. We can also use it on character boundaries. We just need to set it like this:
And it should show up like this: