xtrareports-116767-desktop-reporting-wpf-reporting-end-user-report-designer-for-wpf-api-and-customization-add-a-custom-control-to-the-report-designer-toolbox.md
This document describes how to create a WPF project with a custom control and add the control to the WPF End-User Report Designer Toolbox.
View Example: Add a Custom Control to the End-User Report Designer Toolbox (WPF)
Use the RegisterControl<T>() method to add the custom control to the Toolbox :
using DevExpress.Xpf.Reports.UserDesigner;
//..
private void reportDesigner_Loaded(object sender, RoutedEventArgs e) {
ReportDesigner.RegisterControl<NumericLabel>();
reportDesigner.OpenDocument(new XtraReport1());
}
Imports DevExpress.Xpf.Reports.UserDesigner
'..
Private Sub reportDesigner_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
ReportDesigner.RegisterControl(Of NumericLabel)()
reportDesigner.OpenDocument(New XtraReport1())
End Sub
The added control inherits an icon from the XRLabel control.
Add an .svg icon named NumericLabel.svg to the project and set the icon’s Build Action property to Embedded Resource.
Apply the ToolboxSvgImage attribute for the created custom control:
using DevExpress.Utils.Design;
//..
[ToolboxSvgImage("WpfApp_CustomNumericLabel.NumericLabel.svg, WpfApp_CustomNumericLabel")]
public class NumericLabel : XRLabel { ... }
Imports DevExpress.Utils.Design
'..
<ToolboxSvgImage("WpfApp_CustomNumericLabel.NumericLabel.svg, WpfApp_CustomNumericLabel")>
Public Class NumericLabel
Inherits XRLabel
Private ...}
Rebuild and run the project. The control with the specified icon appears in the toolbox.
Note
We recommend you use .svg icons for custom controls. If you need to specify non-svg icons, use the RegisterControl<T>(ImageSource) method.
See Also