To reproduce: public Form1() { InitializeComponent(); this.radPropertyGrid1.SelectedObject = new Item(123,"Item123",DateTime.Now.AddDays(20)); this.radPropertyGrid1.EditorInitialized += radPropertyGrid1_EditorInitialized; } private void radPropertyGrid1_EditorInitialized(object sender, Telerik.WinControls.UI.PropertyGridItemEditorInitializedEventArgs e) { PropertyGridDateTimeEditor propertyGridDateTimeEditor = e.Editor as PropertyGridDateTimeEditor; if (propertyGridDateTimeEditor != null) { BaseDateTimeEditorElement dateTimeEditorElement = propertyGridDateTimeEditor.EditorElement as BaseDateTimeEditorElement; if (dateTimeEditorElement != null) { dateTimeEditorElement.Format = DateTimePickerFormat.Long; dateTimeEditorElement.ShowTimePicker = true; var radDateTimePickerCalendar = dateTimeEditorElement.CurrentBehavior as RadDateTimePickerCalendar; if (radDateTimePickerCalendar != null) { radDateTimePickerCalendar.DropDownMinSize = new System.Drawing.Size(600, 400); } } } } public class Item { public int Id { get; set; } public string Name { get; set; } public DateTime Date { get; set; } public Item(int id, string name, DateTime date) { this.Id = id; this.Name = name; this.Date = date; } } Workaround: private void radPropertyGrid1_EditorInitialized(object sender, Telerik.WinControls.UI.PropertyGridItemEditorInitializedEventArgs e) { PropertyGridDateTimeEditor propertyGridDateTimeEditor = e.Editor as PropertyGridDateTimeEditor; if (propertyGridDateTimeEditor != null) { BaseDateTimeEditorElement dateTimeEditorElement = propertyGridDateTimeEditor.EditorElement as BaseDateTimeEditorElement; if (dateTimeEditorElement != null) { dateTimeEditorElement.Format = DateTimePickerFormat.Long; dateTimeEditorElement.ShowTimePicker = true; var radDateTimePickerCalendar = dateTimeEditorElement.CurrentBehavior as RadDateTimePickerCalendar; if (radDateTimePickerCalendar != null) { radDateTimePickerCalendar.PopupControl.PopupOpened-=PopupControl_PopupOpened; radDateTimePickerCalendar.PopupControl.PopupOpened+=PopupControl_PopupOpened; } } } } private void PopupControl_PopupOpened(object sender, EventArgs args) { RadDateTimePickerDropDown dropdown = sender as RadDateTimePickerDropDown; dropdown.MinimumSize = new Size(600, 300); }
To reproduce: public Form1() { InitializeComponent(); this.radPropertyGrid1.Size = new System.Drawing.Size(272, 135); PropertyStoreItem intItem = new PropertyStoreItem(typeof(int), "Integer", 1); PropertyStoreItem showTrend = new PropertyStoreItem(typeof(bool), "ShowTrend", 0); PropertyStoreItem trendItem1 = new PropertyStoreItem(typeof(int), "TrendTypes", 0); // Case of Re-loading the previously Saved Trend Type PropertyStoreItem floatItem = new PropertyStoreItem(typeof(float), "Float", 1f, "Property storing a floating point value."); PropertyStoreItem stringItem = new PropertyStoreItem(typeof(string), "String", "Telerik", "Property storing a string value", "Telerik"); PropertyStoreItem dockItem = new PropertyStoreItem(typeof(DockStyle), "Dock", DockStyle.Top, "Property containing DockStyle value", "Layout", false); RadPropertyStore store = new RadPropertyStore(); store.Add(intItem); store.Add(showTrend); store.Add(trendItem1); store.Add(floatItem); store.Add(stringItem); store.Add(dockItem); this.radPropertyGrid1.SelectedObject = store; radPropertyGrid1.Items["TrendTypes"].Visible = false; this.radPropertyGrid1.PropertyValueChanged += radPropertyGrid1_ValueChanged; } private void radPropertyGrid1_ValueChanged(object sender, PropertyGridItemValueChangedEventArgs e) { PropertyGridItem current = (PropertyGridItem)e.Item; if (current.Name == "ShowTrend") { bool val = Convert.ToBoolean(current.Value); radPropertyGrid1.Items["TrendTypes"].Visible = val; } } - There is no scrollbar when the item is shown. Workaround: radPropertyGrid1.PropertyGridElement.PropertyTableElement.Update(PropertyGridTableElement.UpdateActions.ExpandedChanged);
Please refer to the attached gif file demonstrating how to reproduce the error with the Demo application. Workaround: change the DropDownStyle property to DropDownList: private void radPropertyGrid1_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e) { PropertyGridDropDownListEditor editor = e.Editor as PropertyGridDropDownListEditor; if (editor!=null) { BaseDropDownListEditorElement editorElement = editor.EditorElement as BaseDropDownListEditorElement; editorElement.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList; } }
Please refer to the attached sample project.
To reproduce: please refer to the attached sample project. Try to select a new value from the drop-down editor and press Yes from the message box. Workaround: use the RadPropertyGrid.PropertyValueChanging event to confirm the property changing: private void radPropertyGrid1_PropertyValueChanging(object sender, Telerik.WinControls.UI.PropertyGridItemValueChangingEventArgs e) { e.Cancel = (MessageBox.Show("Are you sure you want to change this?", "Question", MessageBoxButtons.YesNo) != DialogResult.Yes); }
RadSpinEditor now supports null values. This functionality is relevant for the PropertyGridSpinEditor as well http://docs.telerik.com/devtools/winforms/editors/spineditor/null-value-support
To reproduce: - Add RadPropertyGrid to a form and set the theme to MaterialTeal. The issue is observed in the ThemeViewer as well. Workaround: radPropertyGrid1.PropertyGridElement.ToolbarElement.AlphabeticalToggleButton.TextWrap = true; radPropertyGrid1.PropertyGridElement.ToolbarElement.CategorizedToggleButton.TextWrap = true; //or radPropertyGrid1.PropertyGridElement.ToolbarElementHeight = 68;
Use attached to reproduce. - Type 'n' in the search bar - "Name" is not found
To reproduce: Sub New() InitializeComponent() Dim intItem As New PropertyStoreItem(GetType(Integer), "Integer", 1) Dim floatItem As New PropertyStoreItem(GetType(Single), "Float", 1.0F, "Property storing a floating point value.") Dim stringItem As New PropertyStoreItem(GetType(String), "String", "telerik", "Property storing a string value", "Telerik") Dim fontItem As New PropertyStoreItem(GetType(Font), "Font", New Font("Arial", 12, FontStyle.Italic), "Property containing Font value") fontItem.Attributes.Add(New ReadOnlyAttribute(True)) floatItem.Attributes.Add(New ReadOnlyAttribute(True)) Dim store As New RadPropertyStore store.Add(intItem) store.Add(floatItem) store.Add(stringItem) store.Add(fontItem) Me.RadPropertyGrid1.SelectedObject = store End Sub Try to edit either the "Float" or the "Font" property. The editor will be activated although it doesn't have to. Workaround: cancel the Editing event Private Sub RadPropertyGrid1_Editing(sender As Object, e As PropertyGridItemEditingEventArgs) If e.Item.Name = "Font" Then e.Cancel = True End If End Sub
This should work similar to RadGridView. Once should be able to manually set the height of on individual rows as well.
Currently, the ExpandableObjectConverter is the appropriate solution for adding nested properties in RadPropertyGrid. Using TypeConverters is quite a flexible mechanism that RadPropertyGrid offers: https://docs.telerik.com/devtools/winforms/controls/propertygrid/type-converters
It would be nice to have a more flexible and easy approach, e.g. PropertyStoreItem .Items collection that allows you to add nested properties.
Hello,
we are trying to use RadPropertyGrid to show the properties of some objects listed in a RadGrdiView.
We use ExpandableObject to expand our custom property, but we have some problems when we try to show the properties of multiple selected items, when the values of the attribute of the property are not the same in all the selected objects. We tried to use PropertyGrid of Winform and we don't have this problem.
Thank you.
Currently, the only possible way to set the value to null is to select the whole text and press the Delete key.
If the value is cleared by the backspace key, it is restored when the control loses focus.
If the value is cleared by multiple times clicking the delete key and the cursor is in the first position, the previous value is restored when the control loses focus.
Workaround:
Subscribe to the TextChanged event of the spin editor and explicitly set the NullableValue of the BaseSpinEditorElement:
this.radPropertyGrid1.EditorInitialized += this.RadPropertyGrid1_EditorInitialized;
private void RadPropertyGrid1_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e)
{
if (e.Editor is PropertyGridSpinEditor spinEdit)
{
if (spinEdit.EditorElement is BaseSpinEditorElement editorElement && editorElement.EnableNullValueInput)
{
editorElement.TextChanged -= this.EditorElement_TextChanged;
editorElement.TextChanged += this.EditorElement_TextChanged;
}
}
}
private void EditorElement_TextChanged(object sender, EventArgs e)
{
if (sender is BaseSpinEditorElement editorElement && string.IsNullOrWhiteSpace(editorElement.Text))
{
editorElement.NullableValue = null;
}
}
When setting SelectedObject a ReadOnlyAttribute applies to the grid. But when wrapping it in an object[] and assign it to SelectedObjects the grid allows editing.
Sample application included.
Hello,
RadPropertyGrid does not properly intersect properties when what is set as SelectedObjects implements the ICustomTypeDescriptor interface. However, the .Net Framework PropertyGrid does not have this problem.
To reproduce the problem, use the attached project.
AlphabeticalToggleButton is not drawn correctly on 150% DPI. This is observed in the VisualStudio2022Light theme. In Fluent theme, the button is drawn correctly.
Steps to reproduce: 1. Create a class A with a boolean property 2. Create a class B with a property of type A and decorate it with [ReadOnly(true)] attribute 3. Set an instance of class B as the SelectedObject of a RadPropertyGrid 4. Try to change the boolean property. You will see you cannot.
If the number of sub items for a property depends on the value of the properties and this value is changed the sub items are not invalidated in all cases.
Currently when one filters properties through the Search bar they are filtered based on their Name instead of the display name or label.