This is a migrated thread and some comments may be shown as answers.

[Solved] Approach for GridView unit scaling?

1 Answer 157 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tim
Top achievements
Rank 1
Tim asked on 20 Dec 2010, 07:40 PM
I have a RadGridView and a ViewModel.  Among the requirements is that the user can change the current unit for the data reported in the Grid.  I.e., the base unit might be in bytes, and they user can request KB, MB, GB, etc.  Right now when they do this, I recompute the bound values by appropriate division.  Unfortunately, this causes a few problems.

1. The Sum aggregate functions (row totals) are no longer accurate since they are summing scaled values at reduced resolution
2. Export to CSV uses the new values, again losing resolution.

Ideally, I'd like to keep everything in bytes, except have (the equivalent of) a DataFormatString which overrides the display in the Grid only.  In the past (i.e., a format string that says 'convert to GB'.)  I've asked for computer-storage sizes in the graphing controls and there wasn't enough interest to get that done.  This is similar.

Further complicating things is that all the columns are generated using the Lightweight DataTable trick you recommended so while I can write a template (in XAML), it has no idea what the binding should be - I get the object with its 15 generated properties but I don't know which property goes in the current column - but I can use an IValueConverter  to do the scaling.

Any suggestions to an approach that works well, and allows me to change the divisor on the fly (I'm OK with generating a whole new DataContext/ViewModel and switching it in) would be extremely helpful!

Thanks,
Tim

1 Answer, 1 is accepted

Sort by
0
Tim
Top achievements
Rank 1
answered on 21 Dec 2010, 01:59 AM
And while I am at it, the RadChart doesn't have scaling in a way that I like either -- If I manually scale, then I lose resolution.  The parts of a stacked bar chart get smaller and smaller as I divide by powers of 1024.  Storage people don't want to see "bil", they want to see "GB", and they mean binary billion, not decimal.

And, because of the removal of the Telerik navigation (all obsolete errors) I cannot move to anything newer than Q1 of this year until I rewrite the entire navigational portion of my application - which is not small and which requires a lot of test effort.

Tim
Tags
GridView
Asked by
Tim
Top achievements
Rank 1
Answers by
Tim
Top achievements
Rank 1
Share this question
or