This question is locked. New answers and comments are not allowed.
I currently have a Treeview component with checkboxes. How can I continue to display the checkboxes but also enable/disable the ability to edit the state based on a binding property?
Thanks,
Karl
Thanks,
Karl
7 Answers, 1 is accepted
0
Hi Karl,
You can edit the default ControlTemplate of the RadTreeViewItem in ExpressionBlend following the approach described here. Then you can bind the IsEnabled property of the CheckBoxElement accordingly:
I prepared a sample project illustrating this suggestion. Give it a try and let us know if it works for you or if you need more info.
Best wishes,
Tina Stancheva
the Telerik team
You can edit the default ControlTemplate of the RadTreeViewItem in ExpressionBlend following the approach described here. Then you can bind the IsEnabled property of the CheckBoxElement accordingly:
<!--TreeViewItemDefaultTemplate-->
<
ControlTemplate
x:Key
=
"TreeViewItemDefaultTemplate"
TargetType
=
"telerik:RadTreeViewItem"
>
<
Grid
x:Name
=
"RootElement"
>
...
<!--CheckBoxElement-->
<
CheckBox
x:Name
=
"CheckBoxElement"
Grid.Column
=
"2"
IsTabStop
=
"False"
Margin
=
"5,0,0,0"
telerik:StyleManager.Theme
=
"{StaticResource Theme}"
Visibility
=
"Collapsed"
VerticalAlignment
=
"Center"
IsEnabled
=
"{Binding CheckEnabled}"
/>
...
</
ControlTemplate
>
I prepared a sample project illustrating this suggestion. Give it a try and let us know if it works for you or if you need more info.
Best wishes,
Tina Stancheva
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Karl
Top achievements
Rank 1
answered on 18 Jan 2011, 03:21 PM
Hi Tina,
Thank you for the demo, it works as I expected.
Karl
Thank you for the demo, it works as I expected.
Karl
0
Manoj
Top achievements
Rank 1
answered on 07 Mar 2012, 04:40 PM
I am using this approach. It is working But i need to bind IsChecked property too. I have tried as follows but not working.
Please suggest. Its urgent for me.
<!--CheckBoxElement-->
<CheckBox x:Name=
"CheckBoxElement"
Grid.Column=
"2"
IsTabStop=
"False"
Margin=
"5,0,0,0"
telerikrad:StyleManager.Theme=
"{StaticResource Theme}"
Visibility=
"Collapsed"
VerticalAlignment=
"Center"
IsEnabled=
"{Binding CheckEnabled}"
IsChecked=
"{Binding IsCheckChecked}"
/>
0
Manoj
Top achievements
Rank 1
answered on 09 Mar 2012, 07:15 PM
Hi Telerik Team,
I am waiting from 2 days for answer. Please reply its urgent.
I am waiting from 2 days for answer. Please reply its urgent.
0
Hi Manoj,
So you have to bind the CheckState instead , like so:
You can find this realized in the attached solution. However, if you need to use TriState behavior and bind the CheckState too, you have to implement the TriState logic in the ViewModels since there is known related issue in the RadTreeView.
We strongly suggest you to submit a support ticket if you need to take advantage of our priority (24) support. Thank you for your understanding. Kind regards,
Petar Mladenov
the Telerik team
In this case you cannot use the CheckBox to bind its IsChecked property properly, because the Style setting the CheckState has bigger priority.
<
Setter
Property
=
"CheckState"
Value
=
"Off"
/>
<
Setter
Property
=
"CheckState"
Value
=
"{Binding IsCheckChecked, Converter={StaticResource converter}}"
/>
We strongly suggest you to submit a support ticket if you need to take advantage of our priority (24) support. Thank you for your understanding. Kind regards,
Petar Mladenov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Manoj
Top achievements
Rank 1
answered on 12 Mar 2012, 06:28 PM
I am getting following error (In Attachment) in this solution. I am using red silverlight controls - v.2011.3.1116.1040 Dev.
0
Hi Manoj,
Please accept our apology for this misunderstanding. In Silverlight 4 the proper implementation of your scenario is to use ContainerBindings instead of a Style Setter to bind the CheckState property of the RadTreeViewItems:
I updated the solution accordingly. Give it a try on your side and let us know if it works.
Regards,
Tina Stancheva
the Telerik team
Please accept our apology for this misunderstanding. In Silverlight 4 the proper implementation of your scenario is to use ContainerBindings instead of a Style Setter to bind the CheckState property of the RadTreeViewItems:
<
telerik:ContainerBindingCollection
x:Key
=
"TreeViewBindingsCollection"
>
<
telerik:ContainerBinding
Binding
=
"{Binding IsCheckChecked, Converter={StaticResource converter}, Mode=TwoWay}"
PropertyName
=
"CheckState"
/>
</
telerik:ContainerBindingCollection
>
<!-- TreeItemDataTemplate -->
<
telerik:HierarchicalDataTemplate
x:Key
=
"TreeItemDataTemplate"
ItemsSource
=
"{Binding Children}"
telerik:ContainerBinding.ContainerBindings
=
"{StaticResource TreeViewBindingsCollection}"
>
<
StackPanel
>
<
TextBlock
Text
=
"{Binding Header}"
/>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
I updated the solution accordingly. Give it a try on your side and let us know if it works.
Regards,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>