This is a migrated thread and some comments may be shown as answers.

EditorAttribute for collections is ignored

3 Answers 34 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Lukas
Top achievements
Rank 1
Lukas asked on 15 Nov 2018, 01:22 PM

Hi,

 

I have a problem showing the right editor für the properties for items inside a collection.

For RadPropertyGrid.Item I set a collaction.

The items of the collection has some EditorAttribtes set.

But at the ProbpertyGrid the Attribute is ignored.

Is there anything I can do to get this working?

 

    private void Grd_OnSelectedCellsChanged(object sender, GridViewSelectedCellsChangedEventArgs e)
    {
        PropGrid.Item = new List<Test> {new Test {Name = "N1", Number = 1}, new Test {Name = "N2", Number = 1}};
 
    }
 
 
 
public class Test
{
    public string Name { get; set; }
    [Telerik.Windows.Controls.Data.PropertyGrid.Editor(typeof(TextBlock), EditorStyle.Modal)]
    public int Number { get; set; }
}

3 Answers, 1 is accepted

Sort by
0
Dinko
Telerik team
answered on 20 Nov 2018, 08:28 AM
Hi Lukas,

Looking at the provided code snippet you have applied a collection to the RadPropertyGrid. The control does not support showing properties of the items inside a collection. The RadPropertyGrid can be used for one object only. In your case, you can use the CollectionEditor control. You can read more about this control in the CollectionEditors help article in our documentation.

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Lukas
Top achievements
Rank 1
answered on 20 Nov 2018, 08:40 AM

Hi Dinko,

 

thanks for your reply.

But isn't the PropertySet exactly for that?

Because if I set the PropertySetMode to Intersection or Union I get all the properties from the items of the collection. Also multi edit is working. But the EditorAttribute is ignored.

 

Regards, Lukas

 

0
Dinko
Telerik team
answered on 22 Nov 2018, 03:12 PM
Hello Lukas,

You are correct that you can use the PropertySetMode property to show the properties of items inside a collection. I have overlooked that and please accept my apologies.

Regarding your scenario. The EditorAttribute is ignored when PropertySetMode is used. Basically, in your case, you have a collection of one and the same objects. But you can set a collection to the PropertyGrid of different objects which have different EditorAttribute set to their properties. There is no built-in logic which can specify which EditorAttribute is more important than the other.

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PropertyGrid
Asked by
Lukas
Top achievements
Rank 1
Answers by
Dinko
Telerik team
Lukas
Top achievements
Rank 1
Share this question
or