With releasing .NET 6, there are TimeOnly and DateOnly types which would be more appropriate for managing such values:
https://devblogs.microsoft.com/dotnet/date-time-and-time-zone-enhancements-in-net-6/
It would be good to add support for these types in GridViewDateTimeView.
Currently, the following code gives an exception when entering edit mode:
public RadForm1()
{
InitializeComponent();
DataTable dt = new DataTable();
dt.Columns.Add("DateOnly", typeof(DateOnly));
dt.Rows.Add(new DateOnly(2022,3,3));
this.radGridView1.AutoGenerateColumns = false;
GridViewDateTimeColumn dateColumn = new GridViewDateTimeColumn();
dateColumn.FieldName = "DateOnly";
this.radGridView1.Columns.Add(dateColumn);
this.radGridView1.DataSource = dt;
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
Workaround: you can use the following custom TypeConverter:
public RadForm1()
{
InitializeComponent();
DataTable dt = new DataTable();
dt.Columns.Add("DateOnly", typeof(DateOnly));
dt.Rows.Add(new DateOnly(2022,3,3));
this.radGridView1.AutoGenerateColumns = false;
GridViewDateTimeColumn dateColumn = new GridViewDateTimeColumn();
dateColumn.DataType = typeof(DateTime);
dateColumn.FieldName = "DateOnly";
dateColumn.Format = DateTimePickerFormat.Custom;
dateColumn.CustomFormat = "dd/MM/yyyy";
dateColumn.FormatString = "{0:dd/MM/yyyy}";
dateColumn.DataTypeConverter = new DateOnlyConverter();
this.radGridView1.Columns.Add(dateColumn);
this.radGridView1.DataSource = dt;
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
public class DateOnlyConverter : TypeConverter
{
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(DateTime);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (value is DateOnly && destinationType == typeof(DateTime))
{
DateOnly date = (DateOnly)value;
return new DateTime(date.Year, date.Month, date.Day);
}
return base.ConvertTo(context, culture, value, destinationType);
}
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(DateTime) ;
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (value is DateTime)
{
DateTime date = (DateTime)value;
return new DateOnly(date.Year, date.Month, date.Day);
}
return base.ConvertFrom(context, culture, value);
}
}
The default MS ContextMenuStrip shows tooltips for disabled menu items:
Currently, RadPdfViewer offers the DataError event which is purposed to handle errors during the import process. However, if there are problematic pages that are rendered in the viewer at a later moment after the document is already imported, the viewer doesn't offer a suitable way for handling such problematic moments even though the PdfProcessing library throws one of its exceptions.
The exact client's case is loading a PDF document which contains images requiring JPX Decoder which is currently not supported. Even though the PdfProcessing library throws internally the following error, the RadPdfViewer control doesn't throw the DataError event with the respective error:
Telerik.Windows.Documents.Fixed.Exceptions.NotSupportedFilterException: 'JPXDecode is not supported.'
Hi Team,
I would like to request to add a Today button to the RadDateTimePicker so when the user clicks on it, the value of the RadDateTimePicker will be set to the current day/time.
Thank you!
When I use the new project wizard provided by Microsoft for a new windows forms project it lets me select the target .net version
When I do the same with the Telerik wizard, it does not let me choose what .net Version I'm targeting and does not generate the optimal code for the target version. For example when I target .net 9.0 with high dpi support, it should generate API calls for High DPI, not an entry in the app manifest. IMHO the generated code should be as close to the Microsoft Standard for the targeted .net version as possible.