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

telerik: containerBindingCollection

8 Answers 347 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
alino
Top achievements
Rank 1
alino asked on 22 Oct 2010, 04:35 PM
Hi,

I want to know the equivalent mecanism in WPF to bind Property  of the TreeView and TreeViewItems with properties in the ViewModel using MVVM pattern. For Example in silverlight  I do such and work perfectly:

<telerik:ContainerBindingCollection x:Name="BindingProperties">
   <telerik:ContainerBinding PropertyName="IsLoadOnDemandEnabled" Binding="{Binding Path=Expand, Mode=TwoWay}" />
 <telerik:ContainerBinding PropertyName="IsDropAllowed" Binding="{Binding Path=DropAllowed, Mode=TwoWay}"/>
</telerik:ContainerBindingCollection>

But this one doesn t work in WPF. Can U tell me how to adapt this in the WPF context??

Thank U for your Help

Alino

8 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 22 Oct 2010, 05:34 PM
Hi alino,

The ContainerBindingColelction is available only in Silverlight, since in WPF you can bind properties in Style. So in your case you can try this:
<telerik:RadTreeView x:Name="radTreeView" >
    <telerik:RadTreeView.ItemContainerStyle>
        <Style TargetType="telerik:RadTreeViewItem">
            <Setter Property="IsLoadOnDemandEnabled"
                Value="{Binding Path=Expand, Mode=TwoWay}" />
            <Setter Property="IsDropAllowed"
                Value="{Binding Path=DropAllowed, Mode=TwoWay}" />
                </Style>
    </telerik:RadTreeView.ItemContainerStyle>
</telerik:RadTreeView>
Give it a try and let us know if you need more info.

Kind regards,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
alino
Top achievements
Rank 1
answered on 27 Oct 2010, 04:49 PM
Hi Tina,

Thank U for your Help, now it s working

Best regards;

Alino
0
senthil
Top achievements
Rank 1
answered on 10 Feb 2011, 02:10 PM
Hi Tina

I am Facing Same Problem

Iam Using  Rad Treeview Custome control it contains style Everthing So  I could not give ItemContainerStyle in Consume Page Once I give ItemContainerStyle That will Affect my own style

Just I drag and drop it

Then Create a Node with Check box but Check box is not Selected

This is our Consume Page Xaml

<local:

TreeView x:Name="RadTreeView1" ToolTip="Enter Name" Height="500" Width="300" ItemsOptionListType="CheckList" IsOptionElementsEnabled="True" > </local:TreeView>

Please help me

Regards
SenthilNathan.S
0
Tina Stancheva
Telerik team
answered on 10 Feb 2011, 02:43 PM
Hi senthil,

I am not sure how exactly your local:TreeView control is defined and therefore I cannot be sure what is causing you issue but if the RadTreeView is databound, basically you can bind the CheckState property of the RadTreeViewItem using a StyleBinding, like explained here.

Since the ItemContainerStyle property defines a style for the RadTreeViewItems of a databound RadTreeView, you need to set this proeprty to a style with target type RadTreeViewItem. And if you have already defined such a style, for example RadTreeViewItemStyle, you can set the ItemContainerStyle to: ItemContainerStyle={StaticResource RadTreeViewItemStyle} and modify the RadTreeViewItemStyle to define a binding for the CheckState property of the items.

I hope this info will help you. Let us know if we can further assist you.

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
Mike
Top achievements
Rank 1
answered on 16 Aug 2011, 08:52 PM
I’m working with RadTileView and using RadFluidContentControl to handle three different templates based 
on the TileViewItem state. The solution is C# WPF MVVM Prism.
I have looked at 279380_Example solution you provided for MVVM which is using Silverlight  
Telerik ContainerBindingCollection  which does not work in WPF.
 
Is there any sample project that show this functionality in WPF? I’m looking to do something similar 
to the TileView Demo with the flags where in the minimized template I have a short description but
when a TileViewItem is maximized display a detailed information.
 
Thank you. 
0
Zarko
Telerik team
answered on 19 Aug 2011, 01:26 PM
Hi Mike,
Could you please examine the attached project and if you have more questions feel free to ask?

Greetings,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Michael Gaigg
Top achievements
Rank 1
answered on 21 Nov 2011, 08:53 PM
you probably want to update the WPF sample code that you ship with Q3

in FirstLook example.xaml of treeview

        <Style TargetType="telerik:RadTreeViewItem">
            <Setter Property="FontWeight" Value="Normal" />
            <Setter Property="IsExpanded" Value="{Binding IsActive}" />
            <Setter Property="IsSelected" Value="{Binding IsActive}" />
        </Style>

isExpanded and IsSelected are missing - still having the containerBindingCollection in there (the online sample is ok)
0
Tina Stancheva
Telerik team
answered on 22 Nov 2011, 10:10 AM
Hello Michael,

Thank you for bringing this issue to our attention. We will remove the ContainerBinding definitions from the WPF solution.

I updated your Telerik account for this report.

Best wishes,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TreeView
Asked by
alino
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
alino
Top achievements
Rank 1
senthil
Top achievements
Rank 1
Mike
Top achievements
Rank 1
Zarko
Telerik team
Michael Gaigg
Top achievements
Rank 1
Share this question
or