SnapHyperlink Interface
Provides functionality to insert hyperlinks in Snap documents.
Namespace: DevExpress.Snap.Core.API
Assembly: DevExpress.Snap.v21.2.Core.dll
NuGet Package: DevExpress.Snap.Core
#Declaration
public interface SnapHyperlink :
SnapSingleListItemEntitySupportsParameters,
SnapSingleListItemEntity,
SnapEntity,
IDisposable
#Related API Members
The following members return SnapHyperlink objects:
#Remarks
A hyperlink’s destination may be a web page, file, or specific position within a document.
#Hyperlinks in the User Interface
Click the 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.
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.
You can also set the SnapHyperlink.ScreenTip and SnapHyperlink.Target properties of a hyperlink.
#Hyperlinks in Code
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:
Data | Display | Field Result |
---|---|---|
Empty data source (no data source entries or objects in the list) | <<Data | |
The data source does not contain the required entry | Specified | The Snap |
Not Specified | <<Data | |
Set to an invalid data entry | <<Data | |
The required data entry returns an empty string. | Specified | The Snap |
Not Specified | <<Display | |
Set to an invalid data entry | <<Data | |
The data source contains the required entry. | The required data entry is null, DBNull. | <<Data |
Not Specified | The data source does not contain the required entry. | <<Display |