Hi
I have a XamGrid with 6 column and data from DB. 2 columns are collapsed and one is calculated from the 2 collapsed columns values.
I implemented InitializeRow and when this event i raised want to modify the content that calculated cell.
I have
e.Row.Cells["MyKey"].Content
or
e.Row.Cells["MyKey"].Value
But don't know how to change the value or content.
THanks
Hi,
If you just want to display the calculated value you can use UnboundColumn with a simple value converter.
http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=xamGrid_Unbound_Column.html
Regards
Hi Nokolay
as i'm not an expert programmer.I try explain my problem.
The XamGrid has a DB table as ItemsSource,
In this table there are 2 columns : StartWorkingTime and FinishWorkingTime, which visibility is set to collapsed.
The third and the new column the WorkDuration is the difference beetween FinishWorkingTime and StartWorkingTime.
For example the StartWorkingTime = 14.30 and FinishWorkingTime = 15:00 the WorkDuration will be 00:30.
Thanks let me know
So Nik's suggestion is correct then. You should use an UnboundColumn.
All you would need to do then, is write a IValueConverter that would take the 2 dates, add them together and return them:
public class MVC : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
YourDataObject data = (YourDataObject)value;
return data.FinishWorkingTime - data.StartWorkingTime;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
return value;
} #endregion
Then place your ValueConverter in the column:
<ig:XamGrid.Columns>
<ig:UnboundColumn ValueConverter="{StaticResource mvc}" Key="WorkDuration"/>
</ig:XamGrid.Columns>
And the StaticResource is defined as:
<local:MVC x:Key="mvc"/>
Hope this helps,
-SteveZ
It works !!!
Thanks to both,