Beispiel #1
0
        private static void _tooltip_Tapimg(object sender, System.Windows.Input.GestureEventArgs e)
        {
            try
            {
                Image  item             = (Image)sender;
                string selecteditem     = item.Tag.ToString();
                var    selectedparkdata = Global.GlobalData.itinearyList.Where(s => s.itinerary_id.ToString().Equals(selecteditem)).ToList();


                if (selectedparkdata.Count > 0)
                {
                    foreach (var items in selectedparkdata)
                    {
                        ContextMenu contextMenu =
                            ContextMenuService.GetContextMenu(item);
                        contextMenu.DataContext = items;
                        if (contextMenu.Parent == null)
                        {
                            contextMenu.IsOpen = true;
                        }
                        break;
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #2
0
        private void _tooltip_Tapimg(object sender, System.Windows.Input.GestureEventArgs e)
        {
            try
            {
                Image  item             = (Image)sender;
                string selecteditem     = item.Tag.ToString();
                var    selectedparkdata = frequentLMLocations.Where(s => s.Name == selecteditem).ToList();

                if (selectedparkdata.Count > 0)
                {
                    foreach (var items in selectedparkdata)
                    {
                        ContextMenu contextMenu = ContextMenuService.GetContextMenu(item);
                        contextMenu.DataContext = items;
                        if (contextMenu.Parent == null)
                        {
                            contextMenu.IsOpen = true;
                        }
                        break;
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #3
0
        private void ShowOptions(object sender, MouseButtonEventArgs e)
        {
            #region Opening Context Menu
            var cm = ContextMenuService.GetContextMenu(sender as DependencyObject);
            if (cm == null)
            {
                return;
            }
            cm.Placement          = PlacementMode.Bottom;
            cm.PlacementRectangle = new Rect(-200 + Width, Height, 0, 0);
            cm.PlacementTarget    = sender as UIElement;
            cm.IsOpen             = true;
            #endregion

            #region Populating Context Menu
            if (!OptionExists)
            {
                var template = DropDownMenu.Template;
                OptionStack = (StackPanel)template.FindName("OptionStack", DropDownMenu);
                foreach (TextBlock tb in MenuOptions)
                {
                    tb.Style = (Style)rcd["DropDownOptions"];
                    OptionStack.Children.Add(tb);
                }
                OptionExists = true;
            }
            #endregion
        }
        /// <summary>
        /// Called when the template is changed.
        /// </summary>
        public override void OnApplyTemplate()
        {
            // Unhook existing handlers
            if (null != _splitElement)
            {
                _splitElement.MouseEnter -= new MouseEventHandler(SplitElement_MouseEnter);
                _splitElement.MouseLeave -= new MouseEventHandler(SplitElement_MouseLeave);
                _splitElement             = null;
            }
            if (null != _contextMenu)
            {
                _contextMenu.Opened -= new RoutedEventHandler(ContextMenu_Opened);
                _contextMenu.Closed -= new RoutedEventHandler(ContextMenu_Closed);
                _contextMenu         = null;
            }

            // Apply new template
            base.OnApplyTemplate();

            // Hook new event handlers
            _splitElement = GetTemplateChild(SplitElementName) as UIElement;
            if (null != _splitElement)
            {
                _splitElement.MouseEnter += new MouseEventHandler(SplitElement_MouseEnter);
                _splitElement.MouseLeave += new MouseEventHandler(SplitElement_MouseLeave);

                _contextMenu = ContextMenuService.GetContextMenu(_splitElement);
                if (null != _contextMenu)
                {
                    _contextMenu.Opened += new RoutedEventHandler(ContextMenu_Opened);
                    _contextMenu.Closed += new RoutedEventHandler(ContextMenu_Closed);
                }
            }
        }
        private async void _tooltip_Tapimg(object sender, System.Windows.Input.GestureEventArgs e)
        {
            Image  item         = (Image)sender;
            string selecteditem = item.Tag.ToString();
            await WeBallAPI.getFive(selecteditem);

            if (WeBallAPI.Success == false)
            {
                return;
            }
            var selectedparkdata = WeBallAPI.FiveList.Where(s => s._id == selecteditem).ToList();

            if (selectedparkdata.Count > 0)
            {
                foreach (var items in selectedparkdata)
                {
                    ContextMenu contextMenu =
                        ContextMenuService.GetContextMenu(item);
                    contextMenu.DataContext = items;
                    if (contextMenu.Parent == null)
                    {
                        contextMenu.IsOpen = true;
                    }
                    break;
                }
            }
        }
Beispiel #6
0
 public LinkHeader()
 {
     this.IsActionButtonEnabled = true;
     this._blockVisibility      = Visibility.Collapsed;
     this.ActionButtonIcon      = "/Resources/WallPost/CardActions.png";
     this.ActionButtonSize      = 56.0;
     this.ActionButtonAction    = (Action <FrameworkElement>)(e => ContextMenuService.GetContextMenu((DependencyObject)e).IsOpen = true);
 }
Beispiel #7
0
        void MenuTopLevelClick(object sender, RoutedEventArgs e)
        {
            var menu = ContextMenuService.GetContextMenu((Button)sender);

            if (menu != null)
            {
                menu.IsOpen = true;
            }
        }
Beispiel #8
0
        public void ShowMenu()
        {
            ContextMenu contextMenu = ContextMenuService.GetContextMenu((DependencyObject)this);

            if (contextMenu == null)
            {
                return;
            }
            contextMenu.IsOpen = true;
        }
Beispiel #9
0
        private void OnPresetFolderMenuClick(object sender, RoutedEventArgs e)
        {
            var         menuButton = (Button)sender;
            var         parentGrid = (Grid)menuButton.Parent;
            ContextMenu folderMenu = ContextMenuService.GetContextMenu(parentGrid);

            folderMenu.PlacementTarget = menuButton;
            folderMenu.Placement       = PlacementMode.Bottom;
            folderMenu.IsOpen          = true;
        }
Beispiel #10
0
        private void OnMoreOptionsTap()
        {
            ContextMenu contextMenu = ContextMenuService.GetContextMenu((DependencyObject)this._header.View);

            if (contextMenu == null)
            {
                return;
            }
            contextMenu.IsOpen = true;
        }
Beispiel #11
0
        private void Border_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            Border      border      = sender as Border;
            ContextMenu contextMenu = ContextMenuService.GetContextMenu(border);

            if (contextMenu.Parent == null)
            {
                contextMenu.IsOpen = true;
            }
        }
Beispiel #12
0
 private void MainButton_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
 {
     //TODO: *Usually* this is enough, but sometimes the positioning gets off, and it stays where the last context menu was.
     //Not really sure why, but I guess we should set the context menu location here too?
     ContextMenuService.GetContextMenu((Rectangle)sender).IsOpen = true;
     if (e != null)
     {
         e.Handled = true;
     }
 }
        private void GestureListener_Tap(object sender, GestureEventArgs e)
        {
            Border      border      = sender as Border;
            ContextMenu contextMenu = ContextMenuService.GetContextMenu(border);

            if (contextMenu.Parent == null)
            {
                contextMenu.IsOpen = true;
            }
        }
Beispiel #14
0
        public void OnMoreOptionsTap()
        {
            ContextMenu contextMenu = ContextMenuService.GetContextMenu((DependencyObject)this._originalHeaderItem.View);

            if (contextMenu == null)
            {
                return;
            }
            contextMenu.IsOpen = true;
        }
Beispiel #15
0
        private void ShowMenu()
        {
            ContextMenu contextMenu = ContextMenuService.GetContextMenu((DependencyObject)this.gridHeader);

            if (contextMenu == null)
            {
                return;
            }
            contextMenu.IsOpen = true;
        }
Beispiel #16
0
        private void OnArrowClick(object sender, RoutedEventArgs e)
        {
            var buttonMenu = ContextMenuService.GetContextMenu(this.button);

            if (this.menuItemsSource.Count > 0 && buttonMenu != null)
            {
                buttonMenu.IsOpen          = !buttonMenu.IsOpen;
                buttonMenu.PlacementTarget = this.button;
                buttonMenu.Placement       = PlacementMode.Bottom;
            }
        }
Beispiel #17
0
        public void OnMoreOptionsTap()
        {
            UserOrGroupHeaderItem orGroupHeaderItem = this._headerItem;
            ContextMenu           contextMenu       = ContextMenuService.GetContextMenu(orGroupHeaderItem != null ? (DependencyObject)(orGroupHeaderItem.View) : null);

            if (contextMenu == null)
            {
                return;
            }
            contextMenu.IsOpen = true;
        }
Beispiel #18
0
        /// <summary>
        /// Called when the template is changed.
        /// </summary>
        public override void OnApplyTemplate()
        {
            // Unhook existing handlers
            if (null != _splitElement)
            {
                _splitElement.MouseEnter -= new MouseEventHandler(SplitElement_MouseEnter);
                _splitElement.MouseLeave -= new MouseEventHandler(SplitElement_MouseLeave);
                _splitElement             = null;
            }
            if (null != _contextMenu)
            {
                _contextMenu.Opened -= new RoutedEventHandler(ContextMenu_Opened);
                _contextMenu.Closed -= new RoutedEventHandler(ContextMenu_Closed);
                _contextMenu         = null;
            }
#if !SILVERLIGHT
            if (null != _logicalChild)
            {
                RemoveLogicalChild(_logicalChild);
                _logicalChild = null;
            }
#endif

            // Apply new template
            base.OnApplyTemplate();

            // Hook new event handlers
            _splitElement = GetTemplateChild(SplitElementName) as UIElement;
            if (null != _splitElement)
            {
                _splitElement.MouseEnter += new MouseEventHandler(SplitElement_MouseEnter);
                _splitElement.MouseLeave += new MouseEventHandler(SplitElement_MouseLeave);

                _contextMenu = ContextMenuService.GetContextMenu(_splitElement);
                if (null != _contextMenu)
                {
#if !SILVERLIGHT
                    // Add the ContextMenu as a logical child (for DataContext and RoutedCommands)
                    _contextMenu.IsOpen = true;
                    DependencyObject current = _contextMenu;
                    do
                    {
                        _logicalChild = current;
                        current       = LogicalTreeHelper.GetParent(current);
                    } while (null != current);
                    _contextMenu.IsOpen = false;
                    AddLogicalChild(_logicalChild);
#endif

                    _contextMenu.Opened += new RoutedEventHandler(ContextMenu_Opened);
                    _contextMenu.Closed += new RoutedEventHandler(ContextMenu_Closed);
                }
            }
        }
Beispiel #19
0
        private void WatchingNowGrid_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            Grid temp = (Grid)sender;

            ContextMenu contextMenu = ContextMenuService.GetContextMenu(temp);

            if (contextMenu.Parent == null)
            {
                contextMenu.IsOpen = true;
            }
        }
Beispiel #20
0
        private void Button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Button           button = (Button)sender;
            AdapterViewModel avm    = button.DataContext as AdapterViewModel;

            if (avm != null)
            {
                var menu = ContextMenuService.GetContextMenu(button);
                menu.DataContext = avm;
                menu.IsOpen      = true;
            }
        }
        /// <summary>
        ///     Called when the template is changed.
        /// </summary>
        public override void OnApplyTemplate()
        {
            // Unhook existing handlers
            if (this.splitElement != null)
            {
                this.splitElement.MouseEnter -= this.SplitElement_MouseEnter;
                this.splitElement.MouseLeave -= this.SplitElement_MouseLeave;
                this.splitElement             = null;
            }
            if (this.contextMenu != null)
            {
                this.contextMenu.Opened -= this.ContextMenu_Opened;
                this.contextMenu.Closed -= this.ContextMenu_Closed;
                this.contextMenu         = null;
            }

            if (this.logicalChild != null)
            {
                this.RemoveLogicalChild(this.logicalChild);
                this.logicalChild = null;
            }

            // Apply new template
            base.OnApplyTemplate();

            // Hook new event handlers
            this.splitElement = this.GetTemplateChild(SplitElementName) as UIElement;
            if (this.splitElement != null)
            {
                this.splitElement.MouseEnter += this.SplitElement_MouseEnter;
                this.splitElement.MouseLeave += this.SplitElement_MouseLeave;

                this.contextMenu = ContextMenuService.GetContextMenu(this.splitElement);
                if (this.contextMenu != null)
                {
                    // Add the ContextMenu as a logical child (for DataContext and RoutedCommands)
                    this.contextMenu.Visibility = Visibility.Collapsed;
                    this.contextMenu.IsOpen     = true;
                    DependencyObject current = this.contextMenu;
                    do
                    {
                        this.logicalChild = current;
                        current           = LogicalTreeHelper.GetParent(current);
                    }while (null != current);

                    this.contextMenu.IsOpen = false;
                    this.AddLogicalChild(this.logicalChild);

                    this.contextMenu.Opened += this.ContextMenu_Opened;
                    this.contextMenu.Closed += this.ContextMenu_Closed;
                }
            }
        }
        public void OnMoreOptionsTap()
        {
            UserOrGroupHeaderItem headerItem = this._headerItem;
            // ISSUE: explicit non-virtual call
            ContextMenu contextMenu = ContextMenuService.GetContextMenu(headerItem != null ?  headerItem.View :  null);

            if (contextMenu == null)
            {
                return;
            }
            contextMenu.IsOpen = true;
        }
Beispiel #23
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button btn     = sender as Button;
            Grid   gParent = btn.Parent as Grid;

            ContextMenu contextMenu = null;

            contextMenu = ContextMenuService.GetContextMenu(gParent);

            if (contextMenu == null)
            {
                contextMenu     = new ContextMenu();
                contextMenu.Tag = btn.CommandParameter;

                MenuItem miBuy = new MenuItem()
                {
                    Background = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush, Foreground = new SolidColorBrush(Colors.White), Header = "buy tickets"
                };
                miBuy.Click += this.BuyTickets_MenuItem_Click;
                miBuy.Click += this.LogBookingStats;
                contextMenu.Items.Add(miBuy);

                MenuItem miSpacer = new MenuItem();
                contextMenu.Items.Add(miSpacer);

                MenuItem miSMS = new MenuItem()
                {
                    Background = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush, Foreground = new SolidColorBrush(Colors.White), Header = "sms"
                };
                miSMS.Click += this.SMS_MenuItem_Click;
                contextMenu.Items.Add(miSMS);

                MenuItem miEmail = new MenuItem()
                {
                    Background = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush, Foreground = new SolidColorBrush(Colors.White), Header = "email"
                };
                miEmail.Click += this.Email_MenuItem_Click;
                contextMenu.Items.Add(miEmail);

                MenuItem miSocial = new MenuItem()
                {
                    Background = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush, Foreground = new SolidColorBrush(Colors.White), Header = "social networks"
                };
                miSocial.Click += this.SocialNetworks_MenuItem_Click;
                contextMenu.Items.Add(miSocial);

                ContextMenuService.SetContextMenu(gParent, contextMenu);
            }

            contextMenu.IsOpen = true;
        }
Beispiel #24
0
        private void GestureListener_Tap_1(object sender, GestureEventArgs e)
        {
            if (lastModel == null)
            {
                Grid temp = (Grid)sender;

                ContextMenu contextMenu = ContextMenuService.GetContextMenu(temp);

                if (contextMenu.Parent == null)
                {
                    contextMenu.IsOpen = true;
                }
            }
        }
Beispiel #25
0
        /**
         * 컨텍스트 메뉴 강제 로드
         * */
        private void LockscreenImage_Tap(object sender, RoutedEventArgs e)
        {
            Grid        grid        = sender as Grid;
            ContextMenu contextMenu = ContextMenuService.GetContextMenu(grid);

            if (contextMenu.Parent == null)
            {
                contextMenu.IsOpen = true;
                (grid.DataContext as PhonePicture).Opacity = 0.6;
                //멀티 셀렉트 삭제와 일관성이 떨어진다.
                //MenuItem rmItem = (contextMenu.Items as System.Windows.Controls.ItemCollection).First(x => (x as Microsoft.Phone.Controls.MenuItem).Name == "RemoveMenu") as MenuItem;
                //rmItem.IsEnabled = (grid.DataContext as PhonePicture).CurrentLockscreen == null;
            }
        }
Beispiel #26
0
        private void Pushpin_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            var         _ppmodel    = sender as Pushpin;
            ContextMenu contextMenu =
                ContextMenuService.GetContextMenu(_ppmodel);

            contextMenu.DataContext = listapinchos.Where
                                          (c => (c.posicion
                                                 == _ppmodel.GeoCoordinate)).FirstOrDefault();
            if (contextMenu.Parent == null)
            {
                contextMenu.IsOpen = true;
            }
        }
Beispiel #27
0
        public override void OnApplyTemplate()
        {
            // Unhook existing handlers
            if (null != _splitElement)
            {
                _splitElement = null;
            }
            if (null != _contextMenu)
            {
                _contextMenu.Opened -= new RoutedEventHandler(ContextMenu_Opened);
                _contextMenu.Closed -= new RoutedEventHandler(ContextMenu_Closed);
                _contextMenu         = null;
            }
            if (null != _logicalChild)
            {
                RemoveLogicalChild(_logicalChild);
                _logicalChild = null;
            }

            // Apply new template
            base.OnApplyTemplate();

            // Hook new event handlers
            _splitElement = GetTemplateChild(SplitElementName) as UIElement;
            if (null != _splitElement)
            {
                _contextMenu = ContextMenuService.GetContextMenu(_splitElement);
                if (null != _contextMenu)
                {
                    // Add the ContextMenu as a logical child (for DataContext and RoutedCommands)
                    _contextMenu.IsOpen = true;
                    DependencyObject current = _contextMenu;
                    do
                    {
                        _logicalChild = current;
                        current       = LogicalTreeHelper.GetParent(current);
                    } while (null != current);
                    _contextMenu.IsOpen = false;
                    AddLogicalChild(_logicalChild);

                    _contextMenu.Opened += new RoutedEventHandler(ContextMenu_Opened);
                    _contextMenu.Closed += new RoutedEventHandler(ContextMenu_Closed);
                }
            }

            var button = (Button)Template.FindName("Chrome", this);

            button.PreviewMouseLeftButtonDown += button_MouseLeftButtonDown;
            CommandBindings.Add(new CommandBinding(ApplyAction, Apply));
        }
        // Sample code for building a localized ApplicationBar
        //private void BuildLocalizedApplicationBar()
        //{
        //    // Set the page's ApplicationBar to a new instance of ApplicationBar.
        //    ApplicationBar = new ApplicationBar();

        //    // Create a new button and set the text value to the localized string from AppResources.
        //    ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
        //    appBarButton.Text = AppResources.AppBarButtonText;
        //    ApplicationBar.Buttons.Add(appBarButton);

        //    // Create a new menu item with the localized string from AppResources.
        //    ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
        //    ApplicationBar.MenuItems.Add(appBarMenuItem);
        //}
        private void Pushpin_OnTap(object sender, GestureEventArgs e)
        {
            var ppmodel = sender as Pushpin;
            //Place p = placeList.FirstOrDefault(pl => ppmodel != null && pl.Coordinate == ppmodel.GeoCoordinate);
            ItemViewModel p = App.ViewModel.Items.FirstOrDefault(pl => ppmodel != null && pl.Coordinate == ppmodel.GeoCoordinate);
            //myMap.SetView(new GeoCoordinate(p.Latitude, p.Longitude), 12);
            ContextMenu contextMenu = ContextMenuService.GetContextMenu(ppmodel);

            contextMenu.DataContext = App.ViewModel.Items.FirstOrDefault(c => ppmodel != null && (c.Coordinate == ppmodel.GeoCoordinate));

            if (contextMenu.Parent == null)
            {
                contextMenu.IsOpen = true;
            }
        }
Beispiel #29
0
        private void ShowOptions(object sender, MouseButtonEventArgs e)
        {
            #region Opening Context Menu
            var cm = ContextMenuService.GetContextMenu(sender as DependencyObject);
            if (cm == null)
            {
                return;
            }
            cm.Placement       = PlacementMode.Bottom;
            cm.PlacementTarget = sender as UIElement;
            cm.IsOpen          = true;
            #endregion

            #region

            #endregion
        }
Beispiel #30
0
 private void NameGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     //TODO: *Usually* this is enough, but sometimes the positioning gets off, and it stays where the last context menu was.
     //Not really sure why, but I guess we should set the context menu location here too?
     ContextMenuService.GetContextMenu(NameGrid).IsOpen = true;
     if (MainPage.Instance.UpgradeListOpen)
     {
         ContextRemoveItemFromUpgradeList.Visibility = Visibility.Visible;
     }
     else
     {
         ContextRemoveItemFromUpgradeList.Visibility = Visibility.Collapsed;
     }
     if (e != null)
     {
         e.Handled = true;
     }
 }