Hi there,
we want to bind a list of objects to a xamDataGrid. So far so easy! xamDataGrid is showing the items of the list as rows in the grid with the public properties as columns.
Actually I want to flip rows and columns. Because my real intention is to do the following: Each list item should be shown as a column. The list item has a property of type list that we want to display as rows.
Does anyone have any hints how to achieve this?
Thanks in advance,
Florian
Thanks for spending time. It is not the answer I wanted to hear, but it's a statement.
regards,
Florian,
Someone else can correct me, but I think you should consider reconfiguring your business classes. The XamDataGrid is not intended to work this way.
Hi Alex,
thanks for your reply. It does not work or I am not able to get it work. So I did the following:
I bound the MyDataContainer.columnsDataObject to the DataSource of the xamDataGrid. By default I saw the items of the list which were expandable. If I expand the item you could see the ValueObjects.
By using your suggested solution, I am not sure which collecton I should bind (I think it should be that Id in your example is the columnsDataObject in my example). I do not even get one row.
Below you'll find the simplified objects I use:
class MyDataContainer
{
List<MyColumnObjects> columnsDataObject;
}
class MyColumnObjects
List<ValueObject> valueObjectList;
May be you got another idea! Otherwise I need to rearange by classes. :(
Hello Florian,
I am not sure if this is possible, you can try with unbound fields and set their binding path property:
UnboundField ub = new UnboundField();
ub.BindingPath = new PropertyPath(String.Format(CultureInfo.InvariantCulture,"Ids[{0}]", i));
ub.Label = String.Format(CultureInfo.InvariantCulture, "Ids[{0}]", i);
e.FieldLayout.Fields.Add(ub);
where the Ids is the collection.