Difference between revisions of "Using delegates in CS"

From Ribbon Commander Documentation
Jump to: navigation, search
(Background)
(Background)
Line 6: Line 6:
 
You can subscribe to events of [[controls|Dynamic RibbonX controls]] by using [[Using events in CS|.NET events]] or .NET delegates. Here, we show how it can be done by using .NET delegates.
 
You can subscribe to events of [[controls|Dynamic RibbonX controls]] by using [[Using events in CS|.NET events]] or .NET delegates. Here, we show how it can be done by using .NET delegates.
  
* Every [[controls|Dynamic RibbonX control]] has an associated ''*Delegates'' class in namespace ''LogismiX.DynamicRibbonX.Core'' which exposes all delegates used by the control for its callbacks.  
+
* Every [[controls|Dynamic RibbonX control]] has an associated ''*Delegates'' class in namespace ''LogismiX.DynamicRibbonX.Core'' which exposes all delegate signatures used by the control for its callbacks.  
 
* Visual Studio 2012 allows you to automatically insert delegate stubs based on their signature instead of typing the code (and double-checking the signature) manually. For earlier versions of Visual Studio, we recommend you use [[Using Events in CS|events ]] whose stubs can be [[Inserting_Events_Stubs_in_CS|inserted automatically]] instead, where possible.
 
* Visual Studio 2012 allows you to automatically insert delegate stubs based on their signature instead of typing the code (and double-checking the signature) manually. For earlier versions of Visual Studio, we recommend you use [[Using Events in CS|events ]] whose stubs can be [[Inserting_Events_Stubs_in_CS|inserted automatically]] instead, where possible.

Revision as of 17:10, 15 March 2013

Prerequisites

We recommend you go through A 'hello world' C# program before going into this example.

Background

You can subscribe to events of Dynamic RibbonX controls by using .NET events or .NET delegates. Here, we show how it can be done by using .NET delegates.

  • Every Dynamic RibbonX control has an associated *Delegates class in namespace LogismiX.DynamicRibbonX.Core which exposes all delegate signatures used by the control for its callbacks.
  • Visual Studio 2012 allows you to automatically insert delegate stubs based on their signature instead of typing the code (and double-checking the signature) manually. For earlier versions of Visual Studio, we recommend you use events whose stubs can be inserted automatically instead, where possible.