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?
Hello,
This is in progress. I will update with more information soon.
Thank you,Sam
thank you. It seems this works on one of our developers machines but not on the others. We are all using the lastest release and hotfix.
I wanted to check and see if this was still an issue since it worked on some computers and not others, I would think maybe a pltform related issue. Have you had chance to look and compare them?
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?
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.