Declined
Last Updated: 20 Feb 2018 15:50 by ADMIN
Nebojsa Mancic
Created on: 22 Jan 2018 14:40
Category: UI for WPF
Type: Feature Request
0
i want to change background color of control when focused and when focus losted by style, not only border. That could be for all controls, not only for textbox or maskedinput.

		
4 comments
ADMIN
Sia
Posted on: 20 Feb 2018 15:50
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.
Nebojsa Mancic
Posted on: 18 Feb 2018 17:05
Hi Sia,


How to get this with RadAutocompleteBox ?
Nebojsa Mancic
Posted on: 17 Feb 2018 09:05
This sample works for my requirements. Thaks.
ADMIN
Sia
Posted on: 08 Feb 2018 08:57
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.