예제 #1
0
        /// <summary>
        /// Close the group popup.
        /// </summary>
        /// <param name="selectedGroup">The selected group.</param>
        /// <param name="raiseEvent">Should the GroupPopupClosing event be raised.</param>
        /// <returns>True if the event was not raised or if it was raised and e.Handled is false.</returns>
        private bool ClosePopup(object selectedGroup, bool raiseEvent)
        {
            if (raiseEvent)
            {
                GroupViewClosingEventArgs args = null;

                SafeRaise.Raise(GroupViewClosing, this, () => { return(args = new GroupViewClosingEventArgs(_itemsControl, selectedGroup)); });

                if (args != null && args.Cancel)
                {
                    return(false);
                }
            }

            if (_groupSelectorPopup != null)
            {
                RestoreSystemState();
                _groupSelectorPopup.IsOpen = false;
                DetachFromPageEvents();
                _groupSelectorPopup.Child = null;
                _border             = null;
                _itemsControl       = null;
                _groupSelectorPopup = null;
            }

            return(true);
        }
예제 #2
0
        private void OpenPopup()
        {
            SaveSystemState(false, false);
            BuildPopup();
            AttachToPageEvents();
            _groupSelectorPopup.IsOpen = true;

            // This has to happen eventually anyway, and this forces the ItemsControl to
            // expand it's template, populate it's items etc.
            UpdateLayout();


            SafeRaise.Raise(GroupViewOpened, this, () => { return(new GroupViewOpenedEventArgs(_itemsControl)); });
        }
        /// <summary>
        /// This method does all the necessary work to raise a gesture event. It sets the orginal source, does the routing,
        /// handles Handled, and only creates the event args if they are needed.
        /// </summary>
        /// <typeparam name="T">This is the type of event args that will be raised.</typeparam>
        /// <param name="eventGetter">Gets the specific event to raise.</param>
        /// <param name="argsGetter">Lazy creator function for the event args.</param>
        /// <param name="releaseMouseCapture">Indicates whether the mouse capture should be released </param>
        private static void RaiseGestureEvent <T>(
            Func <GestureListener, EventHandler <T> > eventGetter,
            Func <T> argsGetter, bool releaseMouseCapture)
            where T : GestureEventArgs
        {
            T args = null;

            FrameworkElement originalSource = null;
            bool             handled        = false;

            foreach (FrameworkElement element in _elements)
            {
                if (releaseMouseCapture)
                {
                    element.ReleaseMouseCapture();
                }

                if (!handled)
                {
                    if (originalSource == null)
                    {
                        originalSource = element;
                    }

                    GestureListener helper = GestureService.GetGestureListenerInternal(element, false);
                    if (helper != null)
                    {
                        SafeRaise.Raise(eventGetter(helper), element, () =>
                        {
                            if (args == null)
                            {
                                args = argsGetter();
                                args.OriginalSource = originalSource;
                            }
                            return(args);
                        });
                    }

                    if (args != null && args.Handled == true)
                    {
                        handled = true;
                    }
                }
            }
        }
 /// <summary>
 /// Mirrors the
 /// <see cref="E:System.Windows.Controls.Primitives.ToggleButton.Click"/>
 /// event.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event information.</param>
 private void OnClick(object sender, RoutedEventArgs e)
 {
     SafeRaise.Raise(Click, this, e);
 }
 /// <summary>
 /// Mirrors the
 /// <see cref="E:System.Windows.Controls.Primitives.ToggleButton.Indeterminate"/>
 /// event.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event information.</param>
 private void OnIndeterminate(object sender, RoutedEventArgs e)
 {
     IsChecked = null;
     SafeRaise.Raise(Indeterminate, this, e);
 }
 /// <summary>
 /// Mirrors the
 /// <see cref="E:System.Windows.Controls.Primitives.ToggleButton.Unchecked"/>
 /// event.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event information.</param>
 private void OnUnchecked(object sender, RoutedEventArgs e)
 {
     IsChecked = false;
     SafeRaise.Raise(Unchecked, this, e);
 }
 /// <summary>
 /// Mirrors the
 /// <see cref="E:System.Windows.Controls.Primitives.ToggleButton.Checked"/>
 /// event.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event information.</param>
 private void OnChecked(object sender, RoutedEventArgs e)
 {
     IsChecked = true;
     SafeRaise.Raise(Checked, this, e);
 }
예제 #8
0
 private void popup_Opened(object sender, EventArgs e)
 {
     SafeRaise.Raise(GroupViewOpened, this, () => { return(new GroupViewOpenedEventArgs(_itemsControl)); });
 }
예제 #9
0
 /// <summary>
 /// Mirrors the
 /// <see cref="E:System.Windows.Controls.Primitives.ToggleButton.Click"/>
 /// event.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event information.</param>
 private void ClickHandler(object sender, RoutedEventArgs e)
 {
     SafeRaise.Raise(Click, this, e);
 }