Example #1
0
        private void Emoji_Click(object sender, RoutedEventArgs e)
        {
            EmojiList.ItemsSource  = Icons.Filters;
            EmojiList.SelectedItem = ViewModel.Icon;

            var flyout = FlyoutBase.GetAttachedFlyout(EmojiButton);

            flyout.ShowAt(EmojiButton, new FlyoutShowOptions {
                Placement = FlyoutPlacementMode.BottomEdgeAlignedRight
            });
        }
Example #2
0
        /// <summary>
        /// Opens a <see cref="ListViewItem"/>'s Flyout.
        /// </summary>
        /// <param name="sender">The <see cref="ListView"/> the <see cref="ListViewItem"/> is in.</param>
        /// <param name="parameter">The <see cref="ItemClickEventArgs"/> containing the <see cref="ListViewItem"/>.</param>
        /// <returns><see langword="null"/>.</returns>
        public object Execute(object sender, object parameter)
        {
            if (((sender as ListView)?
                 .ContainerFromItem((parameter as ItemClickEventArgs)?.ClickedItem) as ListViewItem)?
                .ContentTemplateRoot is FrameworkElement flyout && FlyoutBase.GetAttachedFlyout(flyout) != null)
            {
                FlyoutBase.ShowAttachedFlyout(flyout);
            }

            return(null);
        }
        private void ShowAttachedFlyout(FrameworkElement element)
        {
            if (element == null)
            {
                return;
            }

            var flyoutBase = FlyoutBase.GetAttachedFlyout(element);

            flyoutBase?.ShowAt(element);
        }
 private void LayerGrid_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     if (sender is FrameworkElement uie)
     {
         var fo = FlyoutBase.GetAttachedFlyout(uie);
         if (fo != null && e.GetCurrentPoint(uie).Properties.IsRightButtonPressed)
         {
             fo.ShowAt(uie);
         }
     }
 }
        private void ItemGrid_OnHolding(object sender, HoldingRoutedEventArgs e)
        {
            if (e.HoldingState == HoldingState.Started)
            {
                var senderElement = sender as UIElement;

                MenuFlyout flyoutBase = (MenuFlyout)FlyoutBase.GetAttachedFlyout((FrameworkElement)senderElement);
                flyoutBase.ShowAt(senderElement, e.GetPosition(senderElement));
                Debug.WriteLine("Holding " + e.GetPosition(senderElement));
            }
        }
        private void AttachPickerFlyout_ItemClick(object sender, MediaSelectedEventArgs e)
        {
            var flyout = FlyoutBase.GetAttachedFlyout(ButtonAttach) as MenuFlyout;

            if (flyout != null)
            {
                flyout.Hide();
            }

            ViewModel.SendPhotoCommand.Execute(e.Item.Clone());
        }
Example #7
0
        private void Grid_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            var tappedItem = (UIElement)e.OriginalSource;

            // Set highlight
            gvIcons.SelectedIndex = gvIcons.Items.IndexOf((senderElement).DataContext);

            var attachedFlyout = (MenuFlyout)FlyoutBase.GetAttachedFlyout(senderElement);

            attachedFlyout.ShowAt(tappedItem, e.GetPosition(tappedItem));
        }
Example #8
0
 private void UIElement_OnRightTapped(object sender, RightTappedRoutedEventArgs e)
 {
     e.Handled = true;
     if (sender is FrameworkElement frameworkElement)
     {
         var flyoutBase = FlyoutBase.GetAttachedFlyout(frameworkElement);
         flyoutBase.ShowAt(frameworkElement, new FlyoutShowOptions()
         {
             Position = e.GetPosition(frameworkElement)
         });
     }
 }
        /// <summary>
        /// Executes the action.
        /// </summary>
        /// <param name="sender">
        /// The <see cref="T:System.Object" /> that is passed to the action by the behavior. Generally this is
        /// <seealso cref="P:Microsoft.Xaml.Interactivity.IBehavior.AssociatedObject" /> or a target object.
        /// </param>
        /// <param name="parameter">The value of this parameter is determined by the caller.</param>
        /// <remarks>
        /// An example of parameter usage is EventTriggerBehavior, which passes the EventArgs as a parameter to its actions.
        /// </remarks>
        /// <returns>
        /// Returns the result of the action.
        /// </returns>
        public object Execute(object sender, object parameter)
        {
            if (IsEnabled)
            {
                var senderElement = sender as FrameworkElement;
                var flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

                flyoutBase.ShowAt(senderElement);
            }

            return(null);
        }
