Search code examples
wpfxamlwpf-style

Disable focus on tabstop when TextBox is readonly


When a TextBox is in readonly and on tabbing i want to disable the focus border of the textbox, i wanted to do this in Style of textbox.Can any one help me to achieve this?

Updated the content:

Screenshot: enter image description here


Solution

  • Place a condition like the below in your textbox style

    <MultiTrigger>
        <MultiTrigger.Conditions>
            <Condition Property="IsReadOnly" Value="True"></Condition>
            <Condition Property="IsFocused" Value="True"></Condition>               </MultiTrigger.Conditions>
        <MultiTrigger.Setters>
            <Setter Property="BorderBrush" Value="{#7B2F81}"></Setter>
        </MultiTrigger.Setters>