Beispiel #1
0
        private void SetAnchor()
        {
            switch (nodePart)
            {
            case NodePart.NorthEast:
                this.anchor = MenuItemAnchor.BottomLeft;
                break;

            case NodePart.North:
            case NodePart.NorthWest:
                this.anchor = MenuItemAnchor.BottomRight;
                break;

            case NodePart.South:
                this.anchor = MenuItemAnchor.TopRight;
                break;

            default:
                this.anchor = MenuItemAnchor.BottomLeft;
                break;
            }
        }
Beispiel #2
0
        internal MenuItemInfo(string menuText, string keyword, MenuItemAnchor anchor)
        {
            FormattedText geomItem = new FormattedText(menuText,
                                                       Configurations.culture,
                                                       FlowDirection.LeftToRight,
                                                       Configurations.TypeFace,
                                                       Configurations.MinimumTextSize,
                                                       this.color);

            if (this.SetKeyword(keyword, menuText))
            {
                geomItem.SetFontWeight(FontWeights.UltraBlack, this.keywordStartIndex, keyword.Length);
            }
            double length = geomItem.WidthIncludingTrailingWhitespace;

            this.currentPosition  = new Point(0, 0);
            this.previousPosition = new Point(0, 0);
            this.anchor           = anchor;
            this.ItemPosition     = new Point(0, 0);
            this.ItemLength       = length;
            double rectHeight = (Configurations.MinimumTextSize + Configurations.MaxHeightIncrement);

            //Each item has a trailing and leading rectangle which is painted with a linear gradient
            //from transparent to white.
            Rect background   = new Rect(this.ItemPosition, new Size(this.ItemLength, rectHeight));
            Rect rectTrailing = new Rect(this.ItemPosition, new Size(Configurations.EndRectangleLength, rectHeight));
            Rect rectLeading  = new Rect(this.ItemPosition, new Size(Configurations.EndRectangleLength, rectHeight));

            this.color = Configurations.NormalTextColor;

            itemGeometry.text = geomItem.BuildGeometry(this.ItemPosition);
            itemGeometry.rectangleTrailing = new RectangleGeometry(rectTrailing);
            itemGeometry.rectangleLeading  = new RectangleGeometry(rectLeading);
            itemGeometry.background        = new RectangleGeometry(background);

            geometry        = geomItem.BuildGeometry(this.ItemPosition);
            this.ItemHeight = Configurations.MinimumTextSize;
        }
Beispiel #3
0
        internal MenuItemInfo(string menuText, string keyword, MenuItemAnchor anchor)
        {
            FormattedText geomItem = new FormattedText(menuText,
                     Configurations.culture,
                     FlowDirection.LeftToRight,
                     Configurations.TypeFace,
                     Configurations.MinimumTextSize,
                     this.color);

            if (this.SetKeyword(keyword, menuText))
                geomItem.SetFontWeight(FontWeights.UltraBlack, this.keywordStartIndex, keyword.Length);
            double length = geomItem.WidthIncludingTrailingWhitespace;
            this.currentPosition = new Point(0, 0);
            this.previousPosition = new Point(0, 0);
            this.anchor = anchor;
            this.ItemPosition = new Point(0, 0);
            this.ItemLength = length;
            double rectHeight = (Configurations.MinimumTextSize + Configurations.MaxHeightIncrement);

            //Each item has a trailing and leading rectangle which is painted with a linear gradient
            //from transparent to white.
            Rect background = new Rect(this.ItemPosition, new Size(this.ItemLength, rectHeight));
            Rect rectTrailing = new Rect(this.ItemPosition, new Size(Configurations.EndRectangleLength, rectHeight));
            Rect rectLeading = new Rect(this.ItemPosition, new Size(Configurations.EndRectangleLength, rectHeight));
            this.color = Configurations.NormalTextColor;

            itemGeometry.text = geomItem.BuildGeometry(this.ItemPosition);
            itemGeometry.rectangleTrailing = new RectangleGeometry(rectTrailing);
            itemGeometry.rectangleLeading = new RectangleGeometry(rectLeading);
            itemGeometry.background = new RectangleGeometry(background);

            geometry = geomItem.BuildGeometry(this.ItemPosition);
            this.ItemHeight = Configurations.MinimumTextSize;
        }
Beispiel #4
0
 private void SetAnchor()
 {
     switch (nodePart)
     {
         case NodePart.NorthEast:
             this.anchor = MenuItemAnchor.BottomLeft;
             break;
         case NodePart.North:
         case NodePart.NorthWest:
             this.anchor = MenuItemAnchor.BottomRight;
             break;
         case NodePart.South:
             this.anchor = MenuItemAnchor.TopRight;
             break;
         default:
             this.anchor = MenuItemAnchor.BottomLeft;
             break;
     }
 }