Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Custom button ovverrides OnClick
2 replies. Latest Post by MurDoGG on June 30, 2009.
(0)
MurDoGG
Member
12 points
28 Posts
06-30-2009 7:34 AM |
Hi guys,
I generate buttons in code behind, don't know what to preform at develope time so i have to choose at runtime. So my idea was to create a new button control inherits the UIElement.Button and override OnClick event with my own EventHandlerArguments, so i can pass data to the event handler and choose there at runtime what to do, dependent at the data in my own EventHandlerArguments.
Have somebody i idea how to implement or know a best practise to do what i want. Use onClick event with my own EventArgs?!
Thanks for your help.
Mfg
jay nana...
Contributor
3388 points
624 Posts
06-30-2009 7:52 AM |
Create a custom control that inherits from Button and overrides its Click event.
for creating custom control:
http://www.silverlightshow.net/items/Creating-a-Silverlight-Custom-Control-The-Basics.aspx
for creating custom event args:
06-30-2009 8:20 AM |
Thx for your response, think i have found a possibilty to do what i want. I i think i don't need t override OnClick. I inherited from Button and add a property, which i set in Constructor. And in the RoutetdEventHandler i get this property and make my choice what to do.
Perhaps, but i don't rely know, the Action<T> class could help in this scenarios?