I have gotten as far as binding my xamgrid to my RIA data source.. it looks pretty good except I am having trouble getting the heirarchy working properly. Attached is a screencap of my .edmx and data source on the client along with what the grid looks like.
I can't figure out why modifiedstamp doesn't show up on the main row but as a child?
I also can't figure out why Supervises doesn't show up as a child band?
I'm used to the winforms infragistics grid so maybe I'm just going about things the wrong way.
If someone can point me at a heirarchical RIA xamgrid example that would get me going too.
Hi,
What you define in the DataSources window won't map to the xamGrid. This is a limitation of VS.
A Columnlayout (i.e. childband) is autoGenerated when a property in your data is of type IEnumerable. I don't know what type modifiedStamp is, however, it's most likely an IEnumerable of some sort. As for Supervises, its hard to say without actually knowing its type.
However, your best bet is probably to manually create your columns instead of AutoGeneration.
http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=SL_xamGrid_Columns.html
http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=SL_xamGrid_Define_Column_Layout.html
-SteveZ
SteveZ, thanks so much for your help..
ModifiedStamp is mapped to a SQL timestamp column and is of type System.Byte[] which I suppose would explain why it's showing up as a child band.
Supervises is of type System.ServiceModel.DomainServices.Client.EntityCollection<UserRelationship> where UserRelationship is another EF class. EntityCollection implements IEnumerable.
In my reading I discovered the default behaviour of WCF RIA is to NOT send child collections even if they are eagerly loaded on the server. You can force it with the [Include] tag but it sounds like the whole thing is really designed around lazy loading. I suspect this is why my child bands didn't show up.
I'd like to understand autogeneration a little better before I give up on it.. is there a way to prevent autogeneration of specific child bands or columns? For example on my ModifiedStamp? Or is there some way to hide them like I used to with the winform ultragrid? Also does autogeneration support EntityCollection<> ?
Greg
Hi Greg,
Sure you can absolutely handle this with out turning AutoGeneration off, and in the 11.1 release you'll be able to do even more as we added support for more DataAnnotation attributes.
But for right now, in 10.1 - 10.3 the xamGrid supports: the DisplayAttribute's AutoGenerateField
[DisplayAttribute(AutoGenerateField=false)]public bool YourProperty{get;set}
Another option is to define the column in xaml, and set it's Visibility property to hidden.
If you want more control on the column type that is used for a particular property type, you can use the Column Type Mappings feature: http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=SL_xamGrid_Change_Column_Type_Mapping.html
If you want to read more about all the different columns in the xamGrid you can check out this help article:
Hope this helps,
SteveZ,
Thanks that did the trick, I got everything working now. One thing that is NOT straightforward is adding attributes to the generated EF classes. You need to make a partial class of the generated class with another class inside that has declarations that match the generated class which you can then decorate. Example of how I did it follows:
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.ComponentModel.DataAnnotations; namespace Planning.Web{ [MetadataTypeAttribute(typeof(OlmUser.OlmUserMetadata))] public partial class OlmUser { internal sealed class OlmUserMetadata { [DisplayAttribute(AutoGenerateField = false)] public global::System.Byte[] ModifiedStamp { get; set; } } }}
(see http://www.telerik.com/help/openaccess-orm/getting-started-root-quickstart-sl-wcfria-add-metadata-class.html)