Skip to content

SingleEvent

Rico Suter edited this page Jul 8, 2015 · 2 revisions
  • Package: MyToolkit.Extended
  • Platforms: WP7SL, WP8SL, WinRT, UWP, SL5, WPF

Provides methods to register an event callback which is called only once.

Methods:

  • Register: Registers an event which is called only once and then deregistered:

     SingleEvent.Register(element,
     	(e, h) => e.LostFocus += h,
     	(e, h) => e.LostFocus -= h,
     	OnLostFocus);
     
     // TODO: Implement OnLostFocus method which is called only once and deregistred automatically. 
  • WaitForEventAsync (WinRT only): Used to wait for an event:

     var args = await SingleEvent.WaitForEventAsync(element,
     	(element, handler) => element.LostFocus += handler,
     	(element, handler) => element.LostFocus -= handler);
Clone this wiki locally