Skip to main content

RichEditControl.HyperlinkFormShowing Event

Occurs before the Edit Hyperlink dialog is invoked.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v24.2.dll

Declaration

public event HyperlinkFormShowingEventHandler HyperlinkFormShowing

Event Data

The HyperlinkFormShowing event's data class is HyperlinkFormShowingEventArgs. The following properties provide information specific to this event:

Property Description
ControllerParameters Gets the information for initializing the Edit Hyperlink dialog controls.
DialogResult Gets or sets the return value of a dialog box. Inherited from ShowFormEventArgs.
Handled Gets or sets whether an event was handled. If it was handled, the default actions are not required. Inherited from ShowFormEventArgs.
Parent Gets or sets a parent of the form being shown. Inherited from ShowFormEventArgs.

Remarks

Handle the HyperlinkFormShowing event to perform any actions prior to the Edit Hyperlink dialog being shown. For example, you can substitute the standard dialog with a custom one and set the ShowFormEventArgs.Handled property to true, to prevent default event handling.

Example

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

private void richEditControl1_HyperlinkFormShowing(object sender,HyperlinkFormShowingEventArgs e)
{
    using (MyHyperlinkForm form = new MyHyperlinkForm(e.ControllerParameters))
    {
        e.DialogResult = form.ShowDialog();
        e.Handled = true;
    }
}
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;
        }

    }
}
See Also