Exemplo n.º 1
0
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code
        /// or internal processes call System.Windows.FrameworkElement.ApplyTemplate().
        /// </summary>
        public override void OnApplyTemplate()
        {
            this.UnSubscribeEvents();

            // Clear cache
            cachedMeasures.Clear();

            LauncherButton = GetTemplateChild("PART_DialogLauncherButton") as Button;

            if (LauncherButton != null)
            {
                if (LauncherKeys != null)
                {
                    KeyTip.SetKeys(LauncherButton, LauncherKeys);
                }
            }

            popup = GetTemplateChild("PART_Popup") as Popup;

            downGrid    = GetTemplateChild("PART_DownGrid") as Grid;
            upPanel     = GetTemplateChild("PART_UpPanel") as Panel;
            parentPanel = GetTemplateChild("PART_ParentPanel") as Panel;

            snappedImage = GetTemplateChild("PART_SnappedImage") as Image;

            this.SubscribeEvents();
        }
Exemplo n.º 2
0
        static void OnDialogLauncherButtonKeyTipKeysChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RibbonGroupBox ribbonGroupBox = (RibbonGroupBox)d;

            if (ribbonGroupBox.LauncherButton != null)
            {
                KeyTip.SetKeys(ribbonGroupBox.LauncherButton, (string)e.NewValue);
            }
        }
Exemplo n.º 3
0
        // Updates keys for keytip access
        private void UpdateKeyTips()
        {
            for (var i = 0; i < Math.Min(9, Items.Count); i++)
            {
                // 1, 2, 3, ... , 9
                KeyTip.SetKeys(Items[i], (i + 1).ToString(CultureInfo.InvariantCulture));
            }

            for (var i = 9; i < Math.Min(18, Items.Count); i++)
            {
                // 09, 08, 07, ... , 01
                KeyTip.SetKeys(Items[i], "0" + (18 - i).ToString(CultureInfo.InvariantCulture));
            }

            var startChar = 'A';

            for (var i = 18; i < Math.Min(9 + 9 + 26, Items.Count); i++)
            {
                // 0A, 0B, 0C, ... , 0Z
                KeyTip.SetKeys(Items[i], "0" + startChar++);
            }
        }