SnapHyperlink Interface

Provides functionality to insert hyperlinks in Snap documents.

Namespace: DevExpress.Snap.Core.API

Assembly: DevExpress.Snap.v20.1.Core.dll

Declaration

Related API Members

The following members accept/return SnapHyperlink objects:

Remarks

A hyperlink's destination may be a web page, file, or specific position within a document.

snap-hyperlink-mouse-tooltip

Click the Hyperlink icon-small-toolbar-insert-hyperlink button in the General Tools: Insert toolbar tab to create a hyperlink in the User Interface.

The invoked Insert Hyperlink dialog allows you to create a hyperlink and specify its text, screen tip and destination.

snap-dialog-insert-hyperlink

To display a field's data as hyperlinks, Select the field and click the Properties button in the Data Tools: Field toolbar tab. Expand the Content Type drop-down menu and select Hyperlink.

snap-hyperlink-properties-toolbar

You can also set the SnapHyperlink.ScreenTip and SnapHyperlink.Target properties of a hyperlink.

Use the ISnapFieldOwner.CreateSnHyperlink method to create a SNHYPERLINK field in code, as shown below:

snapControl1.Document.BeginUpdate();
SnapHyperlink hyperlink = snapControl1.Document.CreateSnHyperlink(snapControl1.Document.Range.Start, "Fish.Fish_ScientificClassification.Reference");
snapControl1.Document.ParseField(hyperlink.Field);
hyperlink.BeginUpdate();
hyperlink.DisplayField = "Fish.CommonName";
hyperlink.ScreenTip = "Wikipedia Page";
hyperlink.EndUpdate();
snapControl1.Document.EndUpdate();
hyperlink.Field.Update();

Field Result in Case of Empty Data Entry

The SNHYPERLINK field can be bound to a data field name (the SnapSingleListItemEntity.DataFieldName property) and to a display name (the SnapHyperlink.DisplayField property).

You can use SnapSingleListItemEntity.EnableEmptyFieldDataAlias property to use an alternative field result (the SnapSingleListItemEntity.EmptyFieldDataAlias value) if the data source entry bound as the DataFieldName value is empty.

The table below shows SNHYPERLINK field result in different empty data source scenarios:

DataFieldName Data Source

DisplayField Data Source

Field Result

Empty data source (no data source entries or objects in the list)

<<DataFieldName>>

The data source does not contain the required entry

Specified

The SnapSingleListItemEntity.EmptyFieldDataAlias value if specified; otherwise, the DisplayField value.

Not Specified

<<DataFieldName>>

Set to an invalid data entry

<<DataFieldName>>

The required data entry returns an empty string.

Specified

The SnapSingleListItemEntity.EmptyFieldDataAlias value, if specified; otherwise, the DisplayField value.

Not Specified

<<DisplayField>>

Set to an invalid data entry

<<DataFieldName>>

The data source contains the required entry.

The required data entry is null, DBNull.Value or string.Empty

<<DataFieldName>>

Not Specified

The data source does not contain the required entry.

<<DisplayField>>
(the SnapSingleListItemEntity.EnableEmptyFieldDataAlias value is ignored).

See Also