[Q] How to
truncate a string in C# with more than 10 characters and keep word boundaries
(do not split a word in two)?
[Examples]
"Good morning test." -> "Good morni..." (wrong),
"Good morning..." (correct)
[Q] How to
truncate a string in C# with more than 10 characters and keep word boundaries
(do not split a word in two)?
[Examples]
"Good morning test." -> "Good morni..." (wrong),
"Good morning..." (correct)
Making a Bind in a WPF DataGrid is not the the most difficult task. In fact, there are dozens of posts explaining how to do it (http://wpftutorial.net/DataGrid.html, http://www.codeproject.com/Articles/30905/WPF-DataGrid-Practical-Examples). However, they all have one detail in common: they assume that the columns of the DataGrid are known at compile time, ie., each column is a reference to a property of class that represents a row in the DataGrid.
An example: the class Customer has the properties Id, Name and Age. The DataGrid displays a list of customers. Therefore, it is necessary to create a column for each property. To do so, simply create in xaml, three instances of the class DataGridTextColumn and make a bind to each of the 3 properties, like following code: