Back to Devexpress

CheckButton.Checked Property

windowsforms-devexpress-dot-xtraeditors-dot-checkbutton.md

latest6.1 KB
Original Source

CheckButton.Checked Property

Gets or sets the button’s check state.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(false)]
[DXCategory("Appearance")]
public virtual bool Checked { get; set; }
vb
<DXCategory("Appearance")>
<DefaultValue(False)>
Public Overridable Property Checked As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true if the button is checked (in the depressed state); false if the button is unchecked (in the elevated state).

|

Remarks

CheckButton controls have two logical states - checked and unchecked. Use the Checked property to set the check state. It’s possible to swap the check state via the CheckButton.Toggle method.

To respond to a button’s state being changed, handle the CheckButton.CheckedChanged event.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Checked 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.

winforms-scheduler-customize-appointment-flyout/CS/CustomAppointmentFlyoutExample/Form1.cs#L104

csharp
private void chkBtnTooltips_CheckedChanged(object sender, EventArgs e) {
    if (chkBtnTooltips.Checked) {
        #region #AllowDisplayAppointmentFlyout

how-to-use-docvariable-fields/CS/DocumentVariablesExample/Form1.cs#L127

csharp
Document doc = richEdit.Document;
bool showCodes = btn_ShowCodes.Checked;
doc.BeginUpdate();

winforms-scheduler-formatting-services/CS/FormattingServicesExample/Form1.cs#L55

csharp
private void checkButton1_CheckedChanged(object sender, EventArgs e) {
    if (checkButton1.Checked) {
        schedulerControl1.RemoveService(typeof(IAppointmentFormatStringService));

winforms-richedit-layout-api/CS/Form1.cs#L111

csharp
{
    if (checkbtnCustomDraw.Checked)
    {

winforms-grid-hide-vertical-lines-between-certain-columns/CS/E3647/Form1.cs#L88

csharp
{
    helper.Hide = checkButton1.Checked;
}

winforms-scheduler-customize-appointment-flyout/VB/CustomAppointmentFlyoutExample/Form1.vb#L114

vb
Private Sub chkBtnTooltips_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
            If chkBtnTooltips.Checked Then
#Region "#AllowDisplayAppointmentFlyout"

how-to-use-docvariable-fields/VB/DocumentVariablesExample/Form1.vb#L121

vb
Dim doc As Document = richEdit.Document
Dim showCodes As Boolean = btn_ShowCodes.Checked
doc.BeginUpdate()

winforms-scheduler-formatting-services/VB/FormattingServicesExample/Form1.vb#L63

vb
Private Sub checkButton1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
    If checkButton1.Checked Then
        schedulerControl1.RemoveService(GetType(IAppointmentFormatStringService))

winforms-richedit-layout-api/VB/Form1.vb#L92

vb
Private Sub checkbtnCustomDraw_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles checkbtnCustomDraw.CheckedChanged
    If checkbtnCustomDraw.Checked Then
        AddHandler richEditControl1.BeforePagePaint, AddressOf richEditControl1_BeforePagePaint

winforms-grid-hide-vertical-lines-between-certain-columns/VB/E3647/Form1.vb#L86

vb
If helper IsNot Nothing Then
    helper.Hide = checkButton1.Checked
End If

See Also

CheckedChanged

Toggle()

CheckButton Class

CheckButton Members

DevExpress.XtraEditors Namespace