Posted 10 September 2017, 10:57 am EST
I need to change the column & row header's background & foreground colors on selection.
I tried with -
sheet.SelectionChanged += new EventHandler<SheetSelectionChangedEventArgs>(sheet_SelectionChanged);
void sheet_SelectionChanged(object sender, SheetSelectionChangedEventArgs e)
((Worksheet)sender).ColumnHeader.Columns[e.Column].Background = new SolidColorBrush(Colors.Blue);
((Worksheet)sender).ColumnHeader.Columns[e.Column].Foreground = new SolidColorBrush(Colors.White);
But, it shows the changed color, when I moved to the next selection. It means it changes, but not reflecting on focus. At the focus it shows orange & when moved to next selection, showing the changed one. Please, check the screenshot attached.
When cell selected - Blue background & white text will appear for row & column header.
When selection changed - Previously changed headers will get back to default style & new row, column headers will get in blue & white.
2012/10/Column Header color change on selection.JPG