Example #10
0
        public object Execute(object sender, object parameter)
        {
            var element = sender as FrameworkElement;
            var flyout  = FlyoutBase.GetAttachedFlyout(element);

            if (flyout != null)
            {
                flyout.ShowAt(element);
            }

            return(null);
        }
Example #11
0
        private void OcrListItem_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            FrameworkElement element = sender as FrameworkElement;

            if (element == null)
            {
                return;
            }
            var flyout = FlyoutBase.GetAttachedFlyout(element) as MenuFlyout;

            flyout?.ShowAt(this, e.GetPosition(null));
        }
 private void App_PointerPressed(object?sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     if (e.Source is Control c)
     {
         var border = c.FindParentControl <Border>("AppAvatar");
         if (border is not null)
         {
             var flyout = FlyoutBase.GetAttachedFlyout(border);
             flyout?.ShowAt(border, true);
         }
     }
 }
Example #13
0
        private void Image_Holding(object sender, HoldingRoutedEventArgs e)
        {
            if (e.HoldingState == Windows.UI.Input.HoldingState.Started)
            {
                var x = FlyoutBase.GetAttachedFlyout((FrameworkElement)sender);

                dummyGrid.Margin = new Thickness(e.GetPosition((sender as Image).Parent as Grid).X, e.GetPosition((sender as Image).Parent as Grid).Y, 0, 0);
                x.ShowAt(dummyGrid);

                e.Handled = true;
            }
        }
Example #14
0
        private void ProfileListViewItem_Holding(object sender, HoldingRoutedEventArgs e)
        {
            if (e.HoldingState == Windows.UI.Input.HoldingState.Started)
            {
                var tmp = (sender as ListViewItem).DataContext;
                ProfileList.SelectedItem = tmp;

                FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(sender as FrameworkElement);

                flyoutBase.ShowAt(sender as FrameworkElement);
            }
        }
Example #15
0
 public static void ShowAttachedMenuFlyout(this FrameworkElement element, HoldingRoutedEventArgs args)
 {
     if (args.HoldingState == HoldingState.Started)
     {
         var flyout = FlyoutBase.GetAttachedFlyout(element) as MenuFlyout;
         if (flyout != null)
         {
             flyout.ShowAt(element, args.GetPosition(element));
         }
         args.Handled = true;
     }
 }
Example #16
0
        private void PinnedFavoritesControl_OnRightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            var item       = sender as FrameworkElement;
            var tappedItem = (e.OriginalSource as FrameworkElement).DataContext as IFavorite;

            if (item != null)
            {
                MenuFlyout flyout = FlyoutBase.GetAttachedFlyout(item) as MenuFlyout;
                ((MenuFlyoutItem)flyout.Items[0]).CommandParameter = tappedItem;
                flyout.ShowAt(this, e.GetPosition(this));
            }
        }
Example #17
0
        private void LayoutRoot_Holding(object sender, HoldingRoutedEventArgs e)
        {
            if (e.HoldingState != Windows.UI.Input.HoldingState.Started)
            {
                return;
            }
            IsHolding = true;
            var        targetElement = sender as FrameworkElement;
            MenuFlyout flyout        = (MenuFlyout)FlyoutBase.GetAttachedFlyout(targetElement);

            flyout.ShowAt(targetElement, e.GetPosition(targetElement));
        }
        private void HandleUpdateMarkerClicked(Object sender, RoutedEventArgs e)
        {
            var marker = ViewModel.CurrentFileMarker;

            // Show a flyout that displays the current marker details
            var flyout        = (Flyout)FlyoutBase.GetAttachedFlyout((FrameworkElement)sender);
            var flyoutContent = (FrameworkElement)flyout.Content;

            var viewModel = new FileMarkerViewModel(ViewModel, marker);

            flyoutContent.DataContext = viewModel;
            flyout.ShowAt((FrameworkElement)sender);
        }
Example #19
0
        private void TextBlock_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var ingr = ((sender as TextBlock).DataContext as Model.IngredienteData);

            if (ingr.SubstitutosCollection != null && ingr.SubstitutosCollection.Any())
            {
                FrameworkElement senderElement = sender as FrameworkElement;
                // If you need the clicked element:
                var        whichOne   = (sender as TextBlock).Text;
                FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);
                flyoutBase.ShowAt(senderElement);
            }
        }
Example #20
0
        private void ListViewSubItem_Tapped(object sender, RoutedEventArgs e)
        {
            //This event is used for testing on PCs when debugging
            if (Utilities.IsDesktopComputer())
            {
                FrameworkElement senderElement = sender as FrameworkElement;

                // If you need the clicked element:
                // Item whichOne = senderElement.DataContext as Item;
                FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);
                flyoutBase.ShowAt(senderElement);
            }
        }
Example #21
0
        private void Image_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            var x = FlyoutBase.GetAttachedFlyout((FrameworkElement)sender);


            var   transform        = (sender as Grid).TransformToVisual((sender as Grid).Parent as ScrollViewer);
            Point absolutePosition = transform.TransformPoint(new Point(0, 0));

            dummyGrid.Margin = new Thickness(e.GetPosition(sender as FrameworkElement).X + absolutePosition.X, e.GetPosition(sender as FrameworkElement).Y + absolutePosition.Y, 0, 0);
            x.ShowAt(dummyGrid);

            e.Handled = true;
        }
Example #22
0
 private void ShowMenuFlyout(FrameworkElement element)
 {
     if (element != null)
     {
         AppDeferral.MainPageViewModel.MenuTartgetItem = element.DataContext as Note;
         AppDeferral.MainPageViewModel.PinCommand.CanExecuteChange();
         var menu = FlyoutBase.GetAttachedFlyout(element);
         if (menu != null)
         {
             menu.ShowAt(element);
         }
     }
 }
Example #23
0
        private void EbookFlipView_Holding(object sender, HoldingRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            // If you need the clicked element:
            // Item whichOne = senderElement.DataContext as Item;
            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);

            //flyoutBase.ShowAt(senderElement);
            flyoutBase.ShowAt(sender as UIElement, new FlyoutShowOptions()
            {
                Position = e.GetPosition(sender as UIElement)
            });
        }
Example #24
0
        private void Comment_Holding(object sender, HoldingRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;

            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);

            var SenderItem = senderElement.DataContext as CommentItem;

            if (SenderItem.User.Name == Api.Settings.Values[Api.Username].ToString())
            {
                flyoutBase.ShowAt(senderElement);
            }
        }
Example #25
0
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     if (playlistNameTextBox.Text == "")
     {
         playlistNameTextBox.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Red);
     }
     else
     {
         PlaylistsViewModel ViewModel = (PlaylistsViewModel)DataContext;
         ViewModel.AddPlainPlaylist(playlistNameTextBox.Text);
         FlyoutBase.GetAttachedFlyout(this).Hide();
     }
 }
Example #26
0
        public object Execute(object sender, object parameter)
        {
            FrameworkElement senderElement = sender as FrameworkElement;

            try {
                FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);
                flyoutBase.ShowAt(senderElement);
            }
            catch (Exception ex) {
                //Log.Error("FlyoutBase error: ", ex);
            }
            return(null);
        }
Example #27
0
        private void VerseItem_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            // Show where was clicked
            FrameworkElement senderElement = sender as FrameworkElement;
            var tappedItem = (UIElement)e.OriginalSource;

            // Set highlight
            //VerseListView.SelectedIndex = VerseListView.Items.IndexOf((senderElement).DataContext);

            var attachedFlyout = (MenuFlyout)FlyoutBase.GetAttachedFlyout(senderElement);

            attachedFlyout.ShowAt(tappedItem, e.GetPosition(tappedItem));
        }
 private void EraserFlyoutList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     DrawingToolChanged?.Invoke(this,
                                new DrawingToolChangedEventArgs {
         NewDrawingTool = DrawingTool
     });
     if (StrokeEraseListItem.FocusState != FocusState.Keyboard &&
         CellEraseListItem.FocusState != FocusState.Keyboard)
     {
         var flyout = FlyoutBase.GetAttachedFlyout(EraserButton);
         flyout?.Hide();
     }
 }
Example #29
0
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     if (playlistNameTextBox.Text == "")
     {
         playlistNameTextBox.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Red);
     }
     else
     {
         int id = DatabaseManager.InsertPlainPlaylist(playlistNameTextBox.Text);
         collection.Add(new PlaylistItem(id, false, playlistNameTextBox.Text));
         FlyoutBase.GetAttachedFlyout(this).Hide();
     }
 }
        private void StrokeSizeRadialMenuItem_Invoked(RadialControllerMenuItem sender, object args)
        {
            CurrentRadialSelection = ColoringBookRadialController.StrokeSize;

            // Open flyout and bring focus to slider.
            if (SelectedToolIndex == 1 || SelectedToolIndex == 2)
            {
                RadioButton currentTool = (SelectedToolIndex == 1) ? PenButton : PencilButton;
                var         flyout      = FlyoutBase.GetAttachedFlyout(currentTool);
                flyout.ShowAt(currentTool as FrameworkElement);
                Slider slider = (SelectedToolIndex == 1) ? PenStrokeWidthSlider : PencilStrokeWidthSlider;
                slider.Focus(FocusState.Keyboard);
            }
        }