propertygrid

refresh a collection in propertygrid

这一生的挚爱 提交于 2020-01-22 03:07:27
问题 hay all. i am using property grid to add or remove an object to a collection. but when the collectioneditor is closed only once the grid refreshes. after adding another object the grid wont get refresh. the collection in a list. i have seen many people with the same problem but no solutions. thansk 回答1: Implement INotifyCollectionChanged interface or use ObservableCollection class. see the link 回答2: I realise i am very late to the party, but here it goes. I use this base class public class

Disabling items in PropertyGrid using Custom Attributes

烂漫一生 提交于 2020-01-17 04:19:35
问题 I am able to selectively enable / disable items in a PropertyGrid by setting BrowsableAttributes to an array containing CategoryAttribute objects. However, I wish to enable some items within a category and disable others within the same category, so I thought I would create my own custom attribute class and apply this to the properties in my object, but this does not seem to work. Here is my custom attribute class: Public Enum HeadType DMA = 1 TMA = 2 Both = 0 End Enum <AttributeUsage

propertygrid object with custom editor like a slider

我们两清 提交于 2020-01-16 03:38:54
问题 In my windowsForm application I use a PropertyGrid to edit the instances of my class: some of these properties are floating point with maximum and minimum item. I wish modify them by a slider or something like it. I've found this: http://www.visualhint.com/propertygrid but is not free.. do you have an idea to help me? 回答1: You can make use of TrackBar . Note that PropertyGrid by default does not allow you to add controls like these to it. So, you will need to do some work here. You will need

PropertyGrid does not raise PropertyValueChanged event

試著忘記壹切 提交于 2020-01-15 15:27:24
问题 When user changes text or bool value in PropertyGrid I set flagModified=true; in event handler: private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { propertyGrid1.Refresh(); PropertyChanged(true); } and then Save button is enabled. I use my Editor and form (see class below) to edit one of values in Properrtygrid. It is object of my class. After object is changed in editor and editor closed I re-assign value of object to the new value (value = frm.m_DS;)

Show only some of the options of an enumeration

做~自己de王妃 提交于 2020-01-15 08:35:46
问题 I have an enumeration shown in a PropertyGrid : private My_Enum _ee; public My_Enum EE { get { return _ee; } set { _ee= value; } } public enum My_Enum { NUM1 = 0, NUM2 = 1, NUM3 = 2, NUM4 = 3, NUM5 = 4, NUM6 = 5, NUM7 = 6, DEF }; Is there a way to show in PropertyGrid only two options from the enum (e.g. NUM1 , NUM2 )? 回答1: check below link, you need to use TypeConverter Using PropertyGrid in .NET C# Propertygrid combobox with enum values (Win Forms) 回答2: You could define an attribute used to

How to customize names in “Add” button dropdown in the PropertyGrid custom collection editor

风流意气都作罢 提交于 2020-01-13 19:14:09
问题 I'm using PropertyGrid to edit a collection. An object with the collection is defined as following: class ObjWithCollection { [Editor(typeof(MyCustomCollectionEditor),typeof(UITypeEditor))] public List<ItemBase> collection { get; set; } = new List<ItemBase>();//ItemBase is abstract } The collection contains the objects of two types, derived from ItemBase class: Item1 and Item2 . These classes defined as following: public abstract class ItemBase { public string Name { get; set; } public

How do I change boolean properties with one click in PropertyGrid

纵饮孤独 提交于 2020-01-12 08:06:56
问题 We have a windows form PropertyGrid that we use to display all the properties. We have drawn a checkbox on Boolean property that checks it self and unchecks itself based on the value. this all works fine. the issue is, that user wants to change the check box value in single click, whereas property grid changes it on a double click and I cant figure out a way to handle clicks or change property value on single click when property type is Boolean. Any idea about how to change property value in

How do I change boolean properties with one click in PropertyGrid

混江龙づ霸主 提交于 2020-01-12 08:06:09
问题 We have a windows form PropertyGrid that we use to display all the properties. We have drawn a checkbox on Boolean property that checks it self and unchecks itself based on the value. this all works fine. the issue is, that user wants to change the check box value in single click, whereas property grid changes it on a double click and I cant figure out a way to handle clicks or change property value on single click when property type is Boolean. Any idea about how to change property value in

Remove GenerateMember and Modifiers Properties in Designer

本秂侑毒 提交于 2020-01-10 05:15:17
问题 I created a Button descendant where I hide all the properties I don't use. I do it like this: [Browsable(false)] [Bindable(false)] [EditorBrowsable(EditorBrowsableState.Never)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Obsolete("", true)] public new Boolean AllowDrop { get; set; } Most properties get correctly hidden and cannot be used. However there are two properties that I cannot get rid of. Is there a way to also remove GenerateMember and Modifiers in the

C#/winforms: how to best bind a propertygrid and a System.Data.DataRow

给你一囗甜甜゛ 提交于 2020-01-09 19:12:08
问题 i have System.Data.DataRows with several fields, most of them just plain types like int, single, string. what is the best way to make them editable using a propertygrid? it should work automatically no matter what kind of fields the datarow has, but it should not display all of them. i want to provide a list of properties that should be hidden. since the DataTable is autogenerated i cannot add custom attributes like [Browsable(false)] thanks a lot! 回答1: Edited to handle filtering; much