Skip to content

TemplateContext.Subscribe method (1 of 5)

Subscribes to an object’s property changes now and unsubscribes on the next Reset.

public void Subscribe(INotifyPropertyChanged source, PropertyChangedEventHandler handler)

TemplateContext.Subscribe<TSource> method (2 of 5)

Section titled “TemplateContext.Subscribe<TSource> method (2 of 5)”
public void Subscribe<TSource>(TSource source, Action<TSource, Action> add,
Action<TSource, Action> remove, Action handler)
where TSource : class

TemplateContext.Subscribe<TSource,TArg> method (3 of 5)

Section titled “TemplateContext.Subscribe<TSource,TArg> method (3 of 5)”
public void Subscribe<TSource, TArg>(TSource source, Action<TSource, Action<TArg>> add,
Action<TSource, Action<TArg>> remove, Action<TArg> handler)
where TSource : class

TemplateContext.Subscribe<TSource,TEventArgs> method (4 of 5)

Section titled “TemplateContext.Subscribe<TSource,TEventArgs> method (4 of 5)”
public void Subscribe<TSource, TEventArgs>(TSource source,
Action<TSource, EventHandler<TEventArgs>> add,
Action<TSource, EventHandler<TEventArgs>> remove, EventHandler<TEventArgs> handler)
where TSource : class

TemplateContext.Subscribe<TSource,THandler> method (5 of 5)

Section titled “TemplateContext.Subscribe<TSource,THandler> method (5 of 5)”

Runs add now and remove on the next Reset. Subscribing from the bind step every time is correct: a rebind unsubscribes first, so handlers do not accumulate.

public void Subscribe<TSource, THandler>(TSource source, Action<TSource, THandler> add,
Action<TSource, THandler> remove, THandler handler)
where TSource : class
where THandler : Delegate