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

GridView Filtering - Distinct values not displayed

3 Answers 292 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 06 Apr 2016, 06:25 AM

Dear Support,

I try to use filtering but in distinct value area the values are not appear.
Any idea why?

Here is my xaml code:

<telerikGridView:RadGridView Grid.Row="1" Margin="5" x:Name="SearchGrid" AutoGenerateColumns="False"
             ItemsSource="{Binding Path=ValuesOfQuestions, Mode=OneWay}"
             DistinctValuesLoading="SearchGrid_DistinctValuesLoading"
             IsReadOnly="True" IsFilteringAllowed="True" ShowGroupPanel="False"
             ShowColumnFooters="False" ShowColumnSortIndexes="True">
 <telerikGridView:RadGridView.Columns>
     <telerikGridView:GridViewDataColumn x:Name="ID" Header="ID" ShowDistinctFilters="True" DataMemberBinding="{Binding Path=ID}" />
     <telerikGridView:GridViewDataColumn x:Name="Date" Header="Date" DataMemberBinding="{Binding Path=Date}" />
     <telerikGridView:GridViewDataColumn x:Name="Value" Header="Value" DataMemberBinding="{Binding Path=Value}" />
 </telerikGridView:RadGridView.Columns>
 </telerikGridView:RadGridView>

XAML code behind:

private void SearchGrid_DistinctValuesLoading(object sender, GridViewDistinctValuesLoadingEventArgs e)
        {
            e.ItemsSource = ((Telerik.Windows.Controls.RadGridView)sender).GetDistinctValues(e.Column, false);
        }

C# code:

public class ValuesOfQuestion
    {
        public int ID { get; set; }
        public string Value { get; set; }
        public DateTime Date { get; set; }
    }
 
     ValuesOfQuestions = new ObservableCollection<ValuesOfQuestion>();
for (int i = 0; i < 10; i++)
     {
      ValuesOfQuestions.Add(new ValuesOfQuestion { ID = i, Date = DateTime.Now, Value = "Value " + i.ToString() });
     }

And I attached a picture for my problem.

Thanks,

Robert.

3 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 08 Apr 2016, 12:56 PM
Hi Robert,

I have tried to reproduce the problem you report but I was not able to. I have attached a sample project which was created based on your code snippets. Please review it and let me know if I am missing something.

Regards,
Yoan
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Robert
Top achievements
Rank 1
answered on 13 Apr 2016, 08:13 AM

Hello Yoan,

Thank you for your response.
I have tried in a new wpf project, and it is working, but I dont understand why not working in our "big" project.

Regards,
Robert

0
Yoan
Telerik team
answered on 13 Apr 2016, 08:27 AM
Hello Robert,

Unfortunately, I can not guess what is the cause of the problem. I would suggest you to isolate the problem in the sample project which I can debug on my side. You can check this blog post which demonstrates how to isolate a problem in a sample project.

Regards,
Yoan
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Robert
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Robert
Top achievements
Rank 1
Share this question
or