iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi
I have a view with 26 buttons (letters of alphabet) - is there a way to pass a parameter or establish which button has been pressed so as to avoid 26 delegate commands in my viewmodel.
Thanks
Routed event is a powerful eventing framework employed in modern client user interface platforms such as in WPF and Silverlight. Routed event works by notifying the occuring event to the source's parent or child through a visual tree walk.
For more detail information about Routed event, please check Routed event overviews in ClientUI Documentation. The live version of the article is available in here.
In addition to the instance handlers, you can also handle a routed event using class handlers by calling the RegisterClassHandler method available in the EventManager class. Class handlers are invoked before any instance listener handlers that are attached to an instance of that class, whenever a routed event reaches an element instance in its route. Furthermore, class handlers are commonly called in the static contructor of your class.
Class handlers are typically used to effectively handle a routed event of multiple instances of controls having the same type, or derived type. For instance, consider a registration form where your application is responding as user types into textbox or changes selection in combobox. The handling of such events can be achieved more efficiently through class handlers.
The following code example shows how to add class handling for a routed event.
private static void OnKeyUp(object sender, KeyEventArgs e) { if (e.OriginalSource is ISButton || e.OriginalSource is ISTextBox || e.OriginalSource is ISSelectionControl) { //do something on key up } }
Please kindly check the Routed events sample of ClientUI in http://live.clientui.com/#/ClientUIFramework/RoutedEvents and refer to the codes available in the ClientUI Framework project to learn more.
Please let us know if you have other questions.
thanks for the reply - not sure this will give me what I need. I have had another look and found a property called CommandParameter. This I believe is what I'm looking for. I can have 26 buttons on my view each with a different CommandParameter - the viewmodel command delegate process receives an object parameter and I can then apply logic to it - so no need to have 26 command delegates in the VM.
Richard
Thank you for the prompt reply.I will try to create a sample and have it sent to you to be evaluated.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname