[]
Occurs after the report layout has been modified. This event signifies a permanent change in the layout.
public event LayoutChangedEventHandler LayoutChanged
Type | Description |
---|---|
LayoutChangedEventHandler | Occurs after the report layout has been modified. This event signifies a permanent change in the layout. |
This event is triggered once changes to the report's layout are finalized, such as after moving, adding, or deleting report elements. It serves as a notification that the layout has been altered in a way that cannot be undone without further actions by the user or programmatic interventions.
Event handlers can use this opportunity to perform tasks that need to occur after a layout change, such as updating UI elements, saving the report, or refreshing previews.
This example shows how to perform specific actions immediately after the report layout has changed.
designer.LayoutChanged += (sender, args) => {
// Example action: Log a message indicating the layout change.
Console.WriteLine("The report layout has been changed.");
// Additional actions can be performed here.
};
Use this event to handle report layout changes. The following example prevents the addition of new controls until the report has a data set:
designer.LayoutChanging += (sender, args) => {
if (args.Type == LayoutChangeType.ControlAdd
&& designer.Report is PageReport pageReport
&& pageReport.Report.DataSets.Count == 0)
{
// Use the designer's service provider to get the IUIService and show an error message.
((IUIService) designer).ShowError("Add data set first.");
args.AllowChange = false; // Prevent the change.
}
};