0

I have the following code which posts buttons in rows and columns.

<ItemsControl ItemsSource="{Binding MyCollection}">
<!-- ItemsPanelTemplate -->
<ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
        <UniformGrid Columns="2" />
    </ItemsPanelTemplate>
</ItemsControl.ItemsPanel>

<!-- ItemTemplate -->
<ItemsControl.ItemTemplate>
    <DataTemplate>
        <Button Content="{Binding }" />
    </DataTemplate>
</ItemsControl.ItemTemplate>

Here is my collection which populates the user controls

private Collection<TemplateView> _myCollection; 
public Collection<TemplateView> MyCollection
{ 
    get { return _myCollection; } 
    set { _myCollection = value; } 
}

How do I know which particular button is pressed? (row/column would suffice). Many thanks in advance :)

4

0 回答 0