Create CheckBox Style from code behind

Total Post:102

Points:714
C# 
C#
 1599  View(s)
Ratings:
Rate this:

How can I create this from code ?

<Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">
            <SetterProperty="Content">
                <Setter.Value>
                    <TextBlock Foreground="Blue" TextDecorations="Underline" FontWeight="Bold" />
                </Setter.Value>
            </Setter>
        </Style>
  1. Post:412

    Points:2888
    Re: Create CheckBox Style from code behind

    Hi Mark,

    Try this:

    chkBox.Content = new TextBlock() { 
                                    Text ="hello",
                                    Foreground =new SolidColorBrush(Colors.Blue),
                                    TextDecorations= TextDecorations.Underline 
                         };

      Modified On Apr-04-2018 01:46:33 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!