private void OnSortClick(object sender, RoutedEventArgs e) { var sortButton = sender as Button; if (sortButton == null) { return; } MenuFlyout menuFlyout = null; if (this.SharedFoldersPivot.SelectedItem.Equals(this.IncomingSharesPivot)) { menuFlyout = DialogService.CreateIncomingSharedItemsSortMenu(this.ViewModel.IncomingShares); } if (this.SharedFoldersPivot.SelectedItem.Equals(this.OutgoingSharesPivot)) { menuFlyout = DialogService.CreateOutgoingSharedItemsSortMenu(this.ViewModel.OutgoingShares); } if (menuFlyout == null) { return; } menuFlyout.Placement = FlyoutPlacementMode.Bottom; menuFlyout.ShowAt(sortButton); }