xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-e6f24b4d.md
Specifies the horizontal anchoring type of a report control.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[SRCategory(ReportStringId.CatBehavior)]
public virtual HorizontalAnchorStyles AnchorHorizontal { get; set; }
<SRCategory(ReportStringId.CatBehavior)>
Public Overridable Property AnchorHorizontal As HorizontalAnchorStyles
| Type | Description |
|---|---|
| HorizontalAnchorStyles |
The type of horizontal anchoring.
|
Available values:
| Name | Description |
|---|---|
| None |
Identical to the Left member.
| | Left |
Anchors a control to the left edge of its container.
| | Right |
Anchors a control to the right edge of its container.
| | Both |
Anchores a control to the left and right edges of its container.
|
This property defines how to resize a report control to maintain the distance to the left and right edges of its container. You can set the value of this property to one of the HorizontalAnchorStyles enumeration values. The following examples demonstrate how different property values affect anchoring:
Initial layout. The band contains the XRPanel control with the XRLabel control inside it. Different values of the AnchorHorizontal property are set for the XRLabel control. See how these values affect the anchoring of this control when the width of the panel is changed.
The control property value is Left (works the same as None ). The right edge of the panel is moved to the right. The XRLabel control position is unchanged to preserve the distance to the left edge of the panel.
The control property value is Right. The right edge of the panel is moved to the right. The XRLabel control position is changed to preserve the distance to the right edge of the panel.
The control property value is Both. The right edge of the panel is moved to the right. The XRLabel control width is increased to preserve the distance to both edges of its container.
Review the following blog post: Reporting - Responsive Report Layouts with Control Anchoring.
View Example: How to Dynamically Size an Image to Fit the Entire Page Client Area
Watch Video: Responsive Report Layouts with Control Anchoring in Print Preview
The property is hidden in the following descendants of the XRControl class:
Note
The AnchorHorizontal property does not work with controls inside a subreport unless the GenerateOwnPages option is enabled for the subreport.
See Also