Difference between revisions of "Using events in CS"

From Ribbon Commander Documentation
Jump to: navigation, search
(Background)
Line 5: Line 5:
 
== Background ==
 
== Background ==
 
You can subscribe to events of [[controls|Dynamic RibbonX controls]] by using .NET events or .NET delegates. Here, we show how it can be done by using .NET events.
 
You can subscribe to events of [[controls|Dynamic RibbonX controls]] by using .NET events or .NET delegates. Here, we show how it can be done by using .NET events.
 +
In general you need to take the following steps:
 +
* Declare a member variable of the events source control type (e.g. [[rxCheckBox]])
 +
* Assign the member variable to an object of the type (e.g. instantiate a new variable)
 +
* Use the standard operator += to add an event handler to events you are interested in. Intellisense allows you to insert event stubs automatically.

Revision as of 15:30, 15 March 2013

Prerequisites

We recommend you go through Creating our first button in C# 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 events. In general you need to take the following steps:

  • Declare a member variable of the events source control type (e.g. rxCheckBox)
  • Assign the member variable to an object of the type (e.g. instantiate a new variable)
  • Use the standard operator += to add an event handler to events you are interested in. Intellisense allows you to insert event stubs automatically.