propertygrid

How to set selected item of property grid

巧了我就是萌 提交于 2019-12-01 03:29:13
问题 I need to set the selected item of my property grid. I'm getting an eventargs, which stores a string (this string tells me what property in my propertygrid the user wants to select). The problem is i cannot find a collection of grid items, i can select one from. And also i dont know how to properly create a new GridItem object and set the SelectedGridItem property. GridItem gridItem = ???; detailsPropertyGrid.SelectedGridItem = gridItem; thank you for your help. Edit: Its almost working now

.Net Property Grid. Is there a way to let the Grid manipulate object in different way

孤人 提交于 2019-12-01 01:55:36
As I understood , The property grid is given an object which it can manipulate by extracting its Properties using reflections. My problem is that I have a set of Parameters that is determined during run-time , thus I can't staticly compose a class with properties to represent this set. I have two idea in mind to solve this problem but both are complex and will probably consume lot of time , infact i will say they are not practical under my time constraints. One is to use Reflection Emit in order to define a class dynamically and the other is to dynamiclly build a C# source file and then

C# .Net 4.5 PropertyGrid: how to hide Properties

ε祈祈猫儿з 提交于 2019-12-01 01:18:47
问题 The problem is simple(and I hope that this have a simple solution!): I want to hide ( Browsable(false) ) the property "Element" (in my PropertyGrid object) when it's zero. public class Question { ... public int Element { get; set; } } 回答1: What you could do is reuse the DynamicTypeDescriptor class described in my answer to this question here on SO: PropertyGrid Browsable not found for entity framework created property, how to find it? like this for example: public Form1() {

WPF PropertyGrid - adding support for collections

别来无恙 提交于 2019-12-01 00:32:17
I am working on wpf PropertyGrid (PG) control and I want the PG to support collection type( IList , ObservableCollection etc.) properties. I am bit confused on how to keep track of selected item(of that collection) and pass that to client. Any ideas? If the solution makes use of the Open Source WPF PropertyGrid ( http://www.codeplex.com/wpg ) I will implement the changes /additions back into the control. No answers proves that there is no straight forward way of doing this. So I implemented this feature this way - I created an attribute named RelatedItemSourcePropertyAttribute like this - ///

Binding generic collection List<> to property grid

独自空忆成欢 提交于 2019-11-30 23:54:59
I try binding generic collection listContact to propGrid but output does not match what I expected. I want listContact to be shown like ListBox in propGrid . How do I do it? Thank you. class Contact { public string Name { get; set; } public string Address { get; set; } } PropertyGrid propGrid = new PropertyGrid(); List<Contact> listContact = new List<Contact>(); private void Form1_Load(object sender, EventArgs e) { listContact.Clear(); Contact newContact = null; newContact = new Contact(); newContact.Name = "diana"; newContact.Address = "en"; listContact.Add(newContact); newContact = null;

.Net Property Grid. Is there a way to let the Grid manipulate object in different way

大憨熊 提交于 2019-11-30 21:25:22
问题 As I understood , The property grid is given an object which it can manipulate by extracting its Properties using reflections. My problem is that I have a set of Parameters that is determined during run-time , thus I can't staticly compose a class with properties to represent this set. I have two idea in mind to solve this problem but both are complex and will probably consume lot of time , infact i will say they are not practical under my time constraints. One is to use Reflection Emit in

Custom, Complicated, Dynamic Reflection Solution - C#

久未见 提交于 2019-11-30 04:12:45
I have many custom classes that I am using that I will explain and post examples of. After Explaining what they all do I will try to clearly describe the conditions under which my bug is happening. First, I am using a PropertyGrid to display the properties of several different types of objects. Because the default binding of the PropertyGrid was not what as descriptive as I wanted it to be, I created a few custom classes that I will refer to as "Display" classes. These Display classes are constructed by passing in the an object and then creating properties that return nicely formatted strings

How can I force the PropertyGrid to show a custom dialog for a specific property?

自作多情 提交于 2019-11-30 03:54:00
I have a class with a string property, having both a getter and a setter, that is often so long that the PropertyGrid truncates the string value. How can I force the PropertyGrid to show an ellipsis and then launch a dialog that contains a multiline textbox for easy editing of the property? I know I probably have to set some kind of attribute on the property, but what attribute and how? Does my dialog have to implement some special designer interface? Update: This is probably the answer to my question, but I could not find it by searching. My question is more general, and its answer can be

How to display a dynamic object in property grid?

喜欢而已 提交于 2019-11-29 15:53:00
问题 I have a custom object type which has to be editable in PropertyGrid : public class CustomObjectType { public string Name { get; set; } public List<CustomProperty> Properties {get; set;} } Which has a list of custom properties: public class CustomProperty { public string Name { get; set; } public string Desc { get; set; } public Object DefaultValue { get; set; } Type type; public Type Type { get { return type; } set { type = value; DefaultValue = Activator.CreateInstance(value); } } } The

Remove GenerateMember and Modifiers Properties in Designer

白昼怎懂夜的黑 提交于 2019-11-29 15:28:01
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 Designer? You can create a new ControlDesigner for your control and override its PostFilterProperties