Click here to Skip to main content
15,566,305 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used DataGrid Control in my App. since I am new at WPF, there is always somestuff I don't understand. I want to each cell in DataGrid show Multi line text when dispalying Text is so much. I tried to find out solution and Tried some codes , but did not make it out.
I find a way for make cell border red when it is editing. code as blow

//Cell border turn red when editing
 Style cellStyle = new Style(typeof(DataGridCell));
 Trigger isEditingTrigger = new Trigger();
 isEditingTrigger.Property = DataGridCell.IsEditingProperty;
 isEditingTrigger.Value = true;
 isEditingTrigger.Setters.Add(new Setter(DataGridCell.BorderBrushProperty, Brushes.Red));
 cellStyle.Triggers.Add(isEditingTrigger);

 // Set the cell style for the grid
 this.m_DataGrid.CellStyle = cellStyle;


I tried to use similar methods, but failed. How can I set TextWrapping property for Multi line text Display.

I did not put any control in my DataGrid cell, so how can I make it display multi line text programmatically ? Please note, I need Programmatic method.

please help!
Posted

1 solution

You need to put a textbox in your cell, then you can set it's text wrapping, programatically.
 
Share this answer
 
Comments
Alimjan Yasin 8-Jul-11 4:57am    
could you please provide sample code ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900