public VirtualKey(VirtualKeyboard keyboard, KeySet keySet, KeySetRow row, Key key)
        {
            _keyboard = keyboard;
            _keySet = keySet;
            _key = key;

            if (row.IndexOf(key) < row.Count/2)
                _popupFlowDirection = FlowDirection.LeftToRight;
            else
                _popupFlowDirection = FlowDirection.RightToLeft;

            PrimaryAction = new VirtualKeyAction(keyboard, keySet, key.DefaultAction, key.Width);
            Loaded += (s, e) =>
            {
                if (AlternativesPopup != null)
                {
                    if (_popupFlowDirection == FlowDirection.LeftToRight)
                    {
                        AlternativesPopup.HorizontalOffset = -ActualWidth;
                        AlternativesPopup.Placement = PlacementMode.Right;
                    }
                    else
                    {
                        AlternativesPopup.HorizontalOffset = ActualWidth;
                        AlternativesPopup.Placement = PlacementMode.Left;
                    }
                }
            };
        }
Пример #2
0
        public VirtualKey(VirtualKeyboard keyboard, KeySet keySet, KeySetRow row, Key key)
        {
            _keyboard = keyboard;
            _keySet   = keySet;
            _key      = key;

            if (row.IndexOf(key) < row.Count / 2)
            {
                _popupFlowDirection = FlowDirection.LeftToRight;
            }
            else
            {
                _popupFlowDirection = FlowDirection.RightToLeft;
            }

            PrimaryAction = new VirtualKeyAction(keyboard, keySet, key.DefaultAction, key.Width);
            Loaded       += (s, e) =>
            {
                if (AlternativesPopup != null)
                {
                    if (_popupFlowDirection == FlowDirection.LeftToRight)
                    {
                        AlternativesPopup.HorizontalOffset = -ActualWidth;
                        AlternativesPopup.Placement        = PlacementMode.Right;
                    }
                    else
                    {
                        AlternativesPopup.HorizontalOffset = ActualWidth;
                        AlternativesPopup.Placement        = PlacementMode.Left;
                    }
                }
            };
        }