This question is locked. New answers and comments are not allowed.
I'm trying to implement a RadGridView-based Silverlight usercontrol which will accept data which is originally generated from DataSets on the server.
In order to do this, I serialize the data and the schema of the DataSet and pass it through the webservice.
On the client, I've managed to extract the schema, and create the correct set of GridViewDataColumn. Each GridViewDataColumn will have their UniqueName set appropriately.
That part works fine, but binding the actual data doesn't work as well.
The code is a little too complex to send, but here's a simple example:
Here's the XML representing the actual data:
In this case, I have created 8 columns, with UniqueName "Id", "ConfigLevel", "Name", etc.
I then use Linq to XML to extract individual "XElement":s, where is XElement represents a separate row in the table, e.g.:
I add each such XElement to an ObservableCollection<XElement> collection, and set the grid's ItemsSource to this collection.
The output is the correct number of columns and rows. The data though is wrong - one column ("Name") contains the text "Table", whereas the "Value" -column contains all elements' text-content (e.g. "7f575607-b408-4363-8091-a5ec35ccb359-2 - InfoWeaver Samples.Sample Config 1Sample Config 1123varchar(32)VM-WSS\Administrator2009-01-12T14:21:31.657+01:00")
I'm sure there's an easy way to do this, but I'm new to both Silverlight and Linq.
Any ideas?
In order to do this, I serialize the data and the schema of the DataSet and pass it through the webservice.
On the client, I've managed to extract the schema, and create the correct set of GridViewDataColumn. Each GridViewDataColumn will have their UniqueName set appropriately.
That part works fine, but binding the actual data doesn't work as well.
The code is a little too complex to send, but here's a simple example:
Here's the XML representing the actual data:
| <DataSet> |
| <Table> |
| <Id>7f575607-b408-4363-8091-a5ec35ccb359</Id> |
| <ConfigLevel>-2 - InfoWeaver Samples.</ConfigLevel> |
| <Name>Sample Config 1</Name> |
| <Description>Sample Config 1</Description> |
| <Value>123</Value> |
| <DataType>varchar(32)</DataType> |
| <Modified_x0020_by>VM-WSS\Administrator</Modified_x0020_by> |
| <Modified_x0020_at>2009-01-12T14:21:31.657+01:00</Modified_x0020_at> |
| </Table> |
| <Table> |
| <Id>db17b7ab-10d2-4498-ab6d-c0d0ab17f38d</Id> |
| <ConfigLevel>-2 - InfoWeaver Samples.</ConfigLevel> |
| <Name>Sample Config 2</Name> |
| <Description>Sample Config 2</Description> |
| <Value>1</Value> |
| <DataType>bit</DataType> |
| <Modified_x0020_by>VM-WSS\Administrator</Modified_x0020_by> |
| <Modified_x0020_at>2008-11-28T15:23:54+01:00</Modified_x0020_at> |
| </Table> |
| ... |
| </DataSet> |
I then use Linq to XML to extract individual "XElement":s, where is XElement represents a separate row in the table, e.g.:
| <Table> |
| <Id>7f575607-b408-4363-8091-a5ec35ccb359</Id> |
| <ConfigLevel>-2 - InfoWeaver Samples.</ConfigLevel> |
| <Name>Sample Config 1</Name> |
| <Description>Sample Config 1</Description> |
| <Value>123</Value> |
| <DataType>varchar(32)</DataType> |
| <Modified_x0020_by>VM-WSS\Administrator</Modified_x0020_by> |
| <Modified_x0020_at>2009-01-12T14:21:31.657+01:00</Modified_x0020_at> |
| </Table> |
The output is the correct number of columns and rows. The data though is wrong - one column ("Name") contains the text "Table", whereas the "Value" -column contains all elements' text-content (e.g. "7f575607-b408-4363-8091-a5ec35ccb359-2 - InfoWeaver Samples.Sample Config 1Sample Config 1123varchar(32)VM-WSS\Administrator2009-01-12T14:21:31.657+01:00")
I'm sure there's an easy way to do this, but I'm new to both Silverlight and Linq.
Any ideas?