Skip to main content

Microsoft Silverlight

Answered Question Remove/Disable Underline Property of a Text BlockRSS Feed

(1)

okaravian
okaravian

Member

Member

113 points

81 Posts

Remove/Disable Underline Property of a Text Block

<p><div>

 

//following  is my code to set and unset the bold italic and underline properties of a text block

private void btnBold_MouseLeftButtonDown(object sender, RoutedEventArgs e)
        {
            if (currentText.FontWeight == FontWeights.Bold)
            {
                currentText.FontWeight = FontWeights.Normal;
            }
            else
            {
                currentText.FontWeight = FontWeights.Bold;
            }
            
        }

        private void btnItalic_MouseLeftButtonDown(object sender, RoutedEventArgs e)
        {
            if (currentText.FontStyle == FontStyles.Italic)
            {
                currentText.FontStyle = FontStyles.Normal;
            }
            else
            {
                currentText.FontStyle = FontStyles.Italic;
            }

        }

        private void btnUnderline_MouseLeftButtonDown(object sender, RoutedEventArgs e)
        {
            if (currentText.TextDecorations == TextDecorations.Underline)
            {
                ?????????????????????????????????????????????????
            }
            else
            {
                currentText.TextDecorations=TextDecorations.Underline;
            }

        }

 What can I write code to disable only the underline property of a textblock when textblock may have bold and italic and underline property at same time.

anybody help me out thanks in advance. 

</dv>

</p> 

lee_sl
lee_sl

Contributor

Contributor

2990 points

584 Posts

Answered Question

Re: Remove/Disable Underline Property of a Text Block

currentText.TextDecorations = null;

----------------------------------------------
Available for consulting in Dallas, TX
http://leeontech.wordpress.com/

okaravian
okaravian

Member

Member

113 points

81 Posts

Re: Remove/Disable Underline Property of a Text Block

 <div>

Thank you dear It is working fine 

</div> 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities