示例#1
0
        public KeyboardButton(Key key) : base()
        {
            Presenter     = new KeyboardButtonPresenter();
            TabTravesable = null;
            var caption = Nodes.First(i => i.Id == "TextPresenter") as SimpleText;

            caption.VAlignment = VAlignment.Bottom;
            caption.HAlignment = HAlignment.Left;
            caption.Padding    = new Thickness(5, 2);
            caption.TextColor  = ColorTheme.Current.Keyboard.GrayText;
            commandName        = new SimpleText {
                TextColor    = ColorTheme.Current.Keyboard.BlackText,
                FontHeight   = Theme.Metrics.TextHeight,
                HAlignment   = HAlignment.Left,
                VAlignment   = VAlignment.Top,
                OverflowMode = TextOverflowMode.Ellipsis,
                Padding      = new Thickness(5, 2)
            };
            Nodes.Add(commandName);
            commandName.ExpandToContainerWithAnchors();
            commandName.Height -= caption.FontHeight;

            Key = key;
            (Presenter as KeyboardButtonPresenter).IsModifier = Key.IsModifier();
            State = KeyboardButtonState.None;
        }