<DataGrid x:Name="SmartTable"></DataGrid>
次に、私はコード内の列を初期化し、この構造体にバインド:
public struct HddData
{
public Ellipse status { set; get; }
public string id { set; get; }
public string atribute { set; get; }
public string current { set; get; }
public string worst { set; get; }
public string treshhold { set; get; }
public string data { set; get; }
}
そしてfinaly、私は、foreachのを使用して、テーブルに行を挿入しようとしている:
Ellipse good = new Ellipse();
Ellipse bad = new Ellipse();
good.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF64DD17"));
bad.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFD50000"));
SmartTable.Items.Add(new HddData
{
status = attr.Value.IsOK ? good : bad,
id = attr.Value.id,
atribute = attr.Value.Attribute,
current = attr.Value.Current.ToString(),
worst = attr.Value.Worst.ToString(),
treshhold = attr.Value.Threshold.ToString(),
data = attr.Value.Data.ToString("X"),
});
テキストデータは罰金結合するが、省略記号は、セル内の文字列の一種であり、このことを示しています。
System.Windows.Shapes.Ellipse
どのようにテキストとしてではなく楕円として表示できますか?
XAMLを学ぶ、このことは致命的です。 DataGridTemplateColumnが必要です。 –
@EdPlunkett:+1。 majukin:あなたは、あなたのdatagridカラムのいくつかのテンプレートを行う必要があります。 –