Back to Devexpress

RibbonControl.CustomizationFormShowing Event

windowsforms-devexpress-dot-xtrabars-dot-ribbon-dot-ribboncontrol-d3e9d798.md

latest4.2 KB
Original Source

RibbonControl.CustomizationFormShowing Event

Fires when the Customization Form is about to be displayed and allows you to customize the form.

Namespace : DevExpress.XtraBars.Ribbon

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public event CustomizationFormShowingEventHandler CustomizationFormShowing
vb
<DXCategory("Events")>
Public Event CustomizationFormShowing As CustomizationFormShowingEventHandler

Event Data

The CustomizationFormShowing event's data class is DevExpress.XtraBars.Ribbon.CustomizationFormShowingEventArgs.

Remarks

The CustomizationFormShowing event fires when the form is about to be displayed and allows you to customize the form. The CustomizatoinForm event argument provides access to a RibbonCustomizationForm object that specifies the form.

Example

The code below shows how to change the form’s caption.

csharp
using DevExpress.XtraBars.Ribbon;

private void ribbonControl1_CustomizationFormShowing(object sender, CustomizationFormShowingEventArgs e) {
    // Specify the form's caption.
    e.CustomizationForm.Text = "Customization Form";
}
vb
Imports DevExpress.XtraBars.Ribbon

Private Sub ribbonControl1_CustomizationFormShowing(ByVal sender As Object, ByVal e As CustomizationFormShowingEventArgs) _
    Handles ribbonControl1.CustomizationFormShowing

    ' Specify the form's caption.
    e.CustomizationForm.Text = "Customization Form"
End Sub

The code below shows how to customize the form’s buttons.

csharp
using DevExpress.XtraBars.Ribbon;

private void ribbonControl1_CustomizationFormShowing(object sender, CustomizationFormShowingEventArgs e) {
    e.CustomizationForm = new MyCustomizationForm(sender as RibbonControl);
}

class MyCustomizationForm : RibbonCustomizationForm {
    public MyCustomizationForm() : base(null) {
    }
    public MyCustomizationForm(RibbonControl ribbonControl) : base(ribbonControl) {
    }

    protected override void InitDialogBase() {
        base.InitDialogBase();

        // Hide the Import/Export button.
        ImportButton.Visible = false;

        // Change the Rename button's caption and width.
        RenameButton.Text = "Umbenennen...";
        RenameButton.Width += 10;
    }
}
vb
Imports DevExpress.XtraBars.Ribbon

Private Sub ribbonControl1_CustomizationFormShowing(ByVal sender As Object, ByVal e As CustomizationFormShowingEventArgs) _
    Handles ribbonControl1.CustomizationFormShowing
    e.CustomizationForm = New MyCustomizationForm(TryCast(sender, RibbonControl))
End Sub

Friend Class MyCustomizationForm
    Inherits RibbonCustomizationForm

    Public Sub New()
        MyBase.New(Nothing)
    End Sub
    Public Sub New(ByVal ribbonControl As RibbonControl)
        MyBase.New(ribbonControl)
    End Sub

    Protected Overrides Sub InitDialogBase()
        MyBase.InitDialogBase()

        ' Hide the Import/Export button.
        ImportButton.Visible = False

        ' Change the Rename button's caption and width.
        RenameButton.Text = "Umbenennen..."
        RenameButton.Width += 10

    End Sub

End Class

See Also

Ribbon Runtime Customization

ShowCustomizationForm()

RibbonControl Class

RibbonControl Members

DevExpress.XtraBars.Ribbon Namespace