How to customize Members shown in PART_SimpleFilterMemberComboBox

4 posts, 0 answers
  1. Maurizio
    Maurizio avatar
    43 posts
    Member since:
    Jan 2012

    Posted 14 Aug 2014 Link to this post


    We are using a RadDataFilter to let the user create simple filter expressions. How can we modify the Members shown in the combobbox PART_SimpleFilterMemberComboBox?

    Assume we filter on a list of employees where the employee class has three properties ID, Name and Age and we only want Name and Age to appear in the
    PART_SimpleFilterMemberComboBox?
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 15 Aug 2014 Link to this post

    Hi,

    You can achieve your goal, configuring the property you would like to not show with Browsable(false) attribute.
    For example:
    public class YourObject: INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
     
        private string id;
     
        [Browsable(false)]
        public string ID
        {
            get { return this.id; }
            set
            {
                if (value != this.id)
                {
                    this.id= value;
                    this.OnPropertyChanged("ID");
                }
            }
        }
      ...
      }

    Let me know how this works for you.

    Regards,
    Didie
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Maurizio
    Maurizio avatar
    43 posts
    Member since:
    Jan 2012

    Posted 18 Aug 2014 in reply to Dimitrina Link to this post

    Thank you Didie! [Browsable(false)] works fine for simple cases.

    Meanwhile I have found myself a way to do more complex filtering: In the Initializied event of PART_SimpleFilterMemberComboBox I grab SimpleFilterViewModel.AvailableMembers which contains all browsable properties of the class I want to filter on.

    Then I warp AvailableMembers into a CollectionView and set a Filter and SortDescriptions on this CollectionView.

    The PART_SimpleFilterMemberComboBox.ItemsSource binds to this CollectionView.

    So I can do any filtering I want and get a nicely ordered Combobox for the user to select the member he wants to filter on :)
      
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 19 Aug 2014 Link to this post

    Hello,

    Indeed, this approach seems to be working fine. Thank you for sharing your solution.

    Regards,
    Didie
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top