I find the ability to create user functions so that the users of the designer can insert domain related content. However, there are some places where I would like to help them insert objects other than text.
Is it possible to provide a function that would return, say, a shape or other visual element?
3 Answers, 1 is accepted
The idea of user functions is to provide a value or modify a property for already existing item during the processing stage. Any new report item must be created before the report is processed - we usually advise to do that right after InitializeComponent() method in report constructor.
If you need to create a new shape item, this can be achieved the following way:
The shape item can be instantiated and added to the report like this:
The code above will produce a report that has the desired shape in its details section. Currently there is no way to add a design-time support for custom ShapeType implementations, but using code, as demonstrated above, allows to add virtually any kind of shape to a report.
I guess that makes sense. Since user functions provide values to generally textual property values, they only really need return string values.
Is there listed anywhere all of the places that user functions can be used? I guess that would be, all of the properties that can have an Expression value?
The user functions can be used to provide not only textual information, but also binary contents (Image for PictureBox), location coordinates in order to change position of an item, or a Color - when needed to set the color of some item through Bindings.
Basically expressions can be used on every property that shows the Edit Expression dialog when edited. Even more, some properties can be adjusted via Bindings even if they do not provide a way to set an expression directly. However, some properties like Shape's ShapeType cannot be set this way.
Hope that helps.