private static void OnLostMouseCapture(object sender, MouseEventArgs e)
        {
            GroupNavigationControl groupNavigationControl = ( GroupNavigationControl )sender;

            DependencyObject originalSource = e.OriginalSource as DependencyObject;

            if (Mouse.Captured != groupNavigationControl)
            {
                if (e.OriginalSource == groupNavigationControl)
                {
                    if ((Mouse.Captured == null) &&
                        (Xceed.Utils.Wpf.TreeHelper.IsDescendantOf(originalSource, groupNavigationControl)))
                    {
                        groupNavigationControl.Close();
                    }
                }
                else if ((originalSource != null) && (Xceed.Utils.Wpf.TreeHelper.IsDescendantOf(originalSource, groupNavigationControl)))
                {
                    if ((groupNavigationControl.IsDropDownOpen) && (Mouse.Captured == null))
                    {
                        Mouse.Capture(groupNavigationControl, CaptureMode.SubTree);
                        e.Handled = true;
                    }
                }
                else
                {
                    groupNavigationControl.Close();
                }
            }
        }
        private static void OnIsDropDownOpenChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            GroupNavigationControl groupNavigationControl = ( GroupNavigationControl )sender;

            if (( bool )e.NewValue)
            {
                // To avoid lag while generating the control, we do
                // a late binding of the items.
                if (groupNavigationControl.ItemsSource == null)
                {
                    Group group = groupNavigationControl.DataContext as Group;
                    if (group != null)
                    {
                        groupNavigationControl.ItemsSource = group.SiblingGroups;
                    }
                }

                Mouse.Capture(groupNavigationControl, CaptureMode.SubTree);
            }
            else
            {
                groupNavigationControl.ItemsSource = null;

                if (groupNavigationControl.IsKeyboardFocusWithin)
                {
                    groupNavigationControl.Focus();
                }

                if (Mouse.Captured == groupNavigationControl)
                {
                    Mouse.Capture(null);
                }
            }
        }
        private static void OnMouseWheel(object sender, MouseWheelEventArgs e)
        {
            GroupNavigationControl groupNavigationControl = ( GroupNavigationControl )sender;

            if (groupNavigationControl.IsDropDownOpen)
            {
                // This is to avoid scrolling any other list if the drop down is open.
                // If not set, the grid could scroll while leaving the drop down in view.
                // The dorp down will then be left alone while the GroupNavigationControl
                // might not be in view anymore.
                e.Handled = true;
            }
        }
        private static void OnPreviewMouseButtonDown(object sender, MouseButtonEventArgs e)
        {
            GroupNavigationControl groupNavigationControl = ( GroupNavigationControl )sender;
            Visual originalSource = e.OriginalSource as Visual;

            if ((originalSource != null) &&
                (groupNavigationControl.PartButton != null) &&
                (groupNavigationControl.PartButton.IsAncestorOf(originalSource)))
            {
                if (groupNavigationControl.IsDropDownOpen)
                {
                    groupNavigationControl.Close();
                }
            }
        }
        private static void OnMouseButtonDown(object sender, MouseButtonEventArgs e)
        {
            GroupNavigationControl groupNavigationControl = ( GroupNavigationControl )sender;

            if (!groupNavigationControl.IsKeyboardFocusWithin)
            {
                groupNavigationControl.Focus();
            }

            e.Handled = true;

            if ((Mouse.Captured == groupNavigationControl) && (e.OriginalSource == groupNavigationControl))
            {
                groupNavigationControl.Close();
            }
        }
        private static void OnParentGridControlChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            GroupNavigationControl groupNavigationControl = sender as GroupNavigationControl;

            if (groupNavigationControl == null)
            {
                return;
            }

            DataGridControl parentGridControl = e.NewValue as DataGridControl;

            if (parentGridControl == null)
            {
                return;
            }

            groupNavigationControl.PrepareDefaultStyleKey(parentGridControl.GetView());
        }
 public GroupNavigationControlItem(GroupNavigationControl parentNavigationControl)
 {
     this.ParentNavigationControl = parentNavigationControl;
 }
 public GroupNavigationControlItem( GroupNavigationControl parentNavigationControl )
 {
   this.ParentNavigationControl = parentNavigationControl;
 }