70 likes | 171 Views
Enabling Commands in Silverlight. Mahender Senior Software Engineer United Health Group. Mahender Sarangam.
E N D
Enabling Commands in Silverlight Mahender Senior Software Engineer United Health Group
Mahender Sarangam • Having 5 years of experience on .NET Technologies. Working as a Senior Software Engineer in United Health Group (UHG India Information Service Ltd.). Worked with Big Firms like Deloitte Consulting & Wipro Technology. • Got Technical Acquaintance on Technologies like C#, ASP.NET,AJAX, LINQ, Silverlight, WPF,WCF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. • MCTS Certified in Web Technologies. • Blog : http://Msarangam.wordpress.com
Commands • One of the great advantages to commanding is encapsulation • Silverlight 4 now came up with the support of Command Binding. Using Command binding you can easily develop your Silverlight MVVM
Commands are supported by only two element classes: Hyperlink and ButtonBase (although several button-like controls derive from ButtonBase). • Commands work through two properties that have been added to the Hyperlink and ButtonBaseclass: Command and Command Parameter. • The Command is the action that will be triggered when the button click takes place • The CommandParameter is a single object that will be passed to the command, with additional information. • Need to implement ICommand Interface
ICommand Interface • ICommand interface features the following three members: • Execute(object parameter) - Called whenever the command is activated. The parameter is optional. • CanExecute(object parameter) - This method is called to determine whether the command can execute at the current time. The main feature of this is the command source can disable itself if its command cannot be executed. • event CanExecuteChanged - The command should raise this event whenever it's ability to be executed has changed.