473,386 Members | 1,795 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,386 software developers and data experts.

keydown is not working in TreeViewItem

I'm new to WPF.

I have some TreeViewItems(level 1) as children for a TreeView. Also those TreeViewItems have some children TreeviewItems(level 2). Here my requirement is i have to delete my TreeViewItems in level 2 by selecting that and hitting delete key. But I'm not even getting the control in my delegate function. my code is

FolderItem.KeyDown += new KeyEventHandler(Keydown_delegate);

public void Keydown_delegate(object sender, KeyEventArgs e)
{
TreeViewItem parent = ((TreeViewItem)sender).Parent as TreeViewItem;
parent.Items.Remove((TreeViewItem)sender);
}

Here I'm not even getting the control inside Keydown_delegate function if any key is pressed.

Plz help me...

Regards,
Arun
Jul 19 '11 #1
0 1276

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

Similar topics

1
by: Keith Smith | last post by:
My layout is like this... tabControl1 contains... ....tabControl2 which contains... .......GroupBox1 which contains... ..........comboBox1. At first there was no tabControl2, but when I...
4
by: velasquez.m | last post by:
i'm working with visual studio 2005 and have a solution with 16 projects in it. this specific application has a base form with other forms added to it at any area of the application that the...
2
by: GS | last post by:
on a control, keydown was never triggered Private Sub addressBar_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) .... end sub on the hand the following got...
6
by: mingchin.AT | last post by:
Hi, In Javascript, the simple way to check user input is to get the keycode. But for cross browser, its seems we need to have two different keycodes for the same key. There is a web page for...
2
by: mart_nl | last post by:
Dear group, I am trying to move a panel (panel2) around which is inside another panel (panel1). I want the user to be able to use the arrow keys on the keyboard. However when I press either...
5
by: ApexData | last post by:
This follows a previous post, when I was trying to capture a key pressed during the immediate opening of a form (ie in the first 3-secs before processing any of the code that followed it. It was...
2
by: Mohammad Omer Nasir | last post by:
Hi, I am working on vs2k5 IDE for C# development. I made one Form which has one button on it. I tried to override KeyDown message on From but KeyDown message received. if Form does not...
8
by: bryan.kardisco | last post by:
I'm currently trying to extend the TreeViewItem class so I can attach some additional attributes to the item. I created a custom class class myTreeNode : System.Windows.Controls.TreeViewItem...
1
by: jimatqsi | last post by:
I have a form with two subforms. The main form has a keydown event that is being captured okay. In this case, F11 on the main form takes the user to a textbox on subform number 1. F12 is supposed...
1
by: Bill McCormick | last post by:
I have a TreeView that I want to populate with pre-built items through code. Running the code (see Ref Code below) throws a XamlParseException: Cannot create instance of 'Window1' defined in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.