2012-07-30 27 views
0

在C#WPF應用程序中,我編碼了這些餅圖片:但它實際上並不顯示紅色,而是金色。現在我被告知這是因爲Visifire有一些錯誤。不過,有什麼方法可以顯示紅色。這一點非常重要,因爲護士必須知道,也許某人的優勢尚未輸入。SolidColorBrush顯示不正確

if (alrg.Description == "No Allergies") 
    alrg.Color = new SolidColorBrush(Colors.Red); 
else if (alrg.Description == "Unknown") 
    alrg.Color = new SolidColorBrush(Colors.Yellow); 
else if (alrg.Description == "Allergies") 
    alrg.Color = new SolidColorBrush(Colors.Green); 

回答

1

當然,alrg上的顏色屬性是顏色,而不是畫筆。 如果是這樣,你的任務應該是alrg.Color = Colors.Red;

你可以發佈alrg類的代碼嗎?

+0

<! - - > 雖然這不起作用。 – 2012-07-30 19:22:54

+0

[輸出(typeof(IModuleViewModel))] class PatientAllergiesViewModel:ModuleViewModel { [Import] IPatientAllergiesRepository PatientAllergiesRepository {get;組; } static readonly String [] _groups = new String [] {「Allergies」,「No Allergies」,「Unknown」}; – 2012-07-30 19:31:54

+0

public class PatientAllergy { public PatientAllergy(String description,int count) { Description = description; Count = count; } public String Description {get;私人設置; } public int Count {get;私人設置; } public Brush Color {get;組; } } – 2012-07-30 19:33:00