Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
Displaying the value in an object added as value in a DataRow Cell in grid.
posted

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...

Parents
  • 69686
    posted

    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; }

        }

Reply Children
No Data