Search code examples
c#xamlwindows-phonemvvm-light

How to use listpickerflyout in windows phone 8.1 using MVVM


I am looking for an example of how can i use listpickerflyout in windows phone 8.1 in MVVM Light. My requirement is to show a list to user e.g country list where user can pick one of the country. and selected country is shown.


Solution

  • Got the solution :) just need to add the button and than add listpickerflyout in xaml and bind the item source of the flyout and button content property. here is how

    <Button x:Name="btnTest" Content="{Binding SelectedCountry.Name, Mode=TwoWay}">
        <Button.Flyout>
            <ListPickerFlyout ItemsSource="{Binding Countries}" 
                              Placement="Full" 
                              SelectedValue="{Binding SelectedCountry, Mode=TwoWay}" 
                              DisplayMemberPath="Name"/>
        </Button.Flyout>
    </Button>