Exemplo n.º 1
0
        void UpdateTextDecorations()
        {
            if (!Element.IsSet(Label.TextDecorationsProperty))
            {
                return;
            }

            var textDecorations = Element.TextDecorations;

            var newTextDecorations = new System.Windows.TextDecorationCollection(Control.TextDecorations);

            if ((textDecorations & TextDecorations.Underline) == 0)
            {
                newTextDecorations.TryRemove(System.Windows.TextDecorations.Underline, out newTextDecorations);
            }
            else
            {
                newTextDecorations.Add(System.Windows.TextDecorations.Underline);
            }

            if ((textDecorations & TextDecorations.Strikethrough) == 0)
            {
                newTextDecorations.TryRemove(System.Windows.TextDecorations.Strikethrough, out newTextDecorations);
            }
            else
            {
                newTextDecorations.Add(System.Windows.TextDecorations.Strikethrough);
            }

            Control.TextDecorations = newTextDecorations;
        }