Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.
usingSystem.Windows;
usingDevExpress.XtraReports.Expressions;
usingDevExpress.XtraReports.UI;
namespaceHidePropertiesExample {
publicpartialclassApp : Application {
protectedoverridevoidOnStartup(StartupEventArgs e) {
// For XRLabel controls, hide the Background Color and Tag properties from the Expressions tab.
ExpressionBindingDescriptor.HidePropertyDescriptions(typeof(XRLabel), "BackColor", "Tag");
base.OnStartup(e);
}
}
}
usingSystem;
usingSystem.ComponentModel;
usingSystem.Windows;
usingDevExpress.XtraReports.UI;
usingDevExpress.XtraReports.UserDesigner;
namespaceHidePropertiesExample {
publicpartialclassMainWindow : Window {
publicMainWindow() {
InitializeComponent();
var report = new XtraReport();
// Handle the static FilterComponentProperties event to filter the Properties panel.
XtraReport.FilterComponentProperties += XtraReport_FilterComponentProperties;
reportDesigner.OpenDocument(report);
}
staticvoidXtraReport_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 XRLabel controls.if(e.Component is XRLabel) {
HideProperty("Name", e);
}
}
staticvoidHideProperty(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);
}
}
}
}
ImportsSystemImportsSystem.ComponentModelImportsSystem.WindowsImportsDevExpress.XtraReports.UIImportsDevExpress.XtraReports.UserDesignerNamespace HidePropertiesExample
PartialPublicClass MainWindow
Inherits Window
PublicSubNew()
InitializeComponent()
Dim report = New XtraReport()
' Handle the static FilterComponentProperties event to filter the Properties panel.AddHandler XtraReport.FilterComponentProperties, AddressOf XtraReport_FilterComponentProperties
reportDesigner.OpenDocument(report)
EndSubPrivateSharedSub XtraReport_FilterComponentProperties(ByVal sender AsObject, ByVal e As FilterComponentPropertiesEventArgs)
' Hide the Scripts property for all report elements.
HideProperty("Scripts", e)
' Hide the ReportSource and ReportSourceUrl properties for subreports. IfTypeOf e.Component Is XRSubreport Then
HideProperty("ReportSource", e)
HideProperty("ReportSourceUrl", e)
EndIf' Hide the Name property for XRLabel controls.IfTypeOf e.Component Is XRLabel Then
HideProperty("Name", e)
EndIfEndSubPrivateSharedSub HideProperty(ByVal propertyName AsString, ByVal filterComponentProperties As FilterComponentPropertiesEventArgs)
Dim oldPropertyDescriptor As PropertyDescriptor = TryCast(filterComponentProperties.Properties(propertyName), PropertyDescriptor)
If oldPropertyDescriptor IsNotNothingThen' 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)
EndIfEndSubEndClassEndNamespace
ImportsSystem.WindowsImportsDevExpress.XtraReports.ExpressionsImportsDevExpress.XtraReports.UINamespace HidePropertiesExample
PartialPublicClass App
Inherits Application
ProtectedOverridesSub OnStartup(ByVal e As StartupEventArgs)
' For XRLabel controls, hide the Background Color and Tag properties from the Expressions tab.
ExpressionBindingDescriptor.HidePropertyDescriptions(GetType(XRLabel), "BackColor", "Tag")
MyBase.OnStartup(e)
EndSubEndClassEndNamespace
Was this page helpful?
Thanks for your feedback!
How can we improve this help topic?
Additional comments/thoughts:
If you have any questions, submit a ticket to our Support Center.