EditorButton.IsDefaultButton Property
Gets or sets whether the button is the default button.
Namespace: DevExpress.XtraEditors.Controls
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Property Value
Type | Description |
---|---|
Boolean | true if the button is the default button; otherwise, false. |
Remarks
Default editor buttons are the buttons that are displayed by default. For instance, when a ButtonEdit is dropped onto a form, it displays a (…) button which is the default button. The button’s IsDefaultButton property specifies whether the button is the default button. This can be useful when creating custom editors with additional default buttons.
Example
The example below demonstrates how to create a custom button editor with default spin buttons.
class RepositoryItemMyButtonEdit : RepositoryItemButtonEdit {
// ...
public static void RegisterMyButtonEdit() {
// ...
EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo("MyButtonEdit",
typeof(MyButtonEdit), typeof(RepositoryItemMyButtonEdit),
typeof(DevExpress.XtraEditors.ViewInfo.ButtonEditViewInfo),
new DevExpress.XtraEditors.Drawing.ButtonEditPainter(),
true, null, typeof(DevExpress.Accessibility.ButtonEditAccessible)));
}
private void AddDefaultButton(EditorButton btn, Keys keys) {
btn.IsLeft = true;
btn.Shortcut = new DevExpress.Utils.KeyShortcut(keys);
btn.IsDefaultButton = true;
Buttons.Add(btn);
}
public override void CreateDefaultButton() {
base.CreateDefaultButton();
AddDefaultButton(new EditorButton(ButtonPredefines.SpinRight), Keys.Add);
AddDefaultButton(new EditorButton(ButtonPredefines.SpinLeft), Keys.Subtract);
}
}
public class MyButtonEdit : DevExpress.XtraEditors.ButtonEdit {
static MyButtonEdit() {
RepositoryItemMyButtonEdit.RegisterMyButtonEdit();
}
public override string EditorTypeName { get { return "MyButtonEdit"; } }
// ...
}
The image below shows the result:
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the IsDefaultButton property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.