-
-
Notifications
You must be signed in to change notification settings - Fork 171
Description
I decided to use DropdownField from 'http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material' instead of Dropdown from 'http://schemas.enisn-projects.io/dotnet/maui/uraniumui'.
xmlns:urui="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
I'm using binding to the SelectedItem property of DropdownField like this:
<urui:DropdownField
Title="Protocolo"
FontSize="18"
SelectedItem="{Binding IpServidor.Protocolo}">
<urui:DropdownField.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>http://</x:String>
<x:String>https://</x:String>
</x:Array>
</urui:DropdownField.ItemsSource>
</urui:DropdownField>
The problem is that the value doesn't change. I also tried binding the ItemsSource property through the ViewModel, and the same issue occurs.
I added the SelectedItemChangedCommand property with a generic Command method from the ViewModel to check if the value changed. When it is triggered, the value changes in the command parameter, but it doesn't change in the SelectedItem property.
CommmadnChanged = new RelayCommand<string>(Coma);
private async void Coma(string valueP)
{
await Toast.Make("" + valueP).Show(); // I can see the selected value here. It changed!
}
In order to use this control instead of Dropdown, I can update the selected item by getting the value from the command parameter, but it is an extra step because the SelectedItem property should handle it.
It took me some time to notice.
Android Device: Android 9.0 - Api 28
UraniumUI: 2.9 (latest)
.NET MAUI: 9