Back to Devexpress

XRControl.Visible Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-2e1a5f5e.md

latest4.6 KB
Original Source

XRControl.Visible Property

Gets or sets a value that specifies whether the report control is displayed in the document.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[DefaultValue(true)]
[SRCategory(ReportStringId.CatBehavior)]
[XRLocalizable(true)]
public virtual bool Visible { get; set; }
vb
<SRCategory(ReportStringId.CatBehavior)>
<DefaultValue(True)>
<XRLocalizable(True)>
Public Overridable Property Visible As Boolean

Property Value

TypeDefaultDescription
Booleantrue

true if the control is shown; otherwise, false.

|

Remarks

If the Visible property is set to false, a blank space of the control’s size appears in the document, regardless of the value of the CanShrink property. An exception to this rule is the XRSubreport control, because it is hidden in the document if its CanShrink property is set to true.

To maintain the position and visibility of report elements in a document, it is recommended that you create reports programmatically. Review the following help topic for more information: Create a Report in Code.

If you set a control’s Visible property to false, the control is displayed in Report Designer with a striped background.

To hide a control without leaving blank space in the report, set the properties as follows:

CanShrinkTrueText

Empty string (‘’). To hide a control based on a condition, specify the following expression as the Text expression binding that conditionally sets its value to an empty string:

Iif(YOUR_CONDITION, '', TEXT OR [YOUR_DATA_FIELD])

Visible``True (default value)

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Visible property.

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.

reporting-winforms-best-fit-table-column-width/CS/ReportHelper/ReportHelper.cs#L69

csharp
var result = new List<KeyValuePair<XRTable, List<XRTable>>>();
IEnumerable<XRTable> allTables = xtraReport.AllControls<XRTable>().Where(t => t.Visible);
foreach(var table in allTables) {

reporting-winforms-best-fit-table-column-width/VB/ReportHelper/ReportHelper.vb#L82

vb
Dim result = New List(Of KeyValuePair(Of XRTable, List(Of XRTable)))()
Dim allTables As IEnumerable(Of XRTable) = xtraReport.AllControls(Of XRTable)().Where(Function(t) t.Visible)
For Each table In allTables

See Also

Conditionally Hide Controls

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace