I have custom control inherited from Textbox.
I want to make delay in calling textchanged event.
Observable.FromEventPattern<TextChangedEventHandler, TextChangedEventArgs>(
handler => this.TextChanged += handler,
handler => this.TextChanged -= handler
).Throttle(TimeSpan.FromMilliseconds(600))
.Where(e =>
{
var control= e.Sender as TextBox;
return control!= null && !string.IsNullOrEmpty(control.Text);
})
.Subscribe(x => Control_TextChanged(x.Sender, x.EventArgs));
Problem is it is giving error saying, cannot access Text property as current thread does not have access.
Can someone please advice?
Thanks, Vishal