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 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();
            }
        }