Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Picker - Binding Context

$
0
0

Currently have a picker that won't display the list of items that are bound to it.

I have a ListView that is using the exact same binding, and it displays the list no problems at all.

Code below:

        <StackLayout IsVisible="{Binding IsDropdownControl}">
          <Label Text="Task Field:"/>
          <Picker Title="Select a Value:"
                        ItemsSource="{Binding FieldItems}" BindingContext="{Binding SelectedField}"
                        ItemDisplayBinding="{Binding Name}"
                  SelectedItem="{Binding SelectedFieldItem}"
                  HorizontalOptions="FillAndExpand">
          </Picker>
        </StackLayout>


        <StackLayout IsVisible="{Binding IsCheckBoxControl}">
          <Label Text="Select Options:"/>
          <ListView ItemsSource="{Binding FieldItems}" BindingContext="{Binding SelectedField}"
                HasUnevenRows="True"
                SeparatorColor="Gray"
                VerticalOptions="FillAndExpand"
                HorizontalOptions="FillAndExpand">
            <ListView.ItemTemplate>
              <DataTemplate>
                <ViewCell>
                  <StackLayout HorizontalOptions="FillAndExpand" Orientation="Horizontal">
                    <Label Text="{Binding Name}" TextColor="Black" FontSize="Small" 
                             HorizontalOptions="StartAndExpand"/>
                    <Switch HorizontalOptions="End" 
                              IsToggled="{Binding Value}"/>
                  </StackLayout>
                </ViewCell>
              </DataTemplate>
            </ListView.ItemTemplate>
          </ListView>
        </StackLayout>

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>