This is a migrated thread and some comments may be shown as answers.

Column Filter not showing up

2 Answers 209 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Boots
Top achievements
Rank 1
Boots asked on 23 Oct 2009, 04:53 PM
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.
<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 { getset; }  
        public String Quarter { getset; }  
        public String Make { getset; }  
        public double Sales { getset; }  
    } 

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

2 Answers, 1 is accepted

Sort by
0
Boots
Top achievements
Rank 1
answered on 23 Oct 2009, 05:02 PM

Hello Again,

I also noticed if I create the columns in xaml the filters dont show up unless I add the DataType to the column. I ran into somthing else with the grid. The aggregates arent showing up on the Column Footers.

<Window x:Class="WpfApplication1.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:WpfApplication1" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Title="Group Chart Test">  
    <Grid> 
        <Grid.RowDefinitions> 
            <RowDefinition /> 
            <RowDefinition Height="30" /> 
        </Grid.RowDefinitions> 
        <telerik:RadGridView Name="rgv"   
                             AutoGenerateColumns="False" 
                             ShowColumnFooters="True"   
                             Grid.Row="0">  
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn Header="Year" UniqueName="Year">  
                    <telerik:GridViewColumn.AggregateFunctions> 
                        <telerik:CountFunction Caption="Count:" /> 
                    </telerik:GridViewColumn.AggregateFunctions> 
                </telerik:GridViewDataColumn> 
                <telerik:GridViewDataColumn Header="Quarter" UniqueName="Quarter" /> 
                <telerik:GridViewDataColumn Header="Make" UniqueName="Make" /> 
                <telerik:GridViewDataColumn Header="Sales" UniqueName="Sales">  
                    <telerik:GridViewColumn.AggregateFunctions> 
                        <telerik:SumFunction Caption="Sum" SourceField="Sales" /> 
                    </telerik:GridViewColumn.AggregateFunctions> 
                </telerik:GridViewDataColumn> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
 
        <Button Click="Button_Click_1"      
                Grid.Row="1"     
                Content="Add Items"/>  
    </Grid> 
</Window> 

Thanks again,
Boots
0
Accepted
Stefan Dobrev
Telerik team
answered on 29 Oct 2009, 08:33 AM
Hello Boots,

I was able to reproduce this issue. It is a bug in our code base that we will address in our next release. Thanks for reporting it. I have updated your Telerik points.

All the best,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Boots
Top achievements
Rank 1
Answers by
Boots
Top achievements
Rank 1
Stefan Dobrev
Telerik team
Share this question
or