1

I've been Googling for it; but without any luck. I think this is fairly simple.

I have a user control named TicketGroup. TicketGroup is the visual representation of a List object I have. The XAML code I've got looks like this.

 <c:TicketGroup Grid.Row="1" /> <c:TicketGroup Grid.Row="2" /> <c:TicketGroup Grid.Row="3" /> <c:TicketGroup Grid.Row="4" /> 

Inside the TicketGroup I have an ItemsControl called TicketItemsControl and it has an ItemsSource ="" attribute in there. What I'm struggling to do is 'pass in' that ItemsSource value in the above XAML.

Basically, the object I'm working with has four different lists. I want the first TicketGroup to have an ItemsSource="{Binding Path=MyList1}" and the second to have an ItemsSource="{Binding Path=MyList2}" etc.... but I can't figure out how to do that.

1 Answer 1

3

You can set the datacontext of each c:TicketGroup to the List so you will have code like:

<c:TicketGroup Grid.Row="1" DataContext="{Binding Path=MyList1}" /> <c:TicketGroup Grid.Row="2" DataContext="{Binding Path=MyList2}" /> <c:TicketGroup Grid.Row="3" DataContext="{Binding Path=MyList3}" /> <c:TicketGroup Grid.Row="4" DataContext="{Binding Path=MyList4}" /> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.