Using the below code in a DataGridTemplateColumn of the DataGrid, my formatting buttons are disabled(grayed out). The formatting buttons are only enabled when they are put in a ToolBar.
When the buttons are put in a ToolBar I do not need the CommandTarget. So when I put them outside a ToolBar some could think it must work with CommandTarget, but it does not, WHY ?
<Button Content="K" CommandTarget="{Binding ElementName=RTFBox}" Command="EditingCommands.ToggleItalic"/>
<Button Content="U" CommandTarget="{Binding ElementName=RTFBox}" Command="EditingCommands.ToggleUnderline" />
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Helper:RichTextBox VerticalScrollBarVisibility="Auto" x:Name="RTFBox" LostFocus="RTFBox_LostFocus" Text="{Binding Notes, UpdateSourceTrigger=PropertyChanged}" >
<Helper:RichTextBox.TextFormatter>
<Helper:RtfFormatter />
</Helper:RichTextBox.TextFormatter>
<RichTextBox.CommandBindings>
<CommandBinding Command="EditingCommands.ToggleUnderline"/>
<CommandBinding Command="EditingCommands.ToggleItalic"/>
</RichTextBox.CommandBindings>
</Helper:RichTextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>