# Стили и темы
## Стили
```
```
![](/img/rab1.png)
## Value
```
```
![](/img/rab2.png)
## TargetType
```
```
![](/img/rab3.png)
## Определение обработчиков событий
```
```
кнопка находится в MainWindow.xaml.cs
```
private void Button_Click(object sender, RoutedEventArgs e)
{
Button clickedButton = (Button)sender;
MessageBox.Show(clickedButton.Content.ToString());
}
```
![](/img/rab4.png)
## свойство BasedOn
```
```
![](/img/rab5.png)
## Cтили в С
```
Style buttonStyle = new Style();
buttonStyle.Setters.Add(
new Setter
{
Property = Control.FontFamilyProperty,
Value = new FontFamily("Verdana")
});
buttonStyle.Setters.Add(
new Setter
{
Property = Control.MarginProperty,
Value = new Thickness(10)
});
buttonStyle.Setters.Add(
new Setter
{
Property = Control.BackgroundProperty,
Value = new SolidColorBrush(Colors.LightCyan)
});
buttonStyle.Setters.Add(
new Setter
{
Property = Control.ForegroundProperty,
Value = new SolidColorBrush(Colors.DarkSalmon)
});
button1.Style = buttonStyle;
button2.Style = buttonStyle;
```
![](/img/rab6.png)