예제 #1
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            if (VisualTreeHelper.GetChildrenCount(this) > 0)
            {
                FrameworkElement FirstChild;
                if ((FirstChild = VisualTreeHelper.GetChild(this, 0) as FrameworkElement) != null)
                {
                    ToggleButton AddRemoveButton;
                    if ((AddRemoveButton = FirstChild.FindName("AddRemoveButton") as ToggleButton) != null)
                    {
                        AddRemoveButton.Checked += OnAddRemoveButtonChecked;
                    }

                    ToggleButton OverflowButton;
                    if ((OverflowButton = FirstChild.FindName("OverflowButton") as ToggleButton) != null)
                    {
                        OverflowButton.Unchecked += OnOverflowButtonUnchecked;
                    }

                    MenuItem ResetToolBarMenuItem;
                    if ((ResetToolBarMenuItem = FirstChild.FindName("ResetToolBarMenuItem") as MenuItem) != null)
                    {
                        ResetToolBarMenuItem.Click += OnResetToolBarClicked;
                    }
                }
            }
        }
예제 #2
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            if (VisualTreeHelper.GetChildrenCount(this) > 0)
            {
                if (VisualTreeHelper.GetChild(this, 0) is FrameworkElement FirstChild)
                {
                    if (FirstChild.FindName("AddRemoveButton") is ToggleButton AddRemoveButton)
                    {
                        AddRemoveButton.Checked += OnAddRemoveButtonChecked;
                    }

                    if (FirstChild.FindName("OverflowButton") is ToggleButton OverflowButton)
                    {
                        OverflowButton.Unchecked += OnOverflowButtonUnchecked;
                    }

                    if (FirstChild.FindName("ResetToolBarMenuItem") is MenuItem ResetToolBarMenuItem)
                    {
                        ResetToolBarMenuItem.Click += OnResetToolBarClicked;
                    }
                }
            }
        }