Skip to main content
A newer version of this page is available. .

FilterControlPropertiesEventArgs.Properties Property

Provides access to a control’s properties, which can be hidden from the Property Grid in this XtraReport.FilterControlProperties event’s handler.

Namespace: DevExpress.XtraReports.UserDesigner

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

public IDictionary Properties { get; }

Property Value

Type Description
IDictionary

An object implementing the IDictionary interface.

Remarks

Use the FilterControlPropertiesEventArgs.Control property to determine a control or a band, for which it is necessary to hide some properties from end-users in the End-User Designer, and the Properties property to manage the list of visible properties.

Example

This sample illustrates how to hide properties of a report and its controls from the End-User Report Designer‘s Properties panel.

Handle the static XtraReport.FilterComponentProperties event to remove items from the Properties tab.

Use the ExpressionBindingDescriptor.HidePropertyDescriptions method to remove properties from the Expressions tab available when the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Expressions or DataBindingMode.ExpressionsAdvanced.

using System;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UserDesigner;
using System.ComponentModel;
using DevExpress.XtraReports.Expressions;
// ...
static class Program {
    [STAThread]
    static void Main() {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        // Handle the static FilterComponentProperties event to filter the Property Grid. 
        XtraReport.FilterComponentProperties += XtraReport_FilterComponentProperties;

        // For the XRLabel control, hide the Background Color and Tag properties from the Expressions tab.
        ExpressionBindingDescriptor.HidePropertyDescriptions(typeof(XRLabel), "BackColor", "Tag");
        Application.Run(new Form1());
    }

    static void XtraReport_FilterComponentProperties(object sender, 
        FilterComponentPropertiesEventArgs e) {
        // Hide the Scripts property for all report elements.
        HideProperty("Scripts", e);

        // Hide the ReportSource and ReportSourceUrl properties for subreports.
        if (e.Component is XRSubreport) {
            HideProperty("ReportSource", e);     
            HideProperty("ReportSourceUrl", e);    
        }  

        // Hide the Name property for a specific label control.
        if (sender is XtraReport1 && e.Component is XRControl && 
            ((XRControl)e.Component).Name == "label1") {
            HideProperty("Name", e);
        }

    }

    static void HideProperty(String propertyName, 
        FilterComponentPropertiesEventArgs filterComponentProperties) {
        PropertyDescriptor oldPropertyDescriptor = 
            filterComponentProperties.Properties[propertyName] as PropertyDescriptor;
        if (oldPropertyDescriptor != null) {
            // Substitute the current property descriptor 
            // with a custom one with the BrowsableAttribute.No attribute.
            filterComponentProperties.Properties[propertyName] = TypeDescriptor.CreateProperty(
                oldPropertyDescriptor.ComponentType,
                oldPropertyDescriptor,
                new Attribute[] { BrowsableAttribute.No });
        }
        else {
            // If the property descriptor cannot be substituted, 
            // remove it from the Properties collection.
            filterComponentProperties.Properties.Remove(propertyName);
        }
    }
}
See Also