By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,367 Members | 946 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,367 IT Pros & Developers. It's quick & easy.

Cut/Copy/Paste Commands WPF

P: 81
Hey All, I am trying to implement buttons that follow the command pattern. .NET exposes ApplicationCommands.Cut, copy and paste.

I am trying the following:

<Button Command="ApplicationCommands.Copy"/> //also have paste and cut.
<TextBox Width="50"/>

In the designer, selecting the textbox will eneable cut/copy. However when I run the application and go into the textbox and type, non the the buttons enable. Is this some sort of a focusing issue with the textbox?

thanks!
Feb 3 '09 #1
Share this Question
Share on Google+
2 Replies


P: 2
Hey, i have two buttons start and stop and only one will be enabled at any point of time. And i would like to use the same keygesture (something like Alt
+ P ) for both the commands. Is it possible?
Apr 27 '09 #2

P: 47
nelson are the buttons disabled to start with? if so you might want to try adding a TextChanged event to the textbox to enable or disable the buttons. something like
Expand|Select|Wrap|Line Numbers
  1.         private void txtText_TextChanged(object sender, EventArgs e)
  2.         {
  3.              if(txtText.Text.Trim != "")
  4.              {
  5.                   btnCopy.Enabled = true;
  6.                   btnCut.Enabled = true;
  7.              }
  8.              else
  9.              {
  10.                   btnCopy.Enabled = false;
  11.                   btnCut.Enabled = false;
  12.              }
  13.         }
Apr 29 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.