2012-07-30 145 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