I have 5 levels of entity objects to display in a xamdatatree, and I need them to display in a sorted order. I can't make an entityCollection sort without throwing errors, so I maked those lists with [Display(AutoGenerateField = false)] and added a property that returns a list of the lower level entites in the sorted order.
//simplifed example
public partial class EntityA : IComparable<EntityA>{
[Include] [Display(AutoGenerateField = false)] public EntityCollection<EntityB> SubItems { get; set; }
public List<EntityB> SortedBList { get { List<EntityB> list = new List<EntityB>(SubItems); list.Sort(); return list; } }
public string Name { get; set; }
public int CompareTo(EntityA other) { return Name.CompareTo(other.Name); }}
<ig:XamDataTree ItemsSource="{Binding SortedAList}"> <ig:XamDataTree.GlobalNodeLayouts> <ig:NodeLayout Key="ALayout" TargetTypeName="EntityA" DisplayMemberPath="Name" /> <ig:NodeLayout Key="BLayout" TargetTypeName="EntityB" DisplayMemberPath="Name" /> <ig:NodeLayout Key="CLayout" TargetTypeName="EntityC" DisplayMemberPath="Name" /> <ig:NodeLayout Key="DLayout" TargetTypeName="EntityD" DisplayMemberPath="Name" /> <ig:NodeLayout Key="ELayout" TargetTypeName="EntityE" DisplayMemberPath="Name" />
</ig:XamDataTree.GlobalNodeLayouts> </ig:XamDataTree>
Though all the objects are all set up this way, only the list under the root entity is using the sorted list property to display, the others use the entitycollection, dispite the [Display(AutoGenerateField = false)] tag (Not sure if this control actually takes that tag into account or not)
Is there any way to make the control use one list over the other? Or is there any way to sort the itmes in the control?
Hi,
It seems like you need to change your XAML as follows:
<ig:XamDataTree ItemsSource="{Binding SortedAList}"> <ig:XamDataTree.GlobalNodeLayouts> <ig:NodeLayout Key="ALayout" TargetTypeName="EntityA" DisplayMemberPath="Name" /> <ig:NodeLayout Key="SortedBList" TargetTypeName="EntityB" DisplayMemberPath="Name" /> <ig:NodeLayout Key="SortedCList" TargetTypeName="EntityC" DisplayMemberPath="Name" /> <ig:NodeLayout Key="SortedDList" TargetTypeName="EntityD" DisplayMemberPath="Name" /> <ig:NodeLayout Key="SortedEList" TargetTypeName="EntityE" DisplayMemberPath="Name" />
HTH
sorry for the late reply on this, we've suspended work on this section for the time being, so we don't need any assistance at this time. Thank you for your time
Hello,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Excuse me for the late reply. I have been investigating your issue and had to double check with development on it and there is indeed functionality for using the tags. I was wondering if you could please provide me with a sample of your data or a test project so I am sure there is no misunderstanding whatsoever and I can continue investigating . Also it would be really helpful if you could try and isolate the environments you got the different behaviors in.
Looking forward to hearing from you.
We have been looking, but as of yet we can't find the difference that would account for this. Can you confirm which behaviour is the correct one? Should the xamdatatree be ignoring the collection marked with autogenerate=false?