Skip to content

Commit

Permalink
Merge pull request #800 from telerik/new-kb-migrating-xamarin-checkbo…
Browse files Browse the repository at this point in the history
…x-maui-checkbox-5ac1ed8a9c9d4c49a15fe2b8c3e18c0c

Added new kb article migrating-xamarin-checkbox-maui-checkbox
  • Loading branch information
didiyordanova committed Mar 7, 2024
2 parents fb74f18 + e45f8ae commit 84c3bb0
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controls/checkbox/xamarin-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ The tables in the following sections list any differences between the APIs of th
| N/A | `CornerRadius` |
| `CheckBoxUserCommand` | N/A |

Review the [Implementing the CheckBoxUserCommand Behavior When Migrating from Xamarin CheckBox to MAUI CheckBox]({%slug migrating-xamarin-checkbox-maui-checkbox%}) how-to article for more details how to define a command when the Telerik .NET MAUI CheckBox state changes.

## See Also

* [Migrating from Xamarin.Forms to .NET MAUI]({% slug migrate-to-net-maui %})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ That's it! You have successfully added a **Select All** option in the drop-down

>tip Next, customize the appearance of the **Select All** option to match your application's design.
If you want to use a command when the CheckBox state changes, review the [Implementing the CheckBoxUserCommand Behavior When Migrating from Xamarin CheckBox to MAUI CheckBox]({%slug migrating-xamarin-checkbox-maui-checkbox%}) how-to article.

## See Also

- [ComboBox Documentation]({%slug combobox-overview%})
48 changes: 48 additions & 0 deletions knowledge-base/migrating-xamarin-checkbox-maui-checkbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Implementing the CheckBoxUserCommand Behavior When Migrating from Xamarin CheckBox to MAUI CheckBox
description: Learn how to implement the Xamarin CheckBoxUserCommand behavior in MAUI when migrating from Xamarin.
type: how-to
page_title: Migrating the Xamarin Checkbox CheckBoxUserCommand to MAUI
slug: migrating-xamarin-checkbox-maui-checkbox
tags: xamarin, maui, checkbox, migration
res_type: kb
---

## Environment

| Version | Product | Author |
| --- | --- | ---- |
| 6.7.0 | Telerik UI for .NET MAUI CheckBox | [Dobrinka Yordanova](https://www.telerik.com/blogs/author/dobrinka-yordanova)|


## Description

When migrating your Xamarin app to MAUI, you may notice that the CheckBoxUserCommand behavior is missing in the Telerik MAUI CheckBox control. This article will show you how to implement a similar scenario in MAUI.

## Solution

To achieve a similar behavior in MAUI, you can use the `IsCheckedChanged` event along with the `EventToCommandBehavior` from the Microsoft Community Toolkit for MAUI.

**1.** Add the `EventToCommandBehavior` package to your MAUI project. You can find more information on how to do this in the [Microsoft Community Toolkit documentation](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/behaviors/event-to-command-behavior).

**2.** In your MAUI XAML file, add the `RadCheckBox` control and the `EventToCommandBehavior` as a behavior.

```xaml
<telerik:RadCheckBox IsCheckedChanged="RadCheckBox_IsCheckedChanged">
<telerik:RadCheckBox.Behaviors>
<toolkit:EventToCommandBehavior EventName="IsCheckedChanged"
Command="{Binding CheckedCommand}" />
</telerik:RadCheckBox.Behaviors>
</telerik:RadCheckBox>
```

By using the `IsCheckedChanged` event and the `EventToCommandBehavior`, you can achieve a similar behavior to the `CheckBoxUserCommand` in the Xamarin CheckBox control.

## Notes

- Make sure to add the necessary namespaces for the `RadCheckBox` and `EventToCommandBehavior` controls in your XAML file.
- You may need to adjust the event handler or command binding based on your specific implementation.

## See Also

- [Migrating from Xamarin Checkbox to MAUI Checkbox](https://docs.telerik.com/devtools/maui/controls/checkbox/xamarin-migration)

0 comments on commit 84c3bb0

Please sign in to comment.