Самый простой способ
<CheckBox>
<TextBlock Text="Your text here"/>
</CheckBox>
Обновление Вы должны использовать MVVM.Без mvvm-фреймворков это будет примерно так:
<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>
...
<StackPanel>
<CheckBox Name="CheckBox" IsChecked="{Binding IsChecked, Mode=TwoWay}"/>
<TextBlock Text="Your text here">
<TextBlock.InputBindings>
<MouseBinding Command="{Binding IsCheckedCommand}" MouseAction="LeftClick" />
</TextBlock.InputBindings>
</TextBlock>
</StackPanel>
Код позади
public class RelayCommand : ICommand
{
readonly Action<object> _execute;
readonly Predicate<object> _canExecute;
public RelayCommand(Action<object> execute) : this(execute, null) { }
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
{
_execute = execute ?? throw new ArgumentNullException(nameof(execute)); _canExecute = canExecute;
}
[DebuggerStepThrough]
public bool CanExecute(object parameter)
{
return _canExecute?.Invoke(parameter) ?? true;
}
public event EventHandler CanExecuteChanged
{
add => CommandManager.RequerySuggested += value;
remove => CommandManager.RequerySuggested -= value;
}
public void Execute(object parameter) { _execute(parameter); }
}
public class ViewModel:INotifyPropertyChanged
{
public bool IsChecked { get; set; }
public RelayCommand IsCheckedCommand { get; set; }
public ViewModel()
{
IsCheckedCommand = new RelayCommand(m => IsCheckedCommandExecute());
}
private void IsCheckedCommandExecute()
{
IsChecked = !IsChecked;
OnPropertyChanged(nameof(IsChecked));
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
https://msdn.microsoft.com/en-us/magazine/dd419663.aspx
Если вы не хотите создавать пользовательскую реализациюВ ICommand и INotifyPropertyChanged можно взять фреймворк mvvm, например, MvvmLight