0
我的問題很簡單。我有一個數據網格和綁定項目集合。 數據顯示沒有任何問題,但我想格式化單元格。DataGrid單元格的綁定樣式
在收集該項目已經簡單地說,這樣的結構:
{
public string Text { get; set; }
public string Title {get;set;}
public Brush BGBrush { get; set; }
public Brush Color { get; set; }
}
我映射這樣的:
<DataGridTextColumn Binding="{Binding Path=Text}" Header="{Binding Path=Title}" Foreground="{Binding Path=Color}" />
數據顯示,但前景和背景並沒有改變。 任何幫助將不勝感激。 我可能會完全錯誤,但我只是在學習數據網格。 非常感謝幫助
我認爲這不會工作的原因簡單地列的前景屬性沒有與觸摸數據源集合來自DataGrid的ItemsSource屬性。在這裏,您想要設置每個列的單元格的顏色不是整列單元格的顏色。希望我的答案在下面是你要找的。 – HichemSeeSharp 2012-07-28 23:45:50