Hi,
I'm new with Infragistics xamDataGrid.
I have a cell containing 3 strings separated with spaces between them.
For example a cell value may be: "VALUEA VALUEB VALUEC".
I'd like the data to be displayed in the cell one value below the other - for example ONE cell would look like this:
---------------------.....
| VALUEA |.....
| VALUEB |.....
| VALUEC |.....
___________......
Is this possible? If i need to hold the data in a specific structure in my object model - that is fine with me as well but just want to know if i can achieve this somehow...
Thanx!!
-Gili
Hello Gili,
Yes, there are couple of ways that I can think of right now to do this. The best of them I believe is with a IValueConverter and assigning it to the ValueToDisplayTextConverter property. Here is some sample code for this that you can use :
<local:NewLineConverter x:Key="conv"/>
<Style TargetType="{x:Type igEditors:XamTextEditor}">
<Setter Property="ValueToDisplayTextConverter" Value="{StaticResource conv}"/>
</Style>
public class NewLineConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
string text=null;
string result=null;
if (value != null)
text = value.ToString();
string[] words = text.Split( new char[] {' '},StringSplitOptions.RemoveEmptyEntries);
foreach (string word in words)
result = String.Concat(result, Environment.NewLine,word);
}
return result;
return Binding.DoNothing;
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
throw new NotImplementedException();
Thanx Alex.
But how would that effect the grid's editing capabilities?
Would these cells still be editable?
THANX AGAIN!
Gili,
As the name of the converter implies - ValueToDisplayText, it will only convert the display text of the editor - what you see when the editor is not in edit mode. The editing capabilities will not be affected in any way.