My WPF datagrid's columns are fixed width, which means long text in the rows are cut off. How can I have the text wrap?
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
- How to properly change a resource dictionary
If you are using a DataGridTextColumn, you need to define the Style for the DataGridTextColumn.ElementStyle
Full explination can be found at the following http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridtextcolumn(v=vs.95).aspx
You can replace the cell with a Textblock with Textwrapping enabled. i.e.
If your DataGridTextColumn is being created in the code behind you can set the style and setters this way:
This will cause the text inside the _dataGridTextColumn to wrap as it would inside a TextBlock.