I'm creating a DelayedTextbox. I did this by extending the TextBox and adding dependency properties (thanks to help on another question)
So I have a cs file that looks like this:
public class DelayedTextBox : TextBox
{
   public int Delay
    {
        get
        {
            return (int)GetValue(DelayProperty);
        }
        set
        {
            SetValue(DelayProperty, value);
        }
    }
    public static readonly DependencyProperty DelayProperty =
        DependencyProperty.Register(
            "Delay",
            typeof(int),
            typeof(DelayedTextBox),
            new PropertyMetadata(300));
}
Then in my xaml file I attempt to use the new control:
<h:DelayedTextBox Delay="300" />
Where Delay is one of the dependency properties.
When I run the code though, the first time DelayedTextBox.cs tries to access Delay it throws the following error:
System.Exception: 'The application called an interface that was marshalled for >a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))'
How can I properly extend the Textbox with my custom control?
