RadPropertyStore-Question

8 posts, 1 answers
  1. Michael Storchmann
    Michael Storchmann avatar
    12 posts
    Member since:
    Nov 2009

    Posted 20 Nov 2011 Link to this post

    Hi,

    the new RadPropertyStore feature looks very promising. I want to build a PropertyGrid without binding to an .NET-Object but to a dynamic collection of Data. The RadPropertyStore is exactly what I need. But I have one Problem: According to Your WinForms PropertyGrid/Property Store-Demo the PropertyGridDropDownListEditor seems only work with enumerations. That is too static. I have e.g. a list of strings ("FrontWheelDrive", "RearWheelDrive", "AllWheelDrive"). The values ara stored in a Database and can differ.

    Is it possible to use the PropertyGridDropDownListEditor with a list (or array) of strings or the like?

    Michael

  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    682 posts
    Member since:
    Sep 2012

    Posted 21 Nov 2011 Link to this post

    Hello Michael,

    Thank you for writing.

    We created the example using enums to make it with the smallest number of lines of code possible. We wanted to put the focus on the RadPropertyStore and not on modifying editors and validating data. 
    On your questions about the editor. This editing system in the RadPropertyGrid was built with the intention to be as flexible as possible. This is why you can choose the editor you use for your data and you can customize this editor. I have attached a sample project where I have demonstrated how to put a custom data source for the drop down editor. There are two properties in the property store, one integer and one string. They are both edited with drop down list editors. The goal here is to demonstrate how to populate the editor with your data and how to edit one data type with another.

    I hope this will be useful for you. Should you need further help I would be glad to assist.

    Greetings,
    Ivan Petrov
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.




  3. Michael Storchmann
    Michael Storchmann avatar
    12 posts
    Member since:
    Nov 2009

    Posted 21 Nov 2011 Link to this post

    Hi Ivan,

    thanks for your support. I had a similar Solution (except the EditorInitialized-Part. Your documentation of the PropertyGrid isn´t very extensive. No word about your BuiltIn-Editors, only how to customize one of it) - with the same problem:

    The Editor-Customizing depends on the Property-Name - or at least on the Property-Type. That name is displayed in the PropertyGrid. In a multilanguage environment the name can change - even the name can be more than one time stored in the ProperyStore (in another category). It would be very helpful, if the PropertyStoreItem has a unique identificationfield (or a simple Tag-Field), which can accessed by the PropertyGridItemEditorInitializedEventArgs/PropertyGridEditorRequiredEventArgs-Objects. Simple example:

    store.Add(new PropertyStoreItem(typeof(string), "CardReaderType", "Legic Advant", "Type of CardReader", "Reader 1", false, "TagOnlyLegic"));

    store.Add(new PropertyStoreItem(typeof(string), "CardReaderType", "Mifare DESfire", "Type of CardReader", "Reader 2", false, "TagOnlyMifare"));

    The last (not existing) parameter is the unique identifier. Of course, "CardReaderType" can be made unique ("CardReaderType 1", "CardReaderType 2") but in German the name is complete different ("Kartenleser-Typ"). An internal identifier is a better choice.

    My goal is to develop one generic configurationtool for all of our products. I am tired of programming it every time :-) I have already written a WPF-Programm with RadGridViews, but it performs not very well and startup-time on 1 Ghz SingleCore machines is slow. I think, WinForms is in that case the better choice. The PropertyStore-Feature comes at the right time.

    Michael

  4. Ivan Petrov
    Admin
    Ivan Petrov avatar
    682 posts
    Member since:
    Sep 2012

    Posted 24 Nov 2011 Link to this post

    Hi Michael,

    Thank you for writing back.

    Improvement of our documentation on RadPropertyGrid is in our plans and we will add more articles in the near future.

    Currently, the RadPropertyStore allows adding two properties with the same name, but this is actually an issue and not a feature. The same is not possible with a .NET object as it would not even compile with two properties with the same name. We will address this issue and I have updated your Telerik points for reporting it.

    Since the property name should and will be unique you can use it as identifier. Every PropertyGridItem has a property called Label which is usually filled by the DisplayName attribute, but can also be set programmatically. When it is set, the string in it is used instead of the property name. You can use this property to localize your tool. 

    We value your feedback very much and I have marked a few improvements we should implement in the RadPropertyStore which would make the work with it easier.

    I hope you will find his info useful. If you have other questions do not hesitate to write back.

    All the best,
    Ivan Petrov
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  5. Michael Storchmann
    Michael Storchmann avatar
    12 posts
    Member since:
    Nov 2009

    Posted 27 Nov 2011 Link to this post

    Hi Ivan,

    thanks, your recommended Solution works. Simple example:

    var store = new RadPropertyStore();
    store.Add(new PropertyStoreItem(typeof(string), "UniqueID1", "Test", "TestItemDescr1", "Cat1"));
    store.Add(new PropertyStoreItem(typeof(string), "UniqueID2", "Another Test", "TestItemDescr2", "Cat2", false));
    this.radPropertyGrid1.SelectedObject = store;
    this.radPropertyGrid1.Items["UniqueID1"].Label = "NonUniqueText";
    this.radPropertyGrid1.Items["UniqueID2"].Label = "NonUniqueText";

    But i found a bug. If i set the PropertySort-Property to "Categorized", your control don´t show the cateogories (Cat1 und Cat2).
    Instead it shows the PropertyName (see ProbGrid.png). After typing some text in the Filterbox and after clearing the text, the control shows the right categrories.

    Michael

     

  6. Answer
    Ivan Petrov
    Admin
    Ivan Petrov avatar
    682 posts
    Member since:
    Sep 2012

    Posted 30 Nov 2011 Link to this post

    Hi Michael,

    Thank you for your reply.

    To work around the group name issue you should set the RadPropertyGrid PropertySort property after you have set the SelectedObject. We are aware of this behavior and will try to address it in our upcomming service pack.

    I hope this will help you out. If you have other questions or feedback, we would love to hear it.

    Kind regards,
    Ivan Petrov
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

  7. Michael Storchmann
    Michael Storchmann avatar
    12 posts
    Member since:
    Nov 2009

    Posted 30 Nov 2011 Link to this post

    Hi Ivan,

    the workaround works - problem solved.

    Thanks, Michael

  8. Michael Storchmann
    Michael Storchmann avatar
    12 posts
    Member since:
    Nov 2009

    Posted 30 Nov 2011 Link to this post

    Hi Ivan,

    the workaround works - problem solved.

    Thanks, Michael

Back to Top