2012-08-01 39 views
0

Patient.name的實際數據顯示在第上方。爲了更好地觀看,我必須將其混合使用日期。我可以在XAML上做這個嗎?我如何編碼?將字段設置爲混合大小寫

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

回答

2

您可以添加一個屬性,將Patient.Room等包裝爲包含轉換爲標題大小寫並綁定到該屬性的代碼。

你的綁定:

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

在你的類:

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

+0

注意,這大概會轉成麥當勞麥當勞,麥當勞沒有。前兩行可以縮短爲'var textInfo = Thread.CurrentThread.CurrentCulture.TextInfo;'(with proper'using') – 2012-08-01 19:30:37

+0

對你真的很好 – 2012-08-01 19:31:51

相關問題