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

ListView not binding

$
0
0

I'm just switching over to using Xamarin forms, so I feel like this is something simple I'm missing.

Here is my listview

<StackLayout Orientation="Vertical" Padding="20">
            <SearchBar x:Name="CodeSearch"></SearchBar>
            <ListView x:Name="SearchList" ItemsSource="{Binding CurrentCodes}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                        <Label Text="test" />
                            <Label x:Name="CodeLabel" Text="{Binding Code}" />
                            <Label x:Name="DescriptionLabel" Text="{Binding ShortDescription}" />
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>

And here is the CurrentCodes

public IEnumerable<Icd10Code> CurrentCodes
        {
            get 
            {
                return codeArray.Count == 0 ? new List<Icd10Code>() : codeArray [arrayIndex];
            }
        }

When the app loads though it displays an empty table. The test label was just to see if it was the label that wasn't binding, but the test label doesn't show either.

When the CurrentCodes changes value will the listview update on it's own, or do I need to trigger it somehow?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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