I am using XamWebGrid 10.3. I have code that use to hide some data from the grid, the reason this is done is that we have custom code to pull specialized sum data from the database. I am using the CellControlAttached event to hide the row based on criteria, which is if it GrandTotalInd. When the page load initially it works, but if I change parameters it will give me an error, which I detail below.
{
e.Cell.Row.Height =
new RowHeight(0);
}
however I get an error when having this code Value cannot be infinite or NaN. below you will find the full error:
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Tue, 17 May 2011 06:46:25 UTC
Message: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.ArgumentException: Value cannot be infinite or NaN.
Parameter name: System.Windows.CustomDependencyProperty
at System.Windows.Controls.Primitives.RangeBase.OnMaximumPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
at System.Windows.DependencyObject.SetValue(DependencyProperty property, Double d)
at Infragistics.Controls.Grids.Primitives.RowsPanel.UpdateScrollInfo(Int32 totalRowCount)
at Infragistics.Controls.Grids.Primitives.RowsPanel.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
Line: 55
Char: 13
Code: 0
Hi,
This sounds like something that was fixed a while ago.
Are you using the latest SR?
-SteveZ
This is the version I see we are using: 10.3.20103.1006. We have a work around by which we set the Height to be 1 instead of 0, and we dont get that error. Let me know if this version would have the fix.
A short follow-up on this task.
By using your example Stephen I was able to make GroupBy-rows that contain what I need.
I made a DataTemplate that I attach to the grouped columns in the GroupeByCollectionChanged event, and then let a converter format the value the groupby rows displays (including custom generated sums).
This works very well when my report contains one grouped column only, but as I send the GroupByRow value to the converter:{Binding Value, Converter={StaticResource groupFormatter}}the bound value will not always be unique when more than one column are grouped.
The problem with this is naturally that when I am unable to identify the row, I am also unable find the child-rows that shall be used in my sum-calculations.
My question is therefore: Are there any way to inform the converter of which row in the report that the value comes from.?
Are there for example any other bindings than "Value" (and "Count") that can be used to identify the row?
Regards
Jorvart
Hi Jorvart,
You should use the Records property off of the DataContext, which is an IList of your data objects that fall within in that grouping. Thus you don't need to identify the row.
Hi Stevez,
if we are binding xamgrid with List of objects and have following column bind to some double type property:
<ig:TextColumn Key="MyDouble" HeaderText="My Double" FormatString="{}{0:0.00}" HorizontalContentAlignment="Right" />
It is working fine and even do not crash on NAN vlaues, but it shows NaN which do not looks good, what we can do to show either empty or cutom value say dash (-).
Thanks
The FormatString is just what is going to get given eventually to a ToString on the value, and to my knowledge there isn't a format string that is going to convert NaN to a value.
You could add a ValueConverter to the column which can process your data and convert your NaNs to zeros or empty strings.
Hi Darrell,
Thanks for suggestion, can you give me a simple example to use valueconverter or related link
A ValueConverter implements the IValueConverter interface from MSFT. Attached is sample that demonstrates it's usage.