I have a resource dictionary combining a number of datatemplates. I'm including this resource dictionary as a ResourceDictionary.MergedDictionaries in my Page.Resources. One of my datatemplates is a ListView and while the item source and item click is working correctly, a separate button on the ListViewItem, set in the datatemplate, is not calling my click method. Im unsure about setting this up correctly.
This click method is defined in the code behind class the defines the pages Xaml including the resource dictionary and using my datatemplate for ListViewItems.
Dictionaries
- DataTemplates.xaml <- ListView template here with a button click defined in the page cs, i.e.
Click="MyPages_ClickMethod"
- DataTemplates.xaml <- ListView template here with a button click defined in the page cs, i.e.
Pages
- MyPage.xaml
- MyPage.xaml.cs <- click method defined here,
MyPages_ClickMethod()
Here is how I am setting up the button in the datatemplate:
<Button Tag="{Binding id}" Click="MultiShareSelectFileButton_Click" Background="Transparent" Visibility="{Binding multiShareSelected, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Inverted, Mode=OneWay}"> <Image Width="27" Source="ms-appx:///Assets/[email protected]" VerticalAlignment="Center" HorizontalAlignment="Center"> </Image> </Button> Is it possible to do this without using ICommand?
Something like: Click="{x:Bind Path=pages:ProductPage.MultiShareSelectFileButton_Click}", but this is complaining that MultiShareSelectFileButton_Click should be static