开发者

Change datagrid selected row color programatically using wpf?

开发者 https://www.devze.com 2023-01-31 15:44 出处:网络
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))

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

精彩评论

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