Developer technologies | Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows devices.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
How to set DataGridHeader background color code behind.
I tried such code, in AutogeneratigColumns event handler
Setter s = new Setter();
s.Property = BackgroundProperty;
s.Value = new SolidColorBrush(Colors.Red);
//e.Column.HeaderStyle.Setters.Add(s);
Style ss = new Style();
ss.Setters.Add(s);
e.Column.HeaderStyle = ss;
but I failed.
You can change the colors for example in Page_Loaded :
this.Resources["DataGridColumnHeaderBackgroundColor"] = Windows.UI.Color.FromArgb(128, 0, 255, 0);
this.Resources["DataGridColumnHeaderHoveredBackgroundColor"] = Windows.UI.Color.FromArgb(255, 0, 128, 128);
this.Resources["DataGridColumnHeaderPressedBackgroundColor"] = Windows.UI.Color.FromArgb(255, 0, 255, 128);