XAML-Element:
1
| <Grid x:Name="advert">...</Grid> |
<Grid x:Name="advert">...</Grid>
Möglichkeit 1
1
| <Grid x:Name="advert" Tapped="AdvertTapped">...</Grid> |
<Grid x:Name="advert" Tapped="AdvertTapped">...</Grid>
1
2
3
4
| private void AdvertTapped(object sender, TappedRoutedEventArgs e)
{
// do something
} |
private void AdvertTapped(object sender, TappedRoutedEventArgs e)
{
// do something
}
Möglichkeit 2
1
2
3
4
5
6
7
8
9
10
11
| public GroupDetailPage()
{
this.InitializeComponent();
advert.AddHandler(Grid.TappedEvent, new TappedEventHandler(AdvertTapped), true);
}
private void AdvertTapped(object sender, TappedRoutedEventArgs e)
{
// do something
} |
public GroupDetailPage()
{
this.InitializeComponent();
advert.AddHandler(Grid.TappedEvent, new TappedEventHandler(AdvertTapped), true);
}
private void AdvertTapped(object sender, TappedRoutedEventArgs e)
{
// do something
}
Möglichkeit 3
1
2
3
4
5
6
7
8
9
10
11
| public GroupDetailPage()
{
this.InitializeComponent();
advert.Tapped += new TappedEventHandler(AdvertTapped);
}
private void AdvertTapped(object sender, TappedRoutedEventArgs e)
{
// do something
} |
public GroupDetailPage()
{
this.InitializeComponent();
advert.Tapped += new TappedEventHandler(AdvertTapped);
}
private void AdvertTapped(object sender, TappedRoutedEventArgs e)
{
// do something
}
Möglichkeit 4
1
2
3
4
5
6
7
8
9
| public GroupDetailPage()
{
this.InitializeComponent();
advert.Tapped += (sender, e) =>
{
// do something
};
} |
public GroupDetailPage()
{
this.InitializeComponent();
advert.Tapped += (sender, e) =>
{
// do something
};
}