C# 将字段设置为混合情况

C# 将字段设置为混合情况,c#,wpf,xaml,C#,Wpf,Xaml,Patient.name的实际数据以大写字母表示。为了更好地观看,我必须把它做成混合日期。我可以在XAML上这样做吗?我如何编写代码 <dxg:GridColumn FieldName="Patient.Name" /> <dxg:GridColumn FieldName="Patient.Room" /> <dxg:GridColumn FieldName="Patient.BirthDate" /> 您可以添加一个属性,该属性使用转换为标题大小写并绑定到

Patient.name
的实际数据以大写字母表示。为了更好地观看,我必须把它做成混合日期。我可以在XAML上这样做吗?我如何编写代码

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

您可以添加一个属性,该属性使用转换为标题大小写并绑定到该属性的代码包装Patient.Room等

你的约束力:

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

请注意,这可能会使麦当劳变成麦当劳,而不是麦当劳。前两行可以缩短为
var textInfo=Thread.CurrentThread.CurrentCulture.textInfo(使用适当的
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;
    }
}