Function call within XAML code?

Posted by Matt H. on Stack Overflow See other posts from Stack Overflow or by Matt H.
Published on 2010-06-14T23:50:32Z Indexed on 2010/06/14 23:52 UTC
Read the original article Hit count: 275

Filed under:
|
|
|
|

I'd like to set a style on all my TextBox controls that does the following when it receives keyboard focus:

1) Change the background color
2) Call .SelectAll() to highlight all text

I have this so far:

<Style TargetType="TextBox">
<Style.Triggers>
            <Trigger Property="IsKeyboardFocusWithin" Value="True">
                <Setter Property="Background">
                    <Setter.Value>
                        <SolidColorBrush Color="#FFFFD1D9"/>
                    </Setter.Value>
                </Setter>
           </Trigger>
</Style.Triggers>
</Style>

Is there a way to also call .SelectAll() ? Thanks.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml