Hello,
I am using a Docking-Layout in my Application with some RadPane's in it. Each RadPane is bound to a different ViewModel. When the RadPane is visible, everything works as expected.
But I struggle with some Binding Errors when the RadPane is hidden on start up of my application. Is there a way to reset/update the DataContext of the RadPane when the PaneStatus changed to visible?
I can provide a code example if you want.
Cheers!
Tobias
4 Answers, 1 is accepted
Hi Peter,
Thank you for your interest in our RadDocking control for WPF.
What comes to my mind is to subscribe to the PaneStateChange event of the control. In the event handler, you could try to reset/update the DataContext.
Give it a try and let me know if it works for you.
Regards,
Dinko
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Hello Dinko,
thank you very much for your reply.
I missinterpreted the issue, the binding error comes from another source. In my RadPane, I have a WatermarkTextBox with a clear button in it, like so:
<telerik:RadWatermarkTextBox x:Name="_ctlTextBox_Filter" Width="120"
TextChanged="OnTextBoxFilterTextChanged"
WatermarkContent="{lex:Loc IDS_NO_FILTER_ACTIVE}"
WatermarkBehavior="HideOnTextEntered">
<
telerik:RadWatermarkTextBox.AdditionalContent
>
<
telerik:RadButton
Padding
=
"0"
Margin
=
"0,4"
Command
=
"telerik:RadWatermarkTextBoxCommands.Clear"
CommandTarget
=
"{Binding ElementName=_ctlTextBox_Filter}"
IsBackgroundVisible
=
"False"
Visibility
=
"{Binding Text, ElementName=_ctlTextBox_Filter, Converter={StaticResource NullToVisibilityConverter}}"
>
<
telerik:RadGlyph
Glyph
=
"{StaticResource GlyphClose}"
/>
</
telerik:RadButton
>
</
telerik:RadWatermarkTextBox.AdditionalContent
>
</
telerik:RadWatermarkTextBox
>
When the RadPane is hidden on start up, I get the following binding error:
Cannot find source for binding with reference 'ElementName=_ctlTextBox_Filter'. BindingExpression:(no path); DataItem=null; target element is 'RadButton' (Name=''); target property is 'CommandTarget' (type 'IInputElement')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=_ctlTextBox_Filter'. BindingExpression:Path=Text; DataItem=null; target element is 'RadButton' (Name=''); target property is 'Visibility' (type 'Visibility')
When I visualize the RadPane again, the clear button is still visible although no text was entered. I can use the Loaded-Event of my UserControl to hide the clear button again, but I don't know what.
Can you help me with that?
Thanks!
Tobias
Hello Peter,
Thank you for the provided code snippet.
I have observed the error. When the pane is added and hidden, the RadWatermarkTextBox is still not loaded but the binding is evaluated. You can work around this by using the AdditionalContentTemplate property. This way the binding will be evaluated when the control is loaded.
<telerik:RadWatermarkTextBox x:Name="_ctlTextBox_Filter" Width="120"
TextChanged="OnTextBoxFilterTextChanged"
WatermarkContent="{lex:Loc IDS_NO_FILTER_ACTIVE}"
WatermarkBehavior="HideOnTextEntered">
<telerik:RadWatermarkTextBox.AdditionalContentTemplate>
<DataTemplate>
<telerik:RadButton Padding="0" Margin="0,4"
Command="telerik:RadWatermarkTextBoxCommands.Clear"
CommandTarget="{Binding ElementName=_ctlTextBox_Filter}"
IsBackgroundVisible="False"
Visibility="{Binding Text, ElementName=_ctlTextBox_Filter, Converter={StaticResource NullToVisibilityConverter}}">
<telerik:RadGlyph Glyph="{StaticResource GlyphClose}"/>
</telerik:RadButton>
</DataTemplate>
</telerik:RadWatermarkTextBox.AdditionalContentTemplate>
</telerik:RadWatermarkTextBox>
Using the above approach I did not observe any binding error on my side. Give this a try and let me know how it goes.
Regards,
Dinko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Hello Dinko,
that does the trick, thank you very much!
Cheers!
Tobias