I created a structure and populated with data and then added that to a column in a DataRow in a Table.I set the dataSource of xamgrid to this DataTable.
Now i am trying to display the data in the fields in the struct object in my grid and i don't know how to access the fields in my DataTemplate to be used in the GridCell
public
struct PivotedData{
public double Sum; public int Count; public double Average;
}
If i use a style for CellValuePresenter how can i access the fields in this structure which is inside a cell in the DataRow?
Can i use a DataTemplate like the following? if so how can i access the fields?
<
DataTemplate DataType="{x:Type my:PivotedData}">
<TextBlock Background="Red" Text=""></TextBlock>
</DataTemplate>
Thanks in Advance...
Hi Alex,
thanks for the reply.What i am trying to achieve is to display the info in the fields in these struct objects that i store in a DataTable whose DataTable column names could be anything..Only thing guranteed is that the actual data in the cells(DataTable)n would be of type PivotedData. I want to display this info in each cell of the grid using a DataTemplate or controlTemplate and i am not sure the Binding Source/path that i should use...
To the best of my knowledge, you would need public properties, so that the XamDataGrid can bind to, something like this:
public struct PivotedData
{
public double Sum {get;set;}
public int Count { get; set; }
public double Average { get; set; }