Back to Devexpress

HyperlinkFormShowingEventArgs.ControllerParameters Property

windowsforms-devexpress-dot-xtrarichedit-dot-hyperlinkformshowingeventargs.md

latest4.7 KB
Original Source

HyperlinkFormShowingEventArgs.ControllerParameters Property

Gets the information for initializing the Edit Hyperlink dialog controls.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.XtraRichEdit.v25.2.dll

NuGet Package : DevExpress.Win.RichEdit

Declaration

csharp
public HyperlinkFormControllerParameters ControllerParameters { get; }
vb
Public ReadOnly Property ControllerParameters As HyperlinkFormControllerParameters

Property Value

TypeDescription
DevExpress.XtraRichEdit.Forms.HyperlinkFormControllerParameters

A DevExpress.XtraRichEdit.Forms.HyperlinkFormControllerParameters object containing information to be displayed in the form.

|

Example

This example demonstrates how to replace the standard Hyperlink dialog with a custom form using the RichEditControl.HyperlinkFormShowing event.

csharp
private void richEditControl1_HyperlinkFormShowing(object sender,HyperlinkFormShowingEventArgs e)
{
    using (MyHyperlinkForm form = new MyHyperlinkForm(e.ControllerParameters))
    {
        e.DialogResult = form.ShowDialog();
        e.Handled = true;
    }
}
vb
Private Sub richEditControl1_HyperlinkFormShowing(ByVal sender As Object, ByVal e As HyperlinkFormShowingEventArgs)
    Using form As New MyHyperlinkForm(e.ControllerParameters)
        e.DialogResult = form.ShowDialog()
        e.Handled = True
    End Using
End Sub
csharp
using System;
using DevExpress.XtraRichEdit.Forms;

namespace CustomDialogs {
    class MyHyperlinkForm : HyperlinkForm {
        public MyHyperlinkForm(HyperlinkFormControllerParameters controllerParameters)
            : base(controllerParameters)
        {
            btnEditAddress.EditValueChanged += new EventHandler(btnEditAddress_EditValueChanged);
            btnEditAddress.LostFocus += new EventHandler(btnEditAddress_LostFocus);
        }

        void btnEditAddress_LostFocus(object sender, EventArgs e) {
            this.btnEditAddress.Text = Controller.NavigateUri;
        }

        void btnEditAddress_EditValueChanged(object sender, EventArgs e) {
            Controller.NavigateUri = ValidateUrl(btnEditAddress.Text);
            this.btnOk.Enabled = true;
        }

        private string ValidateUrl(string p) {
            string s = p.Replace("devexpres.com", "devexpress.com");
            return s;
        }

    }
}
vb
Imports Microsoft.VisualBasic
Imports System
Imports DevExpress.XtraRichEdit.Forms

Namespace CustomDialogs
    Friend Class MyHyperlinkForm
        Inherits HyperlinkForm
        Public Sub New(ByVal controllerParameters As HyperlinkFormControllerParameters)
            MyBase.New(controllerParameters)
            AddHandler btnEditAddress.EditValueChanged, AddressOf btnEditAddress_EditValueChanged
            AddHandler btnEditAddress.LostFocus, AddressOf btnEditAddress_LostFocus
        End Sub

        Private Sub btnEditAddress_LostFocus(ByVal sender As Object, ByVal e As EventArgs)
            Me.btnEditAddress.Text = Controller.NavigateUri
        End Sub

        Private Sub btnEditAddress_EditValueChanged(ByVal sender As Object, ByVal e As EventArgs)
            Controller.NavigateUri = ValidateUrl(btnEditAddress.Text)
            Me.btnOk.Enabled = Not String.IsNullOrEmpty(Me.btnEditAddress.Text)
        End Sub

        Private Function ValidateUrl(ByVal p As String) As String
            Dim s As String = p.Replace("devexpres.com", "devexpress.com")
            Return s
        End Function

    End Class
End Namespace

See Also

HyperlinkFormShowingEventArgs Class

HyperlinkFormShowingEventArgs Members

DevExpress.XtraRichEdit Namespace