473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Cut/Copy/Paste Commands WPF

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
2 9295
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
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

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

Similar topics

1
by: Nicola | last post by:
Help! Could someone please help me. I have set up cut copy and paste commands in my program only problem is that it will only copy the item or last item I selected. How do I copy the Entire...
3
by: ASUStudent | last post by:
Hello, I am new to programming and I am taking a class on programming this semester. I am writing a program but I cannot seem to find out how to copy/paste/cut code to add so that the text from...
1
by: Justin | last post by:
Hello, My problem is that I am trying to use commands to Cut/Copy/paste text from an active textbox this is because I am calling the commands from the MDIParent. Does anyone know how to allow...
2
by: Keith | last post by:
I'm trying to come up with a way to create a contextmenu that will do all the "standard" functions (cut, copy, paste, undo, etc). There seems to be a lot of information out there - but nothing...
6
by: Ben R. | last post by:
Hi, I've got a vb.net winforms app. Out of the box, I can use Ctrl X, C and V as expected in controls like textboxes. I've got a menustrip, and if I click the link "Add standard items" which...
1
by: christianlott1 | last post by:
I want to copy an Access pivot table into word with vba. I'm guessing I'd need to Select All, copy to the clipboard, and paste special into word at a bookmark. I know how to address the...
0
by: Tom | last post by:
When I use ctrl-c to copy and ctrl-v to paste from a RichTextBox into NotePad ... I get nice ASCII text with the proper returns. Everything looks good. When I paste into WordPad ... I get the...
11
by: John | last post by:
Hi In a winform app I need to provide a menu with Cut, Copy and Paste options., What code do I use to accomplish cut, copy and paste features for fields on a winfrom? Thanks Regards
0
by: bbatson | last post by:
Hello, I am trying to dynamically open up a webpage, copy the contents of the webpage (which, in this case, will just be an image") and paste it to a specific cell in an Excel file. The code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.