Search This Blog

Tuesday, December 20, 2011

Silverlight update Text property after each letter; Silverlight TextBox get current text; Silverlight force TextBox to rewrite Text property

Our goal is to force TextBox to refresh its Text property. Unfortunately normally Text property is refreshed ONLY when TextBox loses focus. This in unacceptable in my case.

There are 2 solutions to this problem. Creating a custom TextBox control or using PRISM and UpdateTextBindingOnPropertyChanged  behaviour.

The solution from PRISM is the simplest:

<TextBox>
    <i:Interaction.Behaviors>
        <behaviors:UpdateTextBindingOnPropertyChanged />
    </i:Interaction.Behaviors>
</TextBox>

Custom control can be downloaded here.

No comments:

Post a Comment

If you like this post, please leave a comment :)