Ive been having these problems for a long time and i'm starting to get desperate. I'm gonna try to explain the assignment so you can maybe give a good solution.
I'm creating a silverlight app to display Assets into a GISMAP.To do this i load them into a Radtreeview.
Now because i have to use Async webservices i can't use my recursive method anymore and i can only show 1 parent with his children ( PROBLEM 1)
first i get the requested asset
this is my completed eventhandler in which i get the children from that parent
Then i want to load pictures for every asset in the treeview and enable loadondemand for every asset that has children ( i included a property HasChildren in the SimpleAssetData object to make it easier ) ( PROBLEM 2 )
i tried alot
does not work
doesn't work either
Please Help
I'm creating a silverlight app to display Assets into a GISMAP.To do this i load them into a Radtreeview.
Now because i have to use Async webservices i can't use my recursive method anymore and i can only show 1 parent with his children ( PROBLEM 1)
first i get the requested asset
void OnGetAssetSimpleCompleted(object sender, GetAssetSimpleCompletedEventArgs e) |
{ |
SimpleAssetData parent = e.Result; |
tvAssetOverview.Items.Add(parent); |
RadTreeViewItem parentTree = tvAssetOverview.ItemContainerGenerator.ContainerFromIndex(0) as RadTreeViewItem; |
// kinderen ophalen |
assetProxy.GetChildrenSimpleAsync(_assetID, _assetType); |
} |
this is my completed eventhandler in which i get the children from that parent
void OnGetChildrenSimpleCompleted(object sender2, GetChildrenSimpleCompletedEventArgs e2) |
{ |
if (currentItem == null) |
{ |
currentItem = tvAssetOverview.ItemContainerGenerator.ContainerFromIndex(0) as RadTreeViewItem; |
} |
SimpleAssetData asset2 = currentItem.Item as SimpleAssetData; |
currentItem.DefaultImageSrc = "Images/" + asset2.AssetType.ToString() + ".png"; |
currentItem.IsLoadingOnDemand = false; |
foreach (SimpleAssetData asset in e2.Result) |
{ |
currentItem.Items.Add(asset); |
} |
tvAssetOverview.ExpandAll(); |
currentItem = null; |
CheckItems(); |
} |
Then i want to load pictures for every asset in the treeview and enable loadondemand for every asset that has children ( i included a property HasChildren in the SimpleAssetData object to make it easier ) ( PROBLEM 2 )
i tried alot
RadTreeViewItem parentItem = tvAssetOverview.ItemContainerGenerator.ContainerFromIndex(0) as RadTreeViewItem; |
string path = ""; |
foreach (SimpleAssetData item in parentItem.ItemsSource) |
{ |
path = parentItem.ToString() + "|" + item.ToString(); |
RadTreeViewItem treeViewItem = tvAssetOverview.GetItemByPath(path); |
treeViewItem.DefaultImageSrc = "Images/" + item.AssetType.ToString() + ".png"; |
} |
RadTreeViewItem parentItem = tvAssetOverview.ItemContainerGenerator.ContainerFromIndex(0) as RadTreeViewItem; |
for (int i = 0; i < parentItem.Items.Count; i++) |
{ |
RadTreeViewItem childItem = parentItem.ItemContainerGenerator.ContainerFromIndex(i) as RadTreeViewItem; |
//SimpleAssetData assetData = childItem.Item as SimpleAssetData; |
//childItem.DefaultImageSrc = "Images/" + assetData.AssetType.ToString() + ".png"; |
if ((childItem.Item as SimpleAssetData).HasChildren == true) |
{ |
childItem.IsLoadingOnDemand = true; |
} |
} |
Please Help