Hi,
I am having a grid which will display the Date/Time string.
My DTO is having two members called. 'ModifiedTime' and 'ModifiedTimeString'. The second member will convert the datetime to a defined format [dd/MM/yyyy HH:mm]. Field 'ModifiedTimeString' is added to xamdatagrid.Is that possible that when the user tries to sort the 'ModifiedTimeString' field the grid should get sorted based on the data member 'ModifiedTime'? I tried IComparer, but i'm unable to convert the text as date/time (it is giving a error 'connot convert, invalid string').
Can somebody help me in this regard? Thanx in advance.
Hello,
You don't need to use a ModifiedTimeString. You can modify the way your date time value appears in the XamDataGrid by setting a style for its XamTextEditor.
Here is a style that should satisfy you:
<Style TargetType="{x:Type igEditors:XamTextEditor}" x:Key="TheTextStyle"> <Setter Property="Format" Value="dd/MM/yyyy HH:mm" /> </Style>
And here is how to set it:
<igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields>
<igDP:Field Name="Hire Date"> <igDP:Field.Settings> <igDP:FieldSettings EditAsType="{x:Type sys:String}" EditorType="{x:Type igEditors:XamTextEditor}" EditorStyle="{StaticResource TheTextStyle}" /> </igDP:Field.Settings> </igDP:Field>
</igDP:FieldLayout.Fields> </igDP:FieldLayout></igDP:XamDataGrid.FieldLayouts>
After which the column HireDate sorts like all the other columns by clicking on the header.
Hope this helps.
Regards Petar.
Can anybody tell me how to change the selected row color, now i'm changing the BG color of selected row,
color got changed but it is being highlighted with blue color(normal selection color).
Can we override this?
Thanks in advance
Arthi
Hello Arthi,
You have to create a style for the DataRecordCellArea and restyle it. You can find the default style for this in the DefaultStyles folder in the Infragistics directory on your computer (DataPresenterGeneric_Brushes.xaml file). You will have to change some of the following properties and the triggers in the style: BackgroundHover, BorderHoverBrush, BackgroundSelected, BorderSelectedBrush depending on your preferences.
Hope this helps,
Alex.
Alex,
Thanks a lot, this works for me.
Thanks n regards