Results 1 to 3 of 3

Thread: How to set the Custom Filters for PropertyGrid

  1. #1
    Join Date
    Feb 2009

    Exclamation How to set the Custom Filters for PropertyGrid


    I have .Net project in that I had to make customization in the Property Grid window so is it possible to apply Custom Filters for propertyGrid and if this is possible then please let me know to achieve this.

    Thanks in Advace

  2. #2
    Join Date
    Jan 2006

    Re: How to set the Custom Filters for PropertyGrid

    I'm trying to set a custom filter for propertygird's FileNameEditor.

    [DisplayName("File Path")]
    [Category("Video Settings")]
    [Description("The path to the file to be played.")]
    public string FilePath
      get { return _FilePath; }
      set { _FilePath = value; }
    //FileNameEditor override
    internal class MovieFileNameEditor :
        protected override void InitializeDialog(OpenFileDialog openFileDialog)
            openFileDialog.Filter = "Movie Files (*.avi, *.mpeg,
            openFileDialog.Title = "Select Movie File";

  3. #3
    Join Date
    Dec 2008

    Re: How to set the Custom Filters for PropertyGrid

    Suppose your SelectedObject is a TextBox, and you want to display in a PropertyGrid only the "Size" property of your TextBox. As the PropertyGrid control is, it is not possible.

    you may continue passing to the PropertyGrid.BrowsableAttributes property a collection of attributes like "PropertyNameAttribute". But unfortunately, such attributes don't exist.

    I propose another approach: using a wrapper object that contains the object you want to display in the PropertyGrid. This wrapper will be passed to the PropertyGrid, instead of the object itself. So, the PropertyGrid will not directly display the object's properties, but the wrapper's ones. In this case, you need to subclass the PropertyGrid with a new control that overrides the SelectedObject property. That's exactly what I did, while writing the FilteredPropertyGrid control. This control is inherited from PropertyGrid and works the same way. I just added these useful properties:

    • BrowsableAttributes: overridden from PropertyGrid.
    • HiddenAttributes: all the properties that have the attributes contained in the collection are hidden.
    • BrowsableProperties: all the properties contained in the collection are displayed.
    • HiddenProperties: all the properties contained in the collection are not displayed.

Similar Threads

  1. Replies: 8
    Last Post: 06-05-2012, 12:21 PM
  2. Hotmail Filters Disappeared
    By Apalachee in forum Technology & Internet
    Replies: 6
    Last Post: 04-06-2010, 12:39 AM
  3. Using filters in DVD Rebuilder
    By Bower in forum Windows Software
    Replies: 5
    Last Post: 03-05-2010, 09:47 AM
  4. What Filters are Available in PHP?
    By N I C K in forum Software Development
    Replies: 4
    Last Post: 28-02-2010, 05:12 AM
  5. Cable filters and if anyone has used one before?
    By NetTalk in forum Off Topic Chat
    Replies: 4
    Last Post: 13-10-2009, 05:18 PM

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Page generated in 1,686,007,980.80273 seconds with 17 queries