Questions tagged [propertydescriptor]
80 questions
20
votes
5 answers
Default method in interface in Java 8 and Bean Info Introspector
I have a little problem with default methods in Interface and BeanInfo Introspector.
In this example, there is interface: Interface
public static interface Interface {
default public String getLetter() {
return "A";
}
}
and two…

ptrr
- 203
- 1
- 5
13
votes
5 answers
How to get PropertyDescriptor for current property?
How can I get the PropertyDescriptor for the current property? For example:
[MyAttribute("SomeText")]
public string MyProperty
{
get{....}
set
{
// here I want to get PropertyDescriptor for this property.
}
}

Yuriy
- 2,670
- 6
- 33
- 48
11
votes
5 answers
var keyword not always working?
C#, VS 2010. Somebody, please explain why I can't use var in my code below!
var props = TypeDescriptor.GetProperties(adapter);
// error CS1061: 'object' does not contain a definition for 'DisplayName'
foreach (var prop in props)
{
string name =…

l33t
- 18,692
- 16
- 103
- 180
10
votes
1 answer
Why does a function declaration override non-writable properties of the global object?
Setting a property descriptor like this:
Object.defineProperty(window, 'someFunction', {
value: function() { alert('safe'); },
writable: false,
enumerable: false,
configurable: false
});
...should, as far as I know, make the…

Dagg Nabbit
- 75,346
- 19
- 113
- 141
10
votes
3 answers
PropertyGrid expandable collection
I want to automatically show every IList as expandable in my PropertyGrid (By "expandable", I obviously mean that the items will be shown).
I don't want to use attributes on each list (Once again, I want it to work for EVERY IList)
I tried to achive…

RE6
- 2,684
- 4
- 31
- 57
9
votes
1 answer
Get the default PropertyDescriptors for a type
I'm customizing how an object type is displayed in a PropertyGrid by implementing ICustomTypeDescriptor. I'm allowing the user to create their own custom properties that are stored in a single dictionary of keys and values. I'm able to create all…

Eric Anastas
- 21,675
- 38
- 142
- 236
9
votes
2 answers
Is there a work around for the Android error "Unable to resolve virtual method java/beans/PropertyDescriptor"?
I am trying to use a third party jar file within an Android application. I have been able to use some of the classes in the jar file just fine. However, one of the classes references some Java classes that don't appear to be supported by the dalvik…

Greg Bondy
- 91
- 1
- 2
9
votes
2 answers
PropertyGrid readonly property on object-level
I want to display multiple instances of one class in my PropertyGrid. The class looks like this:
public class Parameter
{
[Description("the name")]
public string Name { get; set; }
[Description("the value"), ReadOnly(true)]
public…

reflective_mind
- 1,475
- 3
- 15
- 28
9
votes
5 answers
Create per-instance property descriptor?
Usually Python descriptor are defined as class attributes. But in my case, I want every object instance to have different set descriptors that depends on the input. For example:
class MyClass(object):
def __init__(self, **kwargs):
for attr,…

Wai Yip Tung
- 18,106
- 10
- 43
- 47
6
votes
4 answers
Resetting properties from a property grid
I am using a PropertyGrid to show properties from my objects. However, I'm also allowing the user to create their own properties, and set values for these custom properties. Each object that can have these custom properties has a Dictionary…

Eric Anastas
- 21,675
- 38
- 142
- 236
6
votes
1 answer
Where are property descriptor objects stored?
I know that you can obtain a property descriptor object
of a certain property 'prop' of a certain object obj with
Object.getOwnPropertyDescriptor(obj,"prop");.
I was just wondering: Where are these objects stored?
Are they stored internally…

Danield
- 121,619
- 37
- 226
- 255
5
votes
3 answers
ReadOnlyAttribute vs PropertyDescriptor.IsReadOnly()
What is the difference between using a PropertyDescriptor that returns a value for the IsReadOnly() method, and one that is associated with a ReadOnlyAttribute?

Eric Anastas
- 21,675
- 38
- 142
- 236
5
votes
2 answers
How to observe property value changes of a third party object?
I would like to observe whenever a property of a third party object is changed. I'm taking the approach of assigning a custom setter but my console.log below is never invoked. Why is that? Is there a better approach?
const foo = { a: 1, b: 2…

david_adler
- 9,690
- 6
- 57
- 97
4
votes
1 answer
Dynamically change properties returned by ICustomTypeDescriptor.GetProperties to readonly
I have a class which implements ICustomTypeDescriptor, and is viewed and edited by the user in a PropertyGrid. My class also has a IsReadOnly property which determines if the user will be able to save their changes later. I don't want to allow the…

Eric Anastas
- 21,675
- 38
- 142
- 236
4
votes
2 answers
C# - How to determine whether a property is changed
I need to know whether a public property (which has getter & setter) is changed. The property is in a simple class (no user control/component etc).
Is there an elegant way to subscribe to some kind of event which notifies when property is changed?
I…

Adi Barda
- 3,259
- 11
- 32
- 33