<Button>
<StackPanel Orientation="Horizontal">
<TextBlock>Formatted </TextBlock>
<TextBlock Foreground="Blue" FontWeight="Bold" Margin="2,0">Button</TextBlock>
<TextBlock Foreground="Gray" FontStyle="Italic">[Various]</TextBlock>
</StackPanel>
</Button>
private void TextBox_SelectionChanged(object sender, RoutedEventArgs e)
{
TextBox textBox = sender as TextBox;
txtStatus.Text = "Selection starts at character #" + textBox.SelectionStart + Environment.NewLine;
txtStatus.Text += "Selection is " + textBox.SelectionLength + " character(s) long" + Environment.NewLine;
txtStatus.Text += "Selected text: '" + textBox.SelectedText + "'";
}Le proprietà sono anche scrivibili: è possibile usarle per cambiare la selezione.
<CheckBox IsChecked="True">Enable feature XYZ</CheckBox>
<Image Width="100" Source="/Images/google.png" />
<Window.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Padding" Value="20"/>
</Style>
</Window.Resources>