views:

27

answers:

1

For example, I have an empty tabControl in my Windows during the compile time, and I have an undetermined amount of images need to be added onto the tabControl, so I used loop + tabControl.Children.Add("image1 to x") to add those images... but after that during runtime, I want to perform events on those image controls, such as dragging the image from the tabControl to another Panel. Is it possible to do so? If it's possible, how?

+2  A: 

I don't know if I understood what exactly you want, but if you want to add an event handler for a control in runtime, you can do that like the following sample:

Image i = new Image();
i.Click += (sender,e) => { [write here your code] };

for drag and drop, you can see the thumb control, It might help you

Homam