How to use SelectedIndexChanged or CommandParameter with CommunityToolkit.Mvvm

Bhuwan 821 Reputation points
2025-01-18T16:28:39.4233333+00:00

I am using CommunityToolkit.Mvvm with ObservableObject and ObservableProperty. In the MVVM pattern, how can I trigger the SelectedIndexChanged event for a Picker when an item is selected, or handle changes in an Entry when typing into the textbox?

[RelayCommand]

private void OnChanged()

{

}

<Picker TitleColor="{StaticResource LabelPlaceHolder}"

ItemsSource="{Binding Countrys}"

ItemDisplayBinding="{Binding Name}"

SelectedItem="{Binding SelectedItemCountry,Mode=TwoWay}"
SelectedIndexChanged="{Binding OnChanged}"

FontFamily="OpenSansSemibold"

FontSize="12">

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
4,033 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bhuwan 821 Reputation points
    2025-01-19T05:42:52.01+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.