Version

DesktopAlertLinkClicked Event

Syntax
'Declaration
 
Public Event DesktopAlertLinkClicked As DesktopAlertLinkClickedHandler
public event DesktopAlertLinkClickedHandler DesktopAlertLinkClicked
Event Data

The event handler receives an argument of type DesktopAlertLinkClickedEventArgs containing data related to this event. The following DesktopAlertLinkClickedEventArgs properties provide information specific to this event.

PropertyDescription
CloseWindow Gets/sets whether the desktop alert window should be closed when execution returns from this event.
LinkClickedArgs Returns the Infragistics.Win.FormattedLinkLabel.LinkClickedEventArgs instance which contains information about the link that was clicked.
LinkType Returns the type of link that was clicked, i.e., the UltraDesktopAlertWindowInfo.Caption, UltraDesktopAlertWindowInfo.Text, or UltraDesktopAlertWindowInfo.FooterText link.
WindowInfo (Inherited from Infragistics.Win.Misc.DesktopAlertEventArgsBase)Returns a reference to the UltraDesktopAlertWindowInfo instance for which the event was fired.
Remarks

Note: The DesktopAlertLinkClicked event will not fire when the UltraDesktopAlertShowWindowInfo.Caption, UltraDesktopAlertShowWindowInfo.Text, or UltraDesktopAlertShowWindowInfo.FooterText is clicked if the property is set to a value that cannot be parsed into a link. A link can be formed by enclosing the text to be displayed in an anchor tag (for example, <a>Link</a>)

The TreatCaptionAsLink, TreatTextAsLink, and TreatFooterTextAsLink properties can be used to cause the DesktopAlertLinkClicked event to be generated (when the associated formatted text element is clicked) without having to specifically use anchor tags when assigning the values of the UltraDesktopAlertShowWindowInfo.Caption, UltraDesktopAlertShowWindowInfo.Text, or UltraDesktopAlertShowWindowInfo.FooterText properties.

The Caption, Text, and FooterText properties of the UltraDesktopAlertShowWindowInfo class accept formatted text as recognized by the Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor; for information on supported formatting tags, consult the Formatted Text and Hyperlinks topic. Note that the hyperlinks and formatted text displayed in the desktop alert windows do not support editing.

Example
The following code sample demonstrates how the DesktopAlertLinkClicked event can be used to perform an action when a link is clicked, and how to control whether the desktop alert window is closed:

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win
Imports Infragistics.Win.Misc

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
			'	Handle the DesktopAlertLinkClicked event
        AddHandler Me.desktopAlert.DesktopAlertLinkClicked, AddressOf Me.OnDesktopAlertLinkClicked

        '  Create a new instance of the UltraDesktopAlertShowWindowInfo class.
        Dim showInfo As UltraDesktopAlertShowWindowInfo = New UltraDesktopAlertShowWindowInfo()

        '  Set the Caption, Text, and FooterText properties using formatting
        '  characters that are recognized by the FormattedTextUIElement.
        showInfo.Caption = "<span style=""font-weight:bold_x003B_"">Caption</span> is bolded<br/>"
        showInfo.Text = "<span style=""text-decoration:underline_x003B_"">Line one of the Text is underlined</span><br/><span style=""font-style:italic_x003B_"">Line two is italicized</span><br/>"
        showInfo.FooterText = "<a href=""www.infragistics.com"">Click to visit the Infragistics website</a>"

        '   Show the window
        Me.desktopAlert.Show(showInfo)
    End Sub

    Private Sub OnDesktopAlertLinkClicked(ByVal sender As Object, ByVal e As DesktopAlertLinkClickedEventArgs)
        Select Case e.LinkType

            '  If the caption or text link was clicked, close the desktop
            '  alert window, and do not attempt to open the link.
            Case DesktopAlertLinkType.Caption
            Case DesktopAlertLinkType.Text

                Me.OnLinkClicked(e.LinkType)
                e.LinkClickedArgs.OpenLink = False
                e.CloseWindow = True


                '  If the footer text link was clicked, open the link,
                '  and do not close the desktop alert window. Also, pin
                '  the desktop alert window so it does not auto-close while
                '  we are performing the link's action.
            Case DesktopAlertLinkType.Footer
                e.LinkClickedArgs.OpenLink = True
                e.CloseWindow = False
                e.WindowInfo.Pinned = True
        End Select

    End Sub
using Infragistics.Win;
using Infragistics.Win.Misc;
using System.Diagnostics;

    private void Button1_Click(object sender, EventArgs e)
    {
			//		Handle the DesktopAlertLinkClicked event
        this.desktopAlert.DesktopAlertLinkClicked += new DesktopAlertLinkClickedHandler( this.OnDesktopAlertLinkClicked );

        //  Create a new instance of the UltraDesktopAlertShowWindowInfo class.
        UltraDesktopAlertShowWindowInfo showInfo = new UltraDesktopAlertShowWindowInfo();

        //  Set the Caption, Text, and FooterText properties using formatting
        //  characters that are recognized by the FormattedTextUIElement.
        showInfo.Caption = "<span style=\"font-weight:bold_x003B_\">Caption</span> is bolded<br/>";
        showInfo.Text = "<span style=\"text-decoration:underline_x003B_\">Line one of the Text is underlined</span><br/><span style=\"font-style:italic_x003B_\">Line two is italicized</span><br/>";
        showInfo.FooterText = "<a href=\"www.infragistics.com\">Click to visit the Infragistics website</a>";

        //  Call the Show method to display the desktop alert
        this.desktopAlert.Show( showInfo );
    }

    //  Handles the 'DesktopAlertLinkClicked' event.
    private void OnDesktopAlertLinkClicked( object sender, DesktopAlertLinkClickedEventArgs e )
    {        
        switch ( e.LinkType )
        {
            //  If the caption or text link was clicked, close the desktop
            //  alert window, and do not attempt to open the link.
            case DesktopAlertLinkType.Caption:
            case DesktopAlertLinkType.Text:
            {
                this.OnLinkClicked( e.LinkType );
                e.LinkClickedArgs.OpenLink = false;
                e.CloseWindow = true;
            }
            break;

            //  If the footer text link was clicked, open the link,
            //  and do not close the desktop alert window. Also, pin
            //  the desktop alert window so it does not auto-close while
            //  we are performing the link's action.
            case DesktopAlertLinkType.Footer:
            {
                e.LinkClickedArgs.OpenLink = true;
                e.CloseWindow = false;
                e.WindowInfo.Pinned = true;
            }
            break;
        }
    }
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also