ReportDesigner.RegisterControl<T>(Func<XRDiagramItem>, ImageSource, Func<XRDiagramControl, Size>) Method
Registers a custom control in the Report Designer and adds it to the Toolbox.
Namespace: DevExpress.Xpf.Reports.UserDesigner
Assembly: DevExpress.Xpf.ReportDesigner.v19.1.dll
Declaration
public static void RegisterControl<T>(
Func<XRDiagramItem> createItem,
ImageSource icon,
Func<XRDiagramControl, Size> getDefaultSizeFunc = null
)
where T : XRControl, new()
Parameters
Name | Type | Description |
---|---|---|
createItem | Func<DevExpress.Xpf.Reports.UserDesigner.XRDiagram.XRDiagramItem> | A function that returns a diagram item corresponding to the custom control. |
icon | ImageSource | An object that specifies an icon for the custom control. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
getDefaultSizeFunc | Func<DevExpress.Xpf.Reports.UserDesigner.XRDiagram.XRDiagramControl, Size> | *null* | A function that returns the default item size. |
Type Parameters
Name |
---|
T |
Remarks
The following example demonstrates how to add a Progress Bar custom control to the Report Designer‘s toolbox using the RegisterControl<T> method. To learn more, see Adding a Custom Control to the Report Designer Toolbox.
Tip
A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T416384.
using DevExpress.Utils;
using DevExpress.Xpf.Reports.UserDesigner;
using DevExpress.Xpf.Reports.UserDesigner.XRDiagram;
using System.Windows.Media.Imaging;
//...
var icon = BitmapFrame.Create(AssemblyHelper.GetResourceUri(GetType().Assembly, "progress.png"));
ReportDesigner.RegisterControl<XRProgressBar>(() => new DefaultXRControlDiagramItem(), icon);
For information on creating custom controls, see the Creating Custom Controls, Creating a Custom Progress Bar Control and Creating a Custom Numeric Label documents.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the RegisterControl<T>(Func<XRDiagramItem>, ImageSource, Func<XRDiagramControl, Size>) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.