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 == null) return; |
| // 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