When you have a property that is bool? or ToggleState, it would be good to have three-state functionality for the PropertyGridCheckBoxItemElement.
Office2010silver theme showing different result with 2017.2.613 version my font size became very small.
To reproduce: Public Class RadForm1 Sub New() InitializeComponent() RadPropertyGrid1.SelectedObject = New MyProperties End Sub Public Class MyProperties Private _height As Integer = 70 <Browsable(True)> <Category("Rows")> <DisplayName("Height")> _ <Description("Sets the height of the row. Range 70 to 200.")> _ <RadRange(70, 200)> _ Public Property Height() As Integer Get Return _height End Get Set(ByVal Value As Integer) _height = Value End Set End Property End Class End Class When you activate the editor you will notice that you are allowed to enter values outside the specified range 7-200. Workaround: AddHandler Me.RadPropertyGrid1.EditorInitialized, AddressOf PropertyGridEditorInitialized Private Sub PropertyGridEditorInitialized(sender As Object, e As PropertyGridItemEditorInitializedEventArgs) Dim spinEditor As PropertyGridSpinEditor = TryCast(e.Editor, PropertyGridSpinEditor) If spinEditor IsNot Nothing Then spinEditor.MinValue = 70 spinEditor.MaxValue = 200 End If End Sub
Use attached to reproduce. Workaround radPropertyGrid1.ItemSpacing = 1;
To reproduce: this.radPropertyGrid1.SelectedObject = this; this.radPropertyGrid1.PropertyGridElement.SplitElement.HelpElement.MinSize = new Size(0, 60); Please refer to the attached gif file. Workaround: this.radPropertyGrid1.SelectedObject = this; this.radPropertyGrid1.PropertyGridElement.SplitElement.HelpElement.MinSize = new Size(0, 60); this.radPropertyGrid1.PropertyGridElement.SplitElement.HelpElement.HelpTitleElement.MinSize = new Size(0,20); this.radPropertyGrid1.PropertyGridElement.SplitElement.HelpElement.HelpTitleElement.PropertyChanged += HelpTitleElement_PropertyChanged; private void HelpTitleElement_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Bounds") { if (this.radPropertyGrid1.PropertyGridElement.SplitElement.HelpElement.HelpContentElement.Location.Y != 20) { this.radPropertyGrid1.PropertyGridElement.SplitElement.HelpElement.HelpContentElement.Location = new Point(0, 20); } } } Note: the description element may be floating but it doesn't overlap the title.
How to reproduce: associate the control with an object having a Font property. It can be the form itself, then try and change the font-size, e.g: -1. The standard property grid displays a message box with the error. Workaround handle the RadPropertyGrid.EditorInitialized event: private void RadPropertyGrid_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e) { PropertyGridSpinEditor editor = e.Editor as PropertyGridSpinEditor; if (editor != null && e.Item.Parent != null && e.Item.Parent.Name == "Font" && e.Item.Name == "Size") { editor.MinValue = 1; } }
This should work similar to RadGridView. Once should be able to manually set the height of on individual rows as well.
The incorrect behavior is also observed if the SelectedObject is changed. How to reproduce: public partial class RadForm1 : RadForm { public RadForm1() { this.InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.radPropertyGrid1.EnableSorting = true; this.radPropertyGrid1.SelectedObject = new TestObject(); foreach (var item in this.radPropertyGrid1.Items) { if (item.Name == "A") { item.SortOrder = 2; } else if (item.Name == "B") { item.SortOrder = 1; } else { item.SortOrder = 0; } } this.radPropertyGrid1.PropertySort = PropertySort.NoSort; } } public class TestObject { public int A { get; set; } public int C { get; set; } public int B { get; set; } } Workaround: 1. Use attributes in the model class: public class TestObject { [RadSortOrder(2)] public int A { get; set; } [RadSortOrder(0)] public int C { get; set; } [RadSortOrder(1)] public int B { get; set; } } 2. Alternatively, toggle the PropertySort property in the Shown event of the form: public partial class RadForm1 : RadForm { public RadForm1() { this.InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.radPropertyGrid1.EnableSorting = true; this.radPropertyGrid1.SelectedObject = new TestObject(); foreach (var item in this.radPropertyGrid1.Items) { if (item.Name == "A") { item.SortOrder = 2; } else if (item.Name == "B") { item.SortOrder = 1; } else { item.SortOrder = 0; } } this.radPropertyGrid1.PropertySort = PropertySort.NoSort; } protected override void OnShown(EventArgs e) { base.OnShown(e); this.radPropertyGrid1.PropertySort = PropertySort.Alphabetical; this.radPropertyGrid1.PropertySort = PropertySort.NoSort; } } public class TestObject { public int A { get; set; } public int C { get; set; } public int B { get; set; } }
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
Use attached to reproduce. - Type 'n' in the search bar - "Name" is not found
How to reproduce: run the attached project on a system with an increased scaling - 200%
To reproduce: use the following code snippet and follow the steps from the gif file: PropertyStoreItem item1 = new PropertyStoreItem(typeof(string), "Test1", "Test1"); PropertyStoreItem item2 = new PropertyStoreItem(typeof(string), "Test2", "Test2"); RadPropertyStore store = new RadPropertyStore(); store.Add(item1); store.Add(item2); this.radPropertyGrid1.SelectedObject = store; this.radPropertyGrid1.ToolbarVisible = true; Workaround: close the editor programmatically when the search box gets focus. this.radPropertyGrid1.PropertyGridElement.ToolbarElement.SearchTextBoxElement.TextBoxItem.GotFocus += TextBoxItem_GotFocus; private void TextBoxItem_GotFocus(object sender, EventArgs e) { this.radPropertyGrid1.EndEdit(); }
Please refer to the attached video illustrating the incorrect behavior of the context menu. Workaround: public RadForm1() { InitializeComponent(); this.radPropertyGrid1.SelectedObject = this; this.radPropertyGrid1.ToolbarVisible = true; this.radPropertyGrid1.RadContextMenu = new CustomPropertyGridDefaultContextMenu(this.radPropertyGrid1.PropertyGridElement.PropertyTableElement); } public class CustomPropertyGridDefaultContextMenu : Telerik.WinControls.UI.PropertyGridDefaultContextMenu { PropertyGridTableElement tableElement; public CustomPropertyGridDefaultContextMenu(PropertyGridTableElement propertyGridElement) : base(propertyGridElement) { tableElement = propertyGridElement; } protected override void OnDropDownOpening(CancelEventArgs args) { base.OnDropDownOpening(args); PropertyGridItemBase item = this.tableElement.SelectedGridItem; if (item != null) { if (!(item is PropertyGridGroupItem)) { this.EditMenuItem.Visibility = ElementVisibility.Visible; this.ResetMenuItem.Visibility = ElementVisibility.Visible; } } } }
How to reproduce: check the attached screenshot Workaround: use the attached custom theme
Please run the attached sample project and refer to the attached screenshots. RadPropertyGrid doesn't respect the Description attribute. this.radPropertyGrid1.SelectedObject = new Item(123,"Item", ExposureMode.FullAuto); public class Item { public int Id { get; set; } public string Name { get; set; } public ExposureMode Mode { get; set; } public Item(int id, string name, ExposureMode mode) { this.Id = id; this.Name = name; this.Mode = mode; } } public enum ExposureMode { [Description("Full Auto")] FullAuto, [Description("Auto Filter, Fixed Exposure")] AutoFilFixedExp, [Description("Fixed Filter, Auto Exposure")] FixedFilAutoExp, [Description("Fixed Filter, Fixed Exposure")] FullFixed }
To reproduce: public RadForm1() { InitializeComponent(); this.radPropertyGrid1.SelectedObject = new Item("zero", "uniqueId","alpha"); this.radPropertyGrid1.EnableSorting = true; SortDescriptor sort = new SortDescriptor("Value", ListSortDirection.Ascending); this.radPropertyGrid1.SortDescriptors.Add(sort); } public class Item { public string Text { get; set; } public string Identifier { get; set; } public string Value { get; set; } public Item(string text, string identifier, string value) { this.Text = text; this.Identifier = identifier; this.Value = value; } } Workaround#1: Set SortOrder to None this.radPropertyGrid1.SortOrder = SortOrder.None; Workaround#2: use a custom comparer: this.radPropertyGrid1.SortDescriptors.Add(sort); this.radPropertyGrid1.PropertyGridElement.PropertyTableElement.ListSource.CollectionView.Comparer = new MyComparer(); public class MyComparer : IComparer<Telerik.WinControls.UI.PropertyGridItem> { int IComparer<Telerik.WinControls.UI.PropertyGridItem>.Compare(Telerik.WinControls.UI.PropertyGridItem x, Telerik.WinControls.UI.PropertyGridItem y) { if (x.Value != null && y.Value != null) { return x.Value.ToString().CompareTo(y.Value.ToString()); } return 0; } }
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;
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: 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); }
Workaround: public class CustomPropertyGrid : RadPropertyGrid { public override string ThemeClassName { get { return typeof(RadPropertyGrid).FullName; } } protected override PropertyGridElement CreatePropertyGridElement() { return new CustomPropertyGridElement(); } } public class CustomPropertyGridElement : PropertyGridElement { protected override Type ThemeEffectiveType { get { return typeof(PropertyGridElement); } } protected override PropertyGridSplitElement CreateSplitElement() { return new CustomPropertyGridSplitElement(); } } public class CustomPropertyGridSplitElement : PropertyGridSplitElement { protected override Type ThemeEffectiveType { get { return typeof(PropertyGridSplitElement); } } protected override PropertyGridTableElement CreateTableElement() { return new CustomPropertyGridTableElement(); } } public class CustomPropertyGridTableElement:PropertyGridTableElement { protected override Type ThemeEffectiveType { get { return typeof(PropertyGridTableElement); } } public override bool ProcessKeyDown(KeyEventArgs e) { if (e.KeyData == Keys.Enter && ((PropertyGridItem)this.SelectedGridItem).PropertyType == typeof(bool)) { PropertyGridItem item = this.SelectedGridItem as PropertyGridItem; item.Value = !(bool)item.Value; return true; } return base.ProcessKeyDown(e); } }