I created a small project below. As far as I understand, all the columns shoudl be red but no styling is being done.
MainWindow.xaml
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data;
namespace columns
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataTable dt = new DataTable();
dt.Columns.Add("Col1");
dt.Columns.Add("Col2");
dt.Columns.Add("Col3");
DataRow dr = dt.NewRow();
dr["Col1"] = "row1Col1";
dr["Col2"] = "row1Col2";
dr["Col3"] = "row1Col3";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Col1"] = "row2Col1";
dr["Col2"] = "row2Col2";
dr["Col3"] = "row2Col3";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Col1"] = "row3Col1";
dr["Col2"] = "row3Col2";
dr["Col3"] = "row3Col3";
dt.Rows.Add(dr);
rgridProgramSearchResults.ItemsSource = dt;
}
private void rgridProgramSearchResults_AutoGeneratingColumn(object sender, Telerik.Windows.Controls.GridViewAutoGeneratingColumnEventArgs e)
{
e.Column.CellStyleSelector = Application.Current.Resources["stadiumCapacityStyle"] as StyleSelector;
}
}
public class ImportStyle : StyleSelector
{
public override Style SelectStyle(object item, DependencyObject container)
{
return BigStadiumStyle;
}
public Style BigStadiumStyle { get; set; }
}
}