I have been trying to change the gray background <Border ReadOnlyVisualElement to white, but I would like to do by code behind,the problem is when I try to get the element <Border ReadOnlyVisualElement using Border border = this.txtDatePickerIdle.ParentOfType<Border>(); didn't work because get the parent above, I tried Child as well and didn't work, I tried to using Immediate Window and navegate in the control but when I try to find the border is always 'NULL'.
I am running the code in the LayoutUpdated event.
The xaml is below, and I attached a file with the print of structure: <RadWatermarkTextBoxx:Name="txtDatePickerIdle"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"AllowDrop="True"Background="#00FFFFFF"BorderBrush="#00FFFFFF"BorderThickness="1, 1, 1, 1"Foreground="#FF000000"HorizontalContentAlignment="Left"HorizontalScrollBarVisibility="Hidden"IsHitTestVisible="False"IsReadOnly="True"IsTabStop="False"Margin="0, 0, 15, 0"MinHeight="15"SelectedText=""SelectionBackground="#FF444444"SelectionForeground="#FFFFFFFF"SelectionLength="0"SelectionStart="0"TabNavigation="Once"Text="dd/MM/yyyy"UseLayoutRounding="False"VerticalScrollBarVisibility="Hidden">
As the border which you are trying to get is inside txtDatePickerIdle in the visual tree, you have to use ChildrenOfType<Border> (you have to add the following using to your code behind: using Telerik.Windows.Controls; )
In order to get exactly this border, you can use:
var border = this.txtDatePickerIdle.ChildrenOfType<Border>().FirstOrDefault(b => b.Name == "ReadOnlyVisualElement") as Border;
if (border != null)
Hope this helps.
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.