GridView Filtering - Distinct values not displayed

4 posts, 0 answers
  1. Robert
    Robert avatar
    8 posts
    Member since:
    Oct 2012

    Posted 06 Apr 2016 Link to this post

    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.

  2. Yoan
    Admin
    Yoan avatar
    1128 posts

    Posted 08 Apr 2016 Link to this post

    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.
  3. Robert
    Robert avatar
    8 posts
    Member since:
    Oct 2012

    Posted 13 Apr 2016 in reply to Yoan Link to this post

    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

  4. Yoan
    Admin
    Yoan avatar
    1128 posts

    Posted 13 Apr 2016 Link to this post

    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.
Back to Top