---
title: "Create CheckBox Style from code behind"  
description: "Create CheckBox Style from code behind"  
author: "Mark Devid"  
published: 2014-01-25  
updated: 2014-01-25  
canonical: https://www.mindstick.com/forum/1870/create-checkbox-style-from-code-behind  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Create CheckBox Style from code behind

How can I create this from [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) ?

```
<Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">            <SetterProperty="Content">               
<Setter.Value>                   
<TextBlock Foreground="Blue" TextDecorations="Underline" FontWeight="Bold" />               
</Setter.Value>           
</Setter>        </Style>
```

## Replies

### Reply by Pravesh Singh

Hi Mark,

Try this:

```
chkBox.Content = new TextBlock() {                                 Text ="hello",                                 Foreground =new SolidColorBrush(Colors.Blue),                                 TextDecorations= TextDecorations.Underline                      
};
```


---

Original Source: https://www.mindstick.com/forum/1870/create-checkbox-style-from-code-behind

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
