Hello,
The AutoCompleteBox is one from the more complex controls. It uses a WatermarkTextBox inside its template. To achieve the needed for the WatermarkTextBox, you can use the same approach:
<Style TargetType="telerik:RadWatermarkTextBox" BasedOn="{StaticResource RadWatermarkTextBoxStyle}">
<Style.Triggers>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter Property="Background" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
In AutoCompleteBox:
<Style x:Key="CustomAutoCompleteTextBoxStyle" TargetType="telerik:RadWatermarkTextBox" BasedOn="{StaticResource RadAutoCompleteTextBoxStyle}">
<Style.Triggers>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter Property="Background" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="telerik:RadAutoCompleteBox" BasedOn="{StaticResource RadAutoCompleteBoxStyle}">
<Setter Property="TextBoxStyle" Value="{StaticResource CustomAutoCompleteTextBoxStyle}"/>
</Style>
However you will notice that there is a white gap around the WatermarkTextBox on focus caused by settings in the default template. Please let me know whether this is a problem and which is the theme that you use in your project.
Hi Sia, How to get this with RadAutocompleteBox ?
This sample works for my requirements. Thaks.
As I understand you need to change the focus background without using a custom control template. Please let me know if I am wrong.
It seems that this can be achieved for the simple controls such as TextBox:
<Style TargetType="TextBox" BasedOn="{StaticResource TextBoxStyle}">
<Style.Triggers>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter Property="Background" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
In our Fluent theme the trigger should be:
<Style TargetType="TextBox" BasedOn="{StaticResource TextBoxStyle}">
<Style.Triggers>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter Property="mat:MaterialAssist.MouseOverBrush" Value="Red" />
</Trigger
</Style.Triggers>
</Style>
However for complex controls I am afraid to say that it could be impossible to achieve such behavior without setting a custom control template. Please open a support thread in our system referring to this feedback item. This way it would be possible to understand all the requirements that you have.