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);
}
}
System.ArgumentException: 'An item with the same key has already been added.' when the data source contains DateTime with the same hour, minute, and seconds part (only milliseconds are different):
The following line gets serialized when set this property:
((Telerik.WinControls.UI.GridSelectCheckBoxElement)(this.radGridView1.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(0).GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(1).GetChildAt(0))).Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
Incorrect or missing accessible object names in the Inspect.exe tool (MSAA).
Call stack:
Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridGroupHeaderRowElement.Initialize(Telerik.WinControls.UI.GridViewRowInfo rowInfo) Line 100 at Telerik.WinControls.UI\GridGroupHeaderRowElement.cs(100) Telerik.WinControls.GridView.dll!Telerik.WinControls.Export.GridExportUtils.GetRowHeight(Telerik.WinControls.UI.RadGridView radGridView, Telerik.WinControls.UI.RowElementProvider rowProvider, Telerik.WinControls.UI.CellElementProvider cellProvider, Telerik.WinControls.UI.GridViewRowInfo gridViewRowInfo, bool exportVisualSettings) Line 158 at Telerik.WinControls.Export\GridExportUtils.cs(158) Telerik.WinControls.GridView.dll!Telerik.WinControls.Export.GridViewSpreadExport.AddRow(Telerik.WinControls.UI.GridViewRowInfo gridViewRowInfo, int rowIndex) Line 960
Run the attached project on a monitor with 100% DPI scaling and open the Excel-like filter popup:
100%:
After moving the form to the second monitor with 150% DPI scaling, the filter popup is not OK:
150%:
The popup is smaller and smaller with each next opening (see the attached gif file) at 150%. If you decide to move back the form on the monitor with 100% DPI scaling, the filter popup is not scaled properly.
ConditionalFormatting dialog elements are overlapping in the Windows 11 theme. The text is clipped on the right:
Load-On-Demand self-reference hierarchy provider