Skip to content

Latest commit

 

History

History
269 lines (152 loc) · 7.73 KB

File metadata and controls

269 lines (152 loc) · 7.73 KB

MaterialCheckBox

Checkboxes let users select one or more items from a list, or turn an item on or off and follow Material Design Guidelines. See more.

Namespace: HorusStudio.Maui.MaterialDesignControls

Inherits from: MaterialCheckBox → ContentView


XAML sample

xmlns:material="clr-namespace:HorusStudio.Maui.MaterialDesignControls;assembly=HorusStudio.Maui.MaterialDesignControls"

<material:MaterialCheckBox
        TextSide="Left"
        CheckedChangedCommand="{Binding CheckedChangedCommand}"
        Text="Checkbox 1"/>

C# sample

var checkBox = new MaterialCheckBox()
{
    Text = "Checkbox 1"
    TextSide = TextSide.Left,
    CheckedChangedCommand = viewModel.CheckChangedCommand
};

Properties

Gets or sets a value that allows the automation framework to find and interact with this element.

Property type: String

Remarks: This value may only be set once on an element.

When set on this control, the AutomationId is also used as a base identifier for its internal elements:

  • The CheckBox control uses the same AutomationId value.
  • The checkbox's text label uses the identifier "{AutomationId}_Text".

This convention allows automated tests and accessibility tools to consistently locate all subelements of the control.


Gets or sets the spacing between characters of the label. This is a bindable property.

Property type: Double


Gets or sets the command to invoke when the checkbox changes its status. This is a bindable property.

Property type: ICommand

Remarks: This property is used to associate a command with an instance of a checkbox. This property is most often set in the MVVM pattern to bind callbacks back into the ViewModel. VisualElement.IsEnabled is controlled by the Command.CanExecute(object) if set. The command parameter is of type bool and corresponds to the value of the IsChecked property.


Gets or sets the color for the checkbox. This is a bindable property.

Property type: Color

Default value: Theme: Light: MaterialLightTheme.Primary - Dark: MaterialDarkTheme.Primary


Gets the Content of checkbox. This is a bindable property.

Property type: String

Remarks: We disabled the set for this property because doesn't have sense set the content because we are setting with the checkbox and label.


Gets or sets the text style of the label. This is a bindable property.

Property type: FontAttributes


Defines whether an app's UI reflects text scaling preferences set in the operating system.

Property type: Boolean

Default value: true


Gets or sets the font family for the label. This is a bindable property.

Property type: String

Default value: MaterialFontFamily.Default


Defines the font size of the label. This is a bindable property.

Property type: Double

Default value: MaterialFontSize.BodyLarge


Internal implementation of the CheckBox control.

Property type: CheckBox

Remarks: This property can affect the internal behavior of this control. Use only if you fully understand the potential impact.


Gets or sets if the checkbox is checked. This is a bindable property.

Property type: Boolean

Default value: false


Gets or sets if the checkbox is enabled. This is a bindable property.

Property type: Boolean

Default value: false


Gets or sets the text for the checkbox. This is a bindable property.

Property type: String

Default value: null


Gets or sets the color for the text. This is a bindable property.

Property type: Color

Default value: Theme: Light: MaterialLightTheme.Text - Dark: MaterialDarkTheme.Text


Defines the location of the label. This is a bindable property.

Property type: TextSide

Name Value Description
Right 0 Right
Left 1 Left

Default value: TextSide.Left


Defines the casing of the label. This is a bindable property.

Property type: TextTransform


Gets or sets the color for the tick. This is a bindable property.

Property type: Color

Default value: Theme: Light: MaterialLightTheme.OnPrimary - Dark: MaterialDarkTheme.OnPrimary

Remarks: Only is supported on iOS.


Gets or sets a custom animation to be executed when checkbox is clicked. This is a bindable property.

Property type: ITouchAnimation

Default value: null


Gets or sets an animation to be executed when checkbox is clicked. This is a bindable property.

Property type: TouchAnimationTypes

Name Value Description
None 0 None: no animation runs.
Fade 1 Fade: Represents an animation that simulates a "fade" effect by changing the opacity over the target element.
Scale 2 Scale: Represents an animation that simulates a "sink" or "sunken" effect by scaling the target element.
Bounce 3 Bounce: Represents an animation that simulates a "sink" or "sunken" effect with a "bounce" effect when the user releases the target element.

Default value: TouchAnimationTypes.Fade


Events

Occurs when the checkbox is checked / unchecked


Occurs when the checkbox is touched.


Known issues and pending features

  • [iOS] FontAttributes doesn't work.
  • The Selected property in Appium is not supported when using the AutomationId of this control, just like with the native MAUI control.