I have the following XAML code as part of a custom control:
<telerik:RadTreeView x:Name="treeModules">
<telerik:RadTreeView.ItemTemplate>
<core:HierarchicalDataTemplate ItemsSource="{Binding Submodules}">
<local:ModuleInfoUserControl IsReadOnly="{Binding ElementName=ctrlIsReadOnly, Path=IsReadOnly}"/>
</core:HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>
</telerik:RadTreeView>
Where:
- The
ItemsSource
property oftreeModules
is set by code to a list ofModule
objects. TheModule
class has a property namedSubmodules
, which consists on a collection of more Modules. ModuleInfoUserControl
is a custom control used to display module information.IsReadOnly
is a dependency property declared on the control.ctrlIsReadOnly
is a hidden TextBox defined elsewhere in the main user control. It is used to make a bunch of controls editable or read only.
The problem: binding to ctrlIsReadOnly
element in ModuleInfoUserControl
does not work. The IsReadOnly
property of it is always at its default state, even if the corresponding property of crlIsReadOnly
changes.
But, if I change the RadTreeView into a standard Silverlight TreeView, and the HierarchicalDataTemplate into the standard Silverlight version too, it works as expected.
Ok, up to here I have pasted an exact copy of the support ticket I have sent to Telerik in the hope that they could help me. I must say that the reply has been quick and as efficient as it could be: they have said me that they could not reproduce the bug, and have send me a small test project that exercises the offending piece of code. The test project shows the bug on my machine, but works on Telerik's.
And here comes the really strange part. I have published Telerik's sample project on my personal site. Here is the link:
http://www.konamiman.com/TelerikTest/TestPage.html
The idea is that when pressing the "ToggleIsReadOnly" button, the "Root" TextBox should become read-only. But again, it works on Telerik's machines, but not on mine! So the application code itself is apparenly ok.
Thinking that it could be a problem on my machine's Silverlight runtime, I have tested a bunch of others, including: Spanish Windows 7 32 and 64 bits, Spanish Windows XP, English Windows Server 2008, and even on my wife's computer with Japanese Windows XP. On all of these, it does NOT work as expected.
So, what's happening here? I am completely stuck.
By the way, Silverlight Runtime I'm using is version 3.0.50106.0.
UPDATE: I have uploaded the source code of the test project as well. Here is the URL: