You can create HierarchalTemplates for your RadTreeView that bind to selections through a dependency property called ContainerBindings. The ContainerBindings is of type ContainerBindingCollection as shown below. You can put your binding for your ViewModel inside this collection.
<telerikControls:ContainerBindingCollection x:Name="SelectedItemBinding">
<telerikControls:ContainerBinding PropertyName="IsSelected" Binding="{Binding IsSelected, Mode=TwoWay}" />
</telerikControls:ContainerBindingCollection>
Now your HierarchalDataTemplate looks like this:
<telerikControls:HierarchicalDataTemplate x:Key="MyItemsTemplate"
telerikControls:ContainerBinding.ContainerBindings="{StaticResource SelectedItemBinding}">
<Border Opacity="{Binding Opacity}" >
<Grid>
<TextBlock Margin="10,0,5,0" Text="{Binding Name}" />
</Border>
</telerikControls:HierarchicalDataTemplate>
And your RadTreeView looks like this, referring to the items template described above:
<telerikNavigation:RadTreeView x:Name="myTreeView" Grid.Row="1" dragDrop:RadDragAndDropManager.AllowDrag="True"
Background="Black"
ItemTemplate="{StaticResource MyItemsTemplate}"
ItemsSource="{Binding MyItemsInTheViewModel}"
SelectionMode="Extended"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
ItemContainerStyle="{StaticResource MyRadTreeViewItemStyle}"/>
Inside your ViewModel for your item (the data context of the item in your view, and not the data context for your treeview collection), you would have the property:
private bool isSelected;
public bool IsSelected
{
get { return isSelected; }
set
{
isSelected = value;
RaisPropertyChanged(this, "IsSelected");
}
}

Mahesh ChandPosted Mar 1, 2010, 9:32 PM
Are you having problem posting a comment on the blogs?
VictorPosted Mar 1, 2010, 6:52 AM
Hi Mike, Sorry!!! But.. I have tried many times sending you this concern through proper comment (Creating a Blog in ASP.NET and C#). But I got error msg evry time. Can you PLEASE mail me the code file at my email: [email protected] as I am not able to download it from there. This is the code I was looking for means reading, writing and appending data in xml file like this