Reputation: 5357
I have a pivot control which is bound to a list through the ItemsSource attribute.
In the ItemTemplate I would like to place a custom control, in which I would like to bind controls to the current item in the pivot's list.
I'm looking for something around
<MyControl Item="{Binding <Something here>}" />
But am not sure what <something here> should be to point to the current item in the control's databound list?
Thanks
Upvotes: 1
Views: 555
Reputation: 66882
Maybe I'm misunderstanding, but if this control is going inside the PivotItem then isn't the path you are looking for just:
<MyControl Item="{Binding}" />
e.g. if using a TextBlock then you might use:
<TextBlock Text="{Binding}" />
Or if using a complicated user control you might use:
<MySpecialControl DataContext="{Binding}" />
Sorry if I've got this wrong!
Upvotes: 0
Reputation: 16319
You could do one of two things (that immediately spring to mind):
Pivot.SelectedItem
property, which you add as a resource to the page and bind to the pivot's SelectedItem
property. You can then reference that resource as you would any other resource to get at the selected item. If you're not familiar with this proxy concept, then Dan Wahlin's post on the subject should help.
Upvotes: 1