Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1210
Styling Data Presenting in Cell
posted

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

 

Parents
No Data
Reply
  • 69686
    posted

    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();

            }

        }

Children