开发者

Change datagrid selected row color programatically using wpf?

I want to change the selected row color dynamically开发者_如何学Go in code behind. I'm using Visual Studio 2008. Can anyone help to do this?


Dim selectedItem As New Style(GetType(DataGridCell))
    Dim triggerIsSelected As New Trigger() With {.[Property] = DataGridCell.IsSelectedProperty, .Value = True}
    triggerIsSelected.Setters.Add(New Setter(DataGridCell.BackgroundProperty, System.Windows.Media.Color.Red))
    selectedItem.Triggers.Add(triggerIsSelected)
    Datagrid1.CellStyle = selectedItem
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