Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
XamPropertyGrid: Hide properties at runtime


I would like to hide/show properties in the xamPropertyGrid in code. I would like to show/hide properties by an visibility layer.


  • An Expert can see all properties
  • An Normal user can see less properites
  • And a Dummy user can see just the basic properties

Is there a way to archive that?

No Data
  • 1560
    Offline posted
    Hello Bin,


    Thank you for posting to Infragistics community.


    I have been looking into your question and created a small sample that demonstrates how to show/hide certain property categories in the XamPropertyGrid, based on some user type.


    To achieve this, my suggestion is to apply the Properties List Filtering feature of the XamPropertyGrid. You could read more about it in this page of our documentation. Item filters and comparison conditions can be created and assigned in XAML as well as in code-behind.


    Thus, as shown in the sample, when clicking on a button, that randomly switches the current User object’s UserType, different comparison conditions are defined based on the user type. By assigning comparison conditions or comparison condition groups to the XamPropertyGrid’s ItemsFilter, the grid’s properties are being filtered. 
    switch (userType)
                    case UserTypeEnum.Dummy:
                        PropertyGridComparisonCondition comparisonCondition1 = new PropertyGridComparisonCondition();
                        comparisonCondition1.OperandSource = PropertyGridFilterOperandSource.CategoryName;
                        comparisonCondition1.Operator = ComparisonOperator.Equals;
                        comparisonCondition1.Value = "Occupation";
                        PropertyGridComparisonCondition comparisonCondition2 = new PropertyGridComparisonCondition();
                        comparisonCondition2.OperandSource = PropertyGridFilterOperandSource.CategoryName;
                        comparisonCondition2.Operator = ComparisonOperator.Equals;
                        comparisonCondition2.Value = "Location";
                        this.xamPropertyGrid1.ItemFilters = filterConditions;

    For the purposes of the example, the properties are filtered by categories, that is by setting the OperandSource property of the comparison condition to CategoryName. Alternatively, the properties can be filtered by name, description or display name, by setting the OperandSource to the corresponding value.


    So, in the sample you can observe how the “Dummy” user can see properties only of the “Occupation” and “Location” categories of the Person class. The “Normal” sees the “Identification” category as well and the “Expert” has no constraints, meaning that the property grid’s filter conditions are cleared.


    You can find the sample attached below. Please, test it on your side and if you require any further assistance on the matter, please let me know.


    Bozhidara Pachilova
    Associate Software Developer
No Data