This is a migrated thread and some comments may be shown as answers.

Is there a simple way to change the Input box border color on focus and on mouse over without overwriting the entire style

1 Answer 514 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
sandeep
Top achievements
Rank 1
sandeep asked on 23 Sep 2014, 10:08 AM
Is there a simple way to change the Input box border color on focus and on mouse over without overwriting the entire style.

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 25 Sep 2014, 03:34 PM
Hi Sandeep,

The easiest way to achieve the desired would be to get the borders named MouseOverVisual and FocusVisual from the Template of the control and set their BorderBrush colors. You can do that in the Loaded event handler of the DateTimePicker as shown below:

private void DatePicker_Loaded(object sender, RoutedEventArgs e)
{
    var picker = sender as RadDateTimePicker;
 
    var mouseOverBorder = picker.Template.FindName("MouseOverVisual", picker) as Border;
    mouseOverBorder.BorderBrush = Brushes.Red;
 
    var focusBorder = picker.Template.FindName("FocusVisual", picker) as Border;
    focusBorder.BorderBrush = Brushes.Red;
}

However this won't change the border around the drop down button - you would need to modify its Style in this case.

Hope this help.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
DateTimePicker
Asked by
sandeep
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or