Example #1
0
 static TextDecoration()
 {
     Baseline = new TextDecoration() { Location = TextDecorationLocation.Baseline };
     OverLine = new TextDecoration() { Location = TextDecorationLocation.OverLine };
     Strikethrough = new TextDecoration() { Location = TextDecorationLocation.Strikethrough };
     Underline = new TextDecoration() { Location = TextDecorationLocation.Underline };
 }
Example #2
0
 static TextDecoration()
 {
     Baseline = new TextDecoration()
     {
         Location = TextDecorationLocation.Baseline
     };
     OverLine = new TextDecoration()
     {
         Location = TextDecorationLocation.OverLine
     };
     Strikethrough = new TextDecoration()
     {
         Location = TextDecorationLocation.Strikethrough
     };
     Underline = new TextDecoration()
     {
         Location = TextDecorationLocation.Underline
     };
 }
Example #3
0
        private Drawing.FontStyle TransformTextDecoration(Styles.TextDecoration textDecoration)
        {
            if (textDecoration == TextDecoration.Baseline)
            {
                return(Drawing.FontStyle.Regular);    // no pair for this -> return the default style
            }
            else if (textDecoration == TextDecoration.OverLine)
            {
                return(Drawing.FontStyle.Regular);    // no pair for this -> return the default style
            }
            else if (textDecoration == TextDecoration.Strikethrough)
            {
                return(Drawing.FontStyle.Strikeout);
            }

            else if (textDecoration == TextDecoration.Underline)
            {
                return(Drawing.FontStyle.Underline);
            }

            else
            {
                switch (textDecoration.Location)
                {
                case Styles.TextDecorationLocation.Baseline:
                    return(Drawing.FontStyle.Regular);       // no pair for this -> return the default style

                case Styles.TextDecorationLocation.OverLine:
                    return(Drawing.FontStyle.Regular);       // no pair for this -> return the default style

                case Styles.TextDecorationLocation.Strikethrough:
                    return(Drawing.FontStyle.Strikeout);

                case Styles.TextDecorationLocation.Underline:
                    return(Drawing.FontStyle.Underline);

                default:
                    throw new ArgumentException("textDecoration");
                }
            }
        }
Example #4
0
        private Windows.TextDecorationCollection TransformTextDecoration(Styles.TextDecoration textDecoration)
        {
            if (textDecoration == TextDecoration.Baseline)
            {
                return(null);    // no pair for this -> return the default style
            }
            else if (textDecoration == TextDecoration.OverLine)
            {
                return(null);    // no pair for this -> return the default style
            }
            else if (textDecoration == TextDecoration.Strikethrough)
            {
                return(null);    // no pair for this -> return the default style
            }
            else if (textDecoration == TextDecoration.Underline)
            {
                return(Windows.TextDecorations.Underline);
            }

            else
            {
                switch (textDecoration.Location)
                {
                case Styles.TextDecorationLocation.Baseline:
                    return(null);       // no pair for this -> return the default style

                case Styles.TextDecorationLocation.OverLine:
                    return(null);       // no pair for this -> return the default style

                case Styles.TextDecorationLocation.Strikethrough:
                    return(null);       // no pair for this -> return the default style

                case Styles.TextDecorationLocation.Underline:
                    return(Windows.TextDecorations.Underline);

                default:
                    throw new ArgumentException("textDecoration");
                }
            }
        }
Example #5
0
        private Windows.TextDecorationCollection TransformTextDecoration(Styles.TextDecoration textDecoration)
        {
            if (textDecoration == TextDecoration.Baseline)
            {
                return(Windows.TextDecorations.Baseline);
            }

            else if (textDecoration == TextDecoration.OverLine)
            {
                return(Windows.TextDecorations.OverLine);
            }

            else if (textDecoration == TextDecoration.Strikethrough)
            {
                return(Windows.TextDecorations.Strikethrough);
            }

            else if (textDecoration == TextDecoration.Underline)
            {
                return(Windows.TextDecorations.Underline);
            }

            else
            {
                return(new Windows.TextDecorationCollection(
                           new[]
                {
                    new Windows.TextDecoration(
                        TransformTextDecorationLocation(textDecoration.Location),
                        TransformPen(textDecoration.Pen),
                        textDecoration.PenOffset,
                        Windows.TextDecorationUnit.FontRecommended,
                        Windows.TextDecorationUnit.FontRecommended
                        )
                }
                           ));
            }
        }