Pinchas K
Pinchas K

Reputation: 1571

Make a field to mixed case

Patient.name's actual data is in Caps. I have to make it mixed case date for nicer viewing. Can I do this here on the XAML? How can I code this?

<dxg:GridColumn FieldName="Patient.Name" />
<dxg:GridColumn FieldName="Patient.Room" />
<dxg:GridColumn FieldName="Patient.BirthDate" />

Upvotes: 0

Views: 126

Answers (1)

Eric J.
Eric J.

Reputation: 150108

You can add a property that wraps Patient.Room etc. with code that converts to title case and bind to that property instead.

Your binding:

<dxg:GridColumn FieldName="Patient.RoomTitleCase" />

In your class:

public string RoomTitleCase
{
    get
    {
        System.Globalization.CultureInfo cultureInfo =     
                 System.Threading.Thread.CurrentThread.CurrentCulture;
        System.Globalization.TextInfo textInfo = cultureInfo.TextInfo;

        string titleCase = textInfo.ToTitleCase(Room.ToLower());
        return titleCase;
    }
}

http://techiecocktail.blogspot.com/2008/09/convert-given-string-to-mixed-case-or.html

Upvotes: 2

Related Questions