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

ContainerBindingCollection Not Working WPF

3 Answers 112 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
senthil
Top achievements
Rank 1
senthil asked on 10 Feb 2011, 02:05 PM
Hi

Iam using RadTreeview Custom Control  Then Cosuming the Control  There is one button

When button is Clicked Create one node With Check box   but Check box Came but 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>

 


Then Click Event

 

 

private void AddItem_Click(object sender, RoutedEventArgs e)

 

{

 

 

List<TreeImageCollection> lstTreeImageCollection1 = new List<TreeImageCollection>();

 

 

 

TreeImageCollection objTreeImageCollection = new TreeImageCollection();

 

objTreeImageCollection.ImageID =

 

"200";

 

objTreeImageCollection.ImageSource =

 

"../Images/iDropdownArrowDownHOT.png";

 

objTreeImageCollection.ToolTip =

 

"Hi This my Image ";

 

 

 

//objTreeImageCollection.Alignment = ImageAlignment.Left;

 

lstTreeImageCollection1.Add(objTreeImageCollection);

RadTreeView1.AddNode(

 

"0", "4", "Item ggg004", null, lstTreeImageCollection1, ToggleState.On, false, false, false);

 

}





Regards
SenthilNathan.S

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 10 Feb 2011, 02:27 PM
Hello senthil,

From the code snippet you sent I am not sure how exactly you defined your RadTreeView and what the AddNode() method do.

However if the RadTreeView is databound, basically you can bind the CheckState property of the RadTreeViewItem using a StyleBinding, like explained here.

Give this a try and let us know if it works for you. If not, it would be best to send us a sample project reproducing your issue and we will look further into it.

All the best,
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
senthil
Top achievements
Rank 1
answered on 11 Feb 2011, 07:25 AM
Hi Tina

that is notworking


I Have a TreeView Custom Control

Example  Treeview.Xaml Contains

<

 

 

Style x:Key="RadTreeViewItemStyle" TargetType="local:TreeViewItem">

 

 

 

 

<Setter Property="HorizontalContentAlignment" Value="Left" />

 

 

 

 

<Setter Property="VerticalContentAlignment" Value="Center" />

 

 

 

 

<Setter Property="CheckState" Value="Off" />

 

 

 

 

 

 

</Style>

 

 

<

 

 

Style TargetType="local:iTreeView">

 

 

 

 

 

 

<Setter Property="ItemContainerStyle" Value="{StaticResource RadTreeViewItemStyle}" />

</Style>

in Class File

public clsss Treeview : RadTreeView
{

}

Consume Application look like this

 

 

<local:

 

 

TreeView x:Name="RadTreeView1" ToolTip="Enter Name" Height="500" Width="300"

 

 

 

 

 

ItemsOptionListType="CheckList" IsOptionElementsEnabled="True" >

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

</local:TreeView>

 

0
Petar Mladenov
Telerik team
answered on 16 Feb 2011, 04:25 PM
Hello senthil,

The code you provided seems to be insufficient in order for us to get close to your scenario. However, I'll shoot in the dark and try to advice you. First, the RadTreeView must be bound to ObservableCollection<> since it inherits from INotifyCollectionChanged and INotifyPropertyChanged and this way changes in the ViewModel collection (bound object`s collection) will reflect the RadTreeViewItems. On the other hand, the property in your ViewModel that will be bound to the ToggleState of the RadTreeViewItem should also implement the INotifyPropertyChanged interface. Finally, any runnable sample showing the issue will be highly appreciated and you we could advice you much faster. Thank you for your cooperation.

Kind regards,
Petar Mladenov
the Telerik team
Tags
TreeView
Asked by
senthil
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
senthil
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or