There must be a simple solution for this, but I just can't find it. I have a DataGrid with DataGridTextColumns which contain data. This is working fine. I just seem to not get the String inside the Cells to make a line break, instead everything is in one line (no matter how long the string is).
dataGrid.IsReadOnly = true;
dataGrid.AutoGenerateColumns = false;
dataGrid.ItemsSource = ConvertListIntoPlantViewModel(lList);
DataGridTextColumn textColumn1 = new DataGridTextColumn();
DataGridTextColumn textColumn2 = new DataGridTextColumn();
DataGridTextColumn textColumn3 = new DataGridTextColumn();
textColumn3.MaxWidth = 200;
textColumn1.Header = "Name";
textColumn1.Binding = new Binding("Name");
textColumn2.Header = "Type";
textColumn2.Binding = new Binding("Type");
textColumn3.Header = "Info";
textColumn3.Binding = new Binding("Information");
dataGrid.Columns.Add(textColumn1);
dataGrid.Columns.Add(textColumn2);
dataGrid.Columns.Add(textColumn3);
Let's say I want to make the Text, which ends up in textColumn3 to make a line break at the end of the cell (which is 200 wide). How do I achieve this? There must be a simple Style Element that can be set, right? I just can't find it.
Help would be appreciated, thanks!