Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Pass GroupHeader Key as Binding to Item

$
0
0

I got a grouped ListView and would like to pass the Key as binding to the Item.

<controls:MyListView
    x:Name="MyListview"
     Style="{StaticResource MyListViewStyle}"
     ItemsSource="{Binding Model.MyListViewSource}">
    <ListView.GroupHeaderTemplate>
        <DataTemplate>
            <cell:KeyCell
                Key="{Binding Key}"/>
        </DataTemplate>
    </ListView.GroupHeaderTemplate>
    <ListView.ItemTemplate>
        <DataTemplate>
            <cell:Cell
                Item="{Binding}"
                ItemKey="{Binding Key}"/>
                </DataTemplate>
      </ListView.ItemTemplate>
</controls:MyListView>

This is not working since the ItemKey Binding is looking up Item.Key.
How can I reference the Key from the ItemTemplate?


Viewing all articles
Browse latest Browse all 204402

Trending Articles