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

Explorer style n-level deep TreeView using WCF onLoadDemand

1 Answer 34 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Christian Casutt
Top achievements
Rank 1
Christian Casutt asked on 30 Apr 2010, 08:26 AM

Good day

i've already read:
http://www.telerik.com/support/kb/silverlight/treeview/how-to-bind-radtreeview-to-hierarchical-data-and-use-load-on-demand.aspx
http://blogs.telerik.com/kirilstanoev/posts/08-08-27/Populating_Silverlight_TreeView_from_WCF_Service_with_LINQ_to_SQL.aspx
http://blogs.telerik.com/valerihristov/posts/09-08-26/self-reference_hierarchy_with_telerik_treeview_for_silverlight.aspx

What i need to achieve is, a RadTreeView which is filled by a WCF Service, using the LoadOnDemand Event. I really learned a lot from the mentioned above articles, but still there is one thing i do not understand. Think of Windows Explorer Style TreeView. Which Elements do i need to accomplish a similiar Solution / Style? i mean, some use a ValueConverter, some a HierarchicalDataTemplate other use just a DataTemplate. What i have is an ObservableCollection<ContentData> which has a Property of ObservableCollection<ContentDataList>
The Class

    public class ContentData  
    {  
        public ContentData()  
        {  
            Id = 0;  
            Guid = string.Empty;  
            ArhPath = string.Empty;  
            Date = new DateTime();  
            ImageIndex = 0;  
            MaskId = 0;  
            Name = string.Empty;  
            ParentId = 0;  
            Type = 0;  
            XDate = new DateTime();  
            MaskData=new MaskData();  
            Accessdata=new AccessData();  
            ContentDataList = new List<ContentData>();  
        } 

here i'm filling the Collection on the Server-side

contentData = contentDataList.Where(ContentData => ContentData.Id.Equals(parentFolder.Id)).First(); 

Silverlight code:

       public ViewArchiveTreeControl()  
        {  
            InitializeComponent();  
            if (!Globals.IsDesignTime)  
            {  
                Loaded += ArchiveTreeControl_Loaded;  
            }  
        }  
 
        void ArchiveTreeControl_Loaded(object sender, RoutedEventArgs e)  
        {  
            Session.WcfClient.GetContentDataCompleted += PlanArchivServiceClientGetContentDataCompleted;  
            Session.WcfClient.GetContentDataAsync("1", FOLDERSEARCHTYPE.RootFolder);  
        }  
        void PlanArchivServiceClientGetContentDataCompleted(object sender, GetContentDataCompletedEventArgs e)  
        {  
            if (e.Error != null || e.Result == nullreturn;  
// to be implemented  

in the AsyncCompleted Event i tried various things like binding the the ItemsSource (code behind and declaratively in xaml). but i'm getting stuck when it comes to the part where i need to tell the RadTreeViewControl about it's parent-childern relative.. Did one of you guys something similiar? could you shed a light? do i need to use a ValueConverter or a HierarchicalDataTemplate or something else?

help's really appreciated!

Christian

1 Answer, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 06 May 2010, 11:53 AM
Hi Christian,

We are sorry for the late response.

We prepared a simple application that loads (on demand) a simplified folder-tree structure. Each folder contains a list of files. The folder tree is displayed in the RadTreeView control at left side. If you select a tree-item (i.e. a folder) all its files will be shown in the items control at right-side. To populate the Folder-tree please click on the button at top of the application.

Please give it a try and let us know if you have other question.


Sincerely yours,
Ivan
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.
Tags
TreeView
Asked by
Christian Casutt
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Share this question
or