davecove
davecove

Reputation: 1071

Remove filtering from a WPF RadGridView column

I am using a telerik WPF RadGridView. When I load a List<Recording> into the grid's ItemSource, the grid appears with the columns and rows I expect. No problem.

Now I would like to remove the ability to filter on 2 of the 3 auto generated columns. (Timestamp and Duration)

How would I do that?

public class Recording
{
    public string Last { get; set; }
    [Display(Name="Session Time")]
    public DateTime Timestamp { get; set; }
    public TimeSpan Duration { get; set; }
}

Upvotes: 0

Views: 873

Answers (1)

SWalters
SWalters

Reputation: 3704

You'll need to generate the columns "manually" (set AutoGenerateColumns="False" in the grid definition), and ensure that IsFilterable is set to False on each column for which you would like to disallow filtering. Something like this:

<telerik:RadGridView.Columns>
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Last}" Header="Last"  />
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Timestamp}" Header="Timestamp" IsFilterable="False"  />
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Duration}" Header="Duration" IsFilterable="False"  />
</telerik:RadGridView.Columns>

Upvotes: 1

Related Questions