Back to Devexpress

CheckEdit.CheckedChanged Event

maui-devexpress-dot-maui-dot-editors-dot-checkedit-6bc9cef9.md

latest3.3 KB
Original Source

CheckEdit.CheckedChanged Event

Raises when the IsChecked property value changes.

Namespace : DevExpress.Maui.Editors

Assembly : DevExpress.Maui.Editors.dll

NuGet Package : DevExpress.Maui.Editors

Declaration

csharp
public event EventHandler CheckedChanged

Event Data

The CheckedChanged event's data class is EventArgs.

Remarks

Use the IsChecked property to obtain the new value.

Example

The code below handles the CheckedChanged event to change a MultilineEdit‘s font attributes.

xml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:dxe="clr-namespace:DevExpress.Maui.Editors;assembly=DevExpress.Maui.Editors"
             x:Class="App1.MainPage">
    <Grid Margin="20,35,20,20">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.5*" />
            <ColumnDefinition Width="0.5*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <dxe:CheckEdit x:Name="boldCheckEdit"
                       CheckedChanged="boldCheckEdit_CheckedChanged"
                       Label="Bold"
                       CheckBoxColor="Red"
                       CheckedCheckBoxColor="Red"
                       VerticalOptions="Center"/>
        <dxe:CheckEdit x:Name="italicCheckEdit"
                       Grid.Column="1"
                       CheckedChanged="italicCheckEdit_CheckedChanged"
                       Label="Italic"
                       CheckBoxColor="Green"
                       CheckedCheckBoxColor="Green"
                       VerticalOptions="Center"/>
        <dxe:MultilineEdit x:Name="multilineEdit"
                           Grid.Row="1"
                           Grid.ColumnSpan="2"
                           Text="Lorem ipsum dolor sit amet."/>
    </Grid>
</ContentPage>
cs
using DevExpress.Maui.Editors;

private void italicCheckEdit_CheckedChanged(object sender, EventArgs e) {
    CheckEdit checkEdit = sender as CheckEdit;
    if((bool)checkEdit.IsChecked)
        multilineEdit.TextFontAttributes |= FontAttributes.Italic;
    else
        multilineEdit.TextFontAttributes &= ~FontAttributes.Italic;
}

private void boldCheckEdit_CheckedChanged(object sender, EventArgs e) {
    CheckEdit checkEdit = sender as CheckEdit;
    if((bool)checkEdit.IsChecked)
        multilineEdit.TextFontAttributes |= FontAttributes.Bold;
    else
        multilineEdit.TextFontAttributes &= ~FontAttributes.Bold;
}

See Also

CheckEdit Class

CheckEdit Members

DevExpress.Maui.Editors Namespace