Assumptions: o The child elements are on a circle. The children will be centered respective to a point they provide (MenuKillerItems), otherwise to their center. o There is a multitude of options on how the panel is supposed to behave, but within the arrange and measure methods, this information is compressed into very few variables.
Inheritance: System.Windows.Controls.Panel, ICustomAlignedControl
Esempio n. 1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // NOTE: Do not use GetTemplateChild(), because it will only find direct descendants.
            // Also refer to the MSDN Comment of GetTemplateChild() (shown in IntelliSense).
            // This is a common mistake.
            //
            // NOTE: FindName() also exist for this (from FrameworkElement), but we want to find
            // on the _template_
            mCenterButton = Template.FindName("PART_Button", this) as Button;

            if (null != mCenterButton)
            {
                mCenterButton.Click      += new System.Windows.RoutedEventHandler(mCenterButton_Click);
                mCenterButton.MouseEnter += new MouseEventHandler(MenuKillerItem_MouseEnter);
            }

            mPanel = Template.FindName("PART_Panel", this) as CircularPanel;

            mAlignPanel = Template.FindName("PART_AlignPanel", this) as ReferenceAlignPanel;

            if (null != mPanel)
            {
                mPanel.ChildArranged += new CircularPanel.OnChildArranged(mPanel_ChildArranged);
            }
        }
Esempio n. 2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // NOTE: Do not use GetTemplateChild(), because it will only find direct descendants.
            // Also refer to the MSDN Comment of GetTemplateChild() (shown in IntelliSense).
            // This is a common mistake.
            //
            // NOTE: FindName() also exist for this (from FrameworkElement), but we want to find
            // on the _template_
            mCenterButton = Template.FindName("PART_Button", this) as Button;

            if (null != mCenterButton)
            {
                mCenterButton.Click += new System.Windows.RoutedEventHandler(mCenterButton_Click);
                mCenterButton.MouseEnter += new MouseEventHandler(MenuKillerItem_MouseEnter);
            }

            mPanel = Template.FindName("PART_Panel", this) as CircularPanel;

            mAlignPanel = Template.FindName("PART_AlignPanel", this) as ReferenceAlignPanel;

            if (null != mPanel)
            {
                mPanel.ChildArranged += new CircularPanel.OnChildArranged(mPanel_ChildArranged);
            }
        }