OK... I have kindof a sepecialised case. I am getting log data back from a DB that has 5 static properties and then any number of variable properties. The class looks like this:
Prop 1, prop 2, prop 3, collection of properties 4-n... all possible properties are known.
Based on the type of log, properties 4-n will be different, again, all possible properties will be known.
The values of these properties will always be text.
binding properties 1-3 are easy... but is it possible to bind column values to items within a sub collection? for example, key="{Binding PropCollection.Prop4}"
Thanks in advance for any help
Marc
I had the same problem, and this approach seamed to work great. one issue is now if i drag a column into the group by area ir gives the follow error:
Unhandled Error in Silverlight Application Object reference not set to an instance of an object. at Infragistics.Silverlight.DataManagerBase.ResolvePropertyTypeFromPropertyName(String propertyName, Type rootType)\n at Infragistics.Silverlight.GroupByContext.CreateGenericCustomGroup(Type type, String propertyName, Object comparer)\n at Infragistics.Silverlight.RowsManager.InvalidateGroupBy(Boolean reset)\n at Infragistics.Silverlight.XamWebGridRowsManager.InvalidateGroupBy(Boolean reset)\n at Infragistics.Silverlight.RowsManager.OnColumnLayoutPropertyChanged(ColumnLayout layout, String propertyName)\n at Infragistics.Silverlight.XamWebGridRowsManager.OnColumnLayoutPropertyChanged(ColumnLayout layout, String propertyName)\n at Infragistics.Silverlight.RowsManagerBase.a(Object A_0, PropertyChangedEventArgs A_1)\n at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)\n at Infragistics.Silverlight.DependencyObjectNotifier.OnPropertyChanged(String name)\n at Infragistics.Silverlight.Controls.ColumnLayout.InvalidateGroupBy()\n at Infragistics.Silverlight.Controls.GroupByColumnsCollection.OnGroupingChanged(IList`1 oldCollection, IList`1 newCollection)\n at Infragistics.Silverlight.Controls.GroupByColumnsCollection.AddItem(Int32 index, Column item)\n at Infragistics.Silverlight.CollectionBase`1.Add(T item)\n at Infragistics.Silverlight.Controls.Column.set_IsGroupBy(Boolean value)\n at Infragistics.Silverlight.Controls.Primitives.HeaderCellControl.OnMouseLeftButtonUpColumnMoving(MouseButtonEventArgs e)\n at Infragistics.Silverlight.Controls.Primitives.CellControlBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)\n at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)\n at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
any ideas?
I actually have a more elegant solution to your problem and it does not involve writing any custom classes. I wrote a blog post on this issue. The blog is geared towards the DataGrid from the Silverlight Toolkit, but you can easily modify it to use the XamWebGrid like I do.
The solution is here.
Let me know if this is what you were looking for.
Hi,
We currently haven't come up with a solution for data manipulations for bindings with columns created from items in a collection.
We do now support it for properties of complex types.
public class MyData
{
public ComplexData Data{get; set;}
}
public class ComplexData
public string Name {get; set;}
<ig:TextColumn Key = "Data.Name" />
As soon as we are able to come up with a solution to handle this, we'll be sure to update this thread.
-SteveZ
I have implementeed this successfully in our products however I am extremely interested in leveraging the full functionality of the xamlgrid while using this approach. Have you made any progress getting sorting and groupping to work with this type dynamic property binding?
Do you have any other suggestions that would acheive the same binding functionality while maintaining full functionality?
Thanks.
MyDataObject isn't real data. Its just some dummy data.
If you were bound to a collection of objects of type Customer, you would replace MyDataObject with Customer.
This was suggested as solution for someone, that needed to access a specific property on their data, which required it to be cast as that object.
I hope this clears things up.