sfdatagrid DateTimeOffset support in GridDateTimeColumn
Hi,
If the model contains datetimeoffset column then while adding or editing it throws up an error.
Whether datetimeoffsetcolumn is supported in uwp sfdatagrid?
If not how to make it work with datetimeoffset column.
Thanks
SIGN IN To post a reply.
4 Replies
BR
Balasubramanian Ramanathan
July 4, 2016 02:09 PM UTC
I managed to find the example in your help system.
Thank you
JG
Jai Ganesh S
Syncfusion Team
July 5, 2016 04:36 AM UTC
Hi Balasubramanian,
Thank you for the update.
Please let us know if you need any other assistance on this.
Regards,
Jai Ganesh S
BR
Balasubramanian Ramanathan
July 5, 2016 02:23 PM UTC
Thank you for the reply.
I am facing issues with having nullable datetimeoffset field.
How to modify the converted class to handle nullable datetimeoffset file in the model.
Thanks.
JG
Jai Ganesh S
Syncfusion Team
July 6, 2016 01:59 PM UTC
Hi Balasubramanian,
You can achieve your requirement to bind the null value in DateTimeOffset by change the converter like below,
|
public class DateTimeOffsetFormatConverter : IValueConverter
{
private GridDateTimeOffsetColumn cachedColumn;
public DateTimeOffsetFormatConverter(GridDateTimeOffsetColumn column)
{
cachedColumn = column;
}
object IValueConverter.Convert(object value, Type targetType, object parameter, string language)
{
var column = cachedColumn as GridDateTimeColumn;
if (value == null || DBNull.Value == value)
{
if (column.AllowNullValue)
return column.WaterMark;
}
value = ((DateTimeOffset)value).DateTime;
DateTime _columnValue;
_columnValue = (DateTime)value;
if (_columnValue < column.MinDate)
_columnValue = column.MinDate;
if (_columnValue > column.MaxDate)
_columnValue = column.MaxDate;
return _columnValue.ToString(column.FormatString, CultureInfo.CurrentUICulture);
}
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
} |
Regards,
Jai Ganesh S
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
BR Balasubramanian Ramanathan
- Jul 4, 2016 01:33 PM UTC
- Jul 6, 2016 01:59 PM UTC