I think you can create a popup with a collection view
for the popup you can use Xamarin-Community-Toolkit-Platform-Perfect-Popups-Part-1
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi ,
I working on Xamarin forms application, I want to implement Language dropdown with Flags , as given in Example below. I need to implement both in android and iOS.
Please help me with this.
I think you can create a popup with a collection view
for the popup you can use Xamarin-Community-Toolkit-Platform-Perfect-Popups-Part-1
Hi @Alessandro Caliaro Thanks for the idea, I was able to implement the same way as you suggested.
But i am not able to bind the image from view model.
Scenario: I have 3 flag images. when i select the country images has to bind with respective flags. Thats not happening in my code.
Xaml
<Image x:Name="image" WidthRequest="25" Source="{Binding SomeImage}" HeightRequest="25" Margin="0,0,20,0">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenLanguage}"/>
</Image.GestureRecognizers>
</Image
viewModel:
private ImageSource _someImage;
public ImageSource SomeImage
{
get { return _someImage; }
set
{
_someImage = value;
OnPropertyChanged("SomeImage");
// better yet
// OnPropertyChanged(nameof(ImageBattery));
}
}
method:
if (selected_Item.Key.ToString() == "zh")
{
SomeImage = ImageSource.FromFile("china_Flag.png");} else if (selected_Item.Key.ToString() == "en") { SomeImage = ImageSource.FromFile("UK_image.png"); } else if (selected_Item.Key.ToString() == "pt") { SomeImage = ImageSource.FromFile("pt_Flag.png"); }