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
160
TimeSpan and Object values in XamPivotGrid
posted

Hi,

I have two questions about XamPivotGrid:

1) How can I display TimeSpan values, defined in a custom FlatDataSource? I created a class PivotData with a value property of TimeSpan type. Then I fill a List<PivotData> with values, and create a FlatDataSource.
This leaves the PivotGrid values empty (Something like "Drop Data Items here" shows up).

2) Another thing that is somewhat related to this, is that I sometimes need int values, and sometimes need TimeSpan values. I tried to make the PivotData.Value property an "object", but the PivotGrid doesn't work with this either. I can imagine this could be done with a ValueConverter, but I don't really see how I can do this since the binding is on the FlatDataSource object.
Also, this would still not work if the TimeSpan values do not display properly.

PivotData and FlatDataSource:

 

public

 

 

class PivotData
{
   public string Row { get; set; }
   public string Column { get; set; }
   public TimeSpan Value { get; set; }
}


FlatDataSource = new FlatDataSource
{
   ItemsSource = pivotData,
   Cube =
DataSourceBase.GenerateInitialCube("PivotData"),
   Rows =
DataSourceBase.GenerateInitialItems("[Row]"),
   Columns =
DataSourceBase.GenerateInitialItems("[Column]"),
   Measures =
DataSourceBase.GenerateInitialItems("Value")
};


 

 

Parents Reply Children
No Data