Dear All,
I have the following implementation for treeview using EF4, I tried to do the same using OA but with no luck, here we go:
On EF4 dmx diagram I have the following setting for my group table:
Parent: 0..1 (Zero or One)
Children: * (Many)
which are define as association on the group table.
I then have this xaml for the itemtemplate
Also this is the treeview xaml showing the binding to the groupcollection
In my ViewModel I have a QueryableDomainServiceCollectionView<group> GroupCollection to hold the list of groups from the domainservice using the following method on the domainservice:
I also have this method to get the subgroups when the treeview get expanded (loaded Ondemand);
I can't do the same implementation on the OA domainservice.
How can I achieve this scenario in treeview & OA.
Best regards
I have the following implementation for treeview using EF4, I tried to do the same using OA but with no luck, here we go:
On EF4 dmx diagram I have the following setting for my group table:
Parent: 0..1 (Zero or One)
Children: * (Many)
which are define as association on the group table.
I then have this xaml for the itemtemplate
<
telerik:HierarchicalDataTemplate
x:Name
=
"ItemTemplate"
ItemsSource
=
"{Binding Children}"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"16"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
TextBlock
x:Name
=
"Label"
Text
=
"{Binding groupname}"
Grid.Column
=
"1"
/>
</
Grid
>
</
telerik:HierarchicalDataTemplate
>
<
telerik:RadTreeView
x:Name
=
"Treeofgroups"
FontSize
=
"11"
Grid.Row
=
"1"
IsLineEnabled
=
"True"
ItemTemplate
=
"{StaticResource ItemTemplate}"
IsLoadOnDemandEnabled
=
"True"
LoadOnDemand
=
"ItemExpanded"
SelectedItem
=
"{Binding CurrentSelected,Mode=TwoWay}"
ItemsSource
=
"{Binding GroupCollection,Mode=TwoWay}"
</telerik:RadTreeView>
In my ViewModel I have a QueryableDomainServiceCollectionView<group> GroupCollection to hold the list of groups from the domainservice using the following method on the domainservice:
public
IQueryable<group> Getgroups()
{
return
this
.ObjectContext.group.Include(
"Children"
).Where(p => p.parentid ==
null
|| p.parentid ==
""
);
}
I also have this method to get the subgroups when the treeview get expanded (loaded Ondemand);
public
IQueryable<group> GetChildrenByParentID(
string
parentID)
{
return
this
.ObjectContext.group.Include(
"Children"
).Where(p => p.parentid == parentID);
}
I can't do the same implementation on the OA domainservice.
How can I achieve this scenario in treeview & OA.
Best regards