Page 1 of 1

can't edit properties on custom attribute types

Posted: Wed 28 Dec 2011 18:03
by mindplay
I have the following attribute type:

Code: Select all

 
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public class BinderAttribute : Attribute
    {
        /// <summary>
        /// Specifies the kind of binding to perform on the property.
        /// </summary>
        public BinderMode Mode { get; set; }

        public BinderAttribute()
        {
            Mode = BinderMode.Reference;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="BinderAttribute"/> class.
        /// </summary>
        public BinderAttribute(BinderMode mode)
        {
            Mode = mode;
        }
    }
It has a single, public property with the following enum type:

Code: Select all

 
    public enum BinderMode
    {
        /// <summary>
        /// Bind the property as a reference to another entity.
        /// </summary>
        Reference = 1,

        /// <summary>
        /// Bind the property as a list of references to another type of entity.
        /// </summary>
        MultiReference =2,

        /// <summary>
        /// Bind the property as a contained entity, belonging to the entity to which the property belongs.
        /// </summary>
        Contained = 3
    }
In the user-interface, the BinderMode property doesn't show, so I can't edit it's value.

What gives?

Posted: Thu 29 Dec 2011 12:16
by Shalex
We have compiled a separate class library with your BinderAttribute class and BinderMode enum, added it via right click on diagram > Model Settings > Attributes menu. Then right click on diagram > Attributes > move BinderAttribute to Selected Attributes => there is the Mode property in the Properties section with drop-down list of all BinderMode enum members. So we cannot reproduce the problem with Entity Developer v 4.2.95.

Posted: Thu 29 Dec 2011 16:25
by mindplay
Yeah, this is weird - not sure what's going on here. This fixed it:

Code: Select all

        [Browsable(true)]
        public BinderMode Mode { get; private set; }
According to the MSDN documentation, "By default, a public property is always shown in the grid" - so I should not need to explicitly mark the property as Browsable.

Perhaps your PropertyGrid behaves differently from the standard PropertyGrid?

Posted: Fri 30 Dec 2011 22:24
by mindplay
I figured out what's wrong here.

Try adding two different attributes to a property.

Now click back and forth between them on the "select attributes" list - it appears, sometimes, if you click too quickly, it registers as a double-click, and the property-grid below does not update... that is, the selection changes, but the property-grid is still displaying the properties of the previously selected attribute.

(try hooking the mouse-down or select-event instead of the click-event, which may not broadcast for double-clicks)

Posted: Wed 04 Jan 2012 11:23
by Helen
Thank you for the detailed explanation.

We have reproduced the described behaviour. We will fix the issue and inform you when the build containing the fix is published.

Posted: Thu 12 Jan 2012 15:10
by Helen
We've fixed the bug with invalid Properties grid data refreshing for the selected attribute in the Attributes dialog box.

The fix is available in the latest 4.2.110 build of Entity Developer.
The new build can be downloaded from http://www.devart.com/entitydeveloper/download.html (the trial and free versions) or from Registered Users' Area (provided that you have an active subscription).

For the detailed information about the improvements and fixes available in Entity Developer 4.2.110, please refer to
http://www.devart.com/forums/viewtopic.php?t=23135