Handle Buttons inside ListView (with external template)

In my page I have a ListView with external template:

<ListView x:Name="MessagesListView"
      ItemTemplate="{StaticResource MessageTemplateSelector}"
      ItemsSource="{Binding Messages}">

The MessageTemplateSelector is a ViewCell with is saved in a different file (e.g., MyViewCell.xaml).
In it I have a button:

<Button BindingContext="{Binding Source={x:Reference MessagesListView}, Path=BindingContext}"
                Command="{Binding OpenAttachmentCommand}"
                CommandParameter="{Binding Source={x:Reference Item}, Path=BindingContext}"></Button>

How is possible get its Command if I can't get the reference of MessagesListView?

Sign In or Register to comment.