Microsoft.Silverlight.Testing.Controls.TreeViewItem.OnHeaderMouseLeftButtonDown C# (CSharp) Method

OnHeaderMouseLeftButtonDown() private method

Provides handling for the Header's MouseLeftButtonDown event.
private OnHeaderMouseLeftButtonDown ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void
sender object The Header template part.
e System.Windows.Input.MouseButtonEventArgs Event arguments.
return void
        private void OnHeaderMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (Interaction.AllowMouseLeftButtonDown(e))
            {
                // If the event hasn't already been handled and this item is
                // focusable, then focus (and possibly expand if it was double
                // clicked)
                if (!e.Handled && IsEnabled)
                {
                    if (Focus())
                    {
                        e.Handled = true;
                    }

                    // Expand the item when double clicked
                    if (Interaction.ClickCount % 2 == 0)
                    {
                        bool opened = !IsExpanded;
                        UserInitiatedExpansion |= opened;
                        IsExpanded = opened;

                        e.Handled = true;
                    }
                }

                Interaction.OnMouseLeftButtonDownBase();
                OnMouseLeftButtonDown(e);
            }
        }