CREATE CHECKBOX STYLE FROM CODE BEHIND

Mark Devid

Total Post:102

Points:714
Posted by  Mark Devid
C# 
C#
 1338  View(s)
Ratings:
Rate this:

How can I create this from code ?

<Style x:Key="CheckBoxStyle" TargetType ="{x:Type CheckBox}">

            <Setter Property="Content">

                <Setter.Value>

                    <TextBlock Foreground="Blue" TextDecorations="Underline" FontWeight="Bold" />

                </Setter.Value>

            </Setter>

        </Style>

  1. Pravesh Singh

    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 

                         };

Answer

NEWSLETTER

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