Hello,
I ran into a problem when adding a columns thru code. It seemed to work fine in the 2009 Q3 Beta 1 version. basically i'm adding the columns in codebehind then later on i'm adding data to the grid. When I do that the filters dont show up on the Column Headers.
here is some sample code.
if I set the DataType of the column the filters show up. Not sure if its a bug or not but thought i would ask.
Thanks Again,
Boots
I ran into a problem when adding a columns thru code. It seemed to work fine in the 2009 Q3 Beta 1 version. basically i'm adding the columns in codebehind then later on i'm adding data to the grid. When I do that the filters dont show up on the Column Headers.
here is some sample code.
<Window x:Class="WpfApplication1.Window1" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
Title="Group Chart Test"> |
<Grid> |
<Grid.RowDefinitions> |
<RowDefinition /> |
<RowDefinition Height="30" /> |
</Grid.RowDefinitions> |
<Grid.ColumnDefinitions> |
<ColumnDefinition /> |
<ColumnDefinition /> |
</Grid.ColumnDefinitions> |
<telerik:RadGridView Name="rgv" |
AutoGenerateColumns="False" |
Grid.Row="0" |
Grid.ColumnSpan="2"/> |
<Button Click="Button_Click" |
Grid.Row="1" |
Grid.Column="0" |
Content="Add Columns"/> |
<Button Click="Button_Click_1" |
Grid.Row="1" |
Grid.Column="1" |
Content="Add Items"/> |
</Grid> |
</Window> |
public partial class Window1 : Window |
{ |
ArrayList arrayList = new ArrayList(); |
public Window1() |
{ |
try |
{ |
InitializeComponent(); |
for (int i = 0; i < 100; i++) |
{ |
arrayList.Add(new myObject() |
{ |
Year = 2002, |
Quarter = "First", |
Make = "Chevrolet", |
Sales = 1000 |
}); |
} |
} |
catch (Exception ex) |
{ |
MessageBox.Show(ex.ToString()); |
} |
} |
private void Button_Click(object sender, RoutedEventArgs e) |
{ |
rgv.Columns.Add(new GridViewDataColumn() |
{ |
UniqueName = "Year", |
Header = "Year" |
}); |
rgv.Columns.Add(new GridViewDataColumn() |
{ |
UniqueName = "Quarter", |
Header = "Quarter" |
}); |
rgv.Columns.Add(new GridViewDataColumn() |
{ |
UniqueName = "Make", |
Header = "Make" |
}); |
rgv.Columns.Add(new GridViewDataColumn() |
{ |
UniqueName = "Sales", |
Header = "Sales" |
}); |
} |
private void Button_Click_1(object sender, RoutedEventArgs e) |
{ |
rgv.ItemsSource = arrayList; |
} |
} |
class myObject |
{ |
public int Year { get; set; } |
public String Quarter { get; set; } |
public String Make { get; set; } |
public double Sales { get; set; } |
} |
if I set the DataType of the column the filters show up. Not sure if its a bug or not but thought i would ask.
Thanks Again,
Boots