I have created a toolbar that has buttons.
Of the buttons 3 of them are cut copy and paste. I set the command of each of those buttons to cut copy and paste on the properties but when I go run the program none of the buttons are even clickable. Are they disabled I'm guessing? I'm trying to copy and paste from textbox to textbox in a tabcontrol. Any help is appreciated.
<Style TargetType="{x:Type Button}" x:Key="textBoxCommands">
<Setter Property="Content"
Value="{Binding RelativeSource={RelativeSource Self},
Path=Command.Text}" />
<Setter Property="CommandTarget"
Value="{Binding ElementName=textBox}" />
</Style>
<Button x:Name="btnCut"
Click="btnCut_Click">
<Image Source="Icons/Cut.png" ToolTip="Cut" />
</Button>
<Button x:Name="btnCopy"
Click="btnCopy_Click"
Command="ApplicationCommands.Copy"
Style="{StaticResource textBoxCommands}">
<Image Source="Icons/Copy.png" ToolTip="Copy" />
</Button>
<Button x:Name="btnPaste"
Click="btnPaste_Click"
Command="ApplicationCommands.Paste"
Style="{StaticResource textBoxCommands}" >
<Image Source="Icons/Paste.png" ToolTip="Paste" />
</Button>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…