CollectionEditor customizing

15 posts, 0 answers
  1. Hyunho
    Hyunho avatar
    23 posts
    Member since:
    Feb 2013

    Posted 03 Apr 2013 Link to this post

    Dear sir,

    I am evaluating RadPropertyGrid for my application. 

    First, please see a attached image.

    I made a property class for the object.

    public class MyProperty
    {
    private ObservableCollection<VideoProfile> videoProfiles;
    public string a{ get; set; }
    public string b{ get; set; }

    public ObservableCollection<VideoProfile> VideoProfiles
            {
    get {return videoProfiles;}
    }
    ...
    ...
    }

    Than, I could see auto generated VideoProfiles Collection editor in run time.

    Question.
    1. I want to customize Collection editor style to VideoProfiles. Items section is displaying class path
    2. I have referred the document, but It showed only image example about CollectionEditor, Can you give me a sample program about this? (Because it's first time that I develop a wpf application)
    3. I want to use DataTemplateSelector to change properties of VideoProfiles. Because I need to show combobox for a property that should be selected in external items.

    Best regards,

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 08 Apr 2013 Link to this post

    Hello,

     I will try to address the listed points in their original order.
    1. The leftmost ListBox is generating its items in accordance to CollectionEditor's Source. In case that you want to change this behavior, you should either modifiy CollectionEditor's template and set an ItemTemplate for the ListBox, or override you BusinessObject's ToString method (in case that it works for you to place this logic there).
    2. I have attached a basic sample project
    3. You should modify CollectionEditor's template and set its nested RadPropertyGrid's EditorTemplateSelector with a valid DataTemplateSelector instance.

    Regards,
    Ivan Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Alexandru
    Alexandru avatar
    3 posts
    Member since:
    May 2013

    Posted 13 Nov 2013 Link to this post

    Hi Ivan!

    I have a question regarding the CollectionEditor control. I used the project you provided below, and added in the Club class another property, Player (besides Players). However, I cannot edit its nested properties, and only the name of the player shows up, as it overrides the toString method.

    Is it possible for the collection editor to show up nested properties as well? If not, can a customize the template of some properties to put a property grid inside?

    Thanks,
    Alex
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 18 Nov 2013 Link to this post

    Hello,

    You should edit the template of the CollectionEditor element. It has a ListBox and a RadPropertyGrid inside it. You can change the ListBox (with name PART_CollectionListBox) with another control and then you can set the settings you would like for this element.

    Regards,
    Didie
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Alexandru
    Alexandru avatar
    3 posts
    Member since:
    May 2013

    Posted 18 Nov 2013 Link to this post

    Thanks Didie,

    This worked.

    Alex
  7. Eric
    Eric avatar
    57 posts
    Member since:
    Aug 2012

    Posted 09 Mar 2015 in reply to Ivan Ivanov Link to this post

    So, this project has the same problem I am trying to solve. When you Add, the name in the left list is empty. It is still empty after you type in a name.
     Why is it not getting bound to the name?
  8. Stefan X1
    Admin
    Stefan X1 avatar
    517 posts

    Posted 12 Mar 2015 Link to this post

    Hello Eric,

    A way of achieving this is to predefine the default CollectionEditor template and define which properties you want to be visible. Please note that this approach is described in one of the previous posts. However, I am attaching a sample project for your convenience.

    I hope that this helps.

    Best Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  9. Eric
    Eric avatar
    57 posts
    Member since:
    Aug 2012

    Posted 12 Mar 2015 in reply to Stefan X1 Link to this post

    The fact that these style sheets can be mined out of the theme DLL is something that has escaped me until this moment.

    The example in the demo app should make this more clear by including the App.xaml in the list of code files. I could clearly see that there was a style override in the usercontrol but my attempts at digging the CollectionEditorStyle out using Blend was taking too long and did not seem to work anyway.
  10. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 16 Mar 2015 Link to this post

    Hello Hyunho,


    Since you want to modify the template of CollectionEditor and embed some custom controls, you should predefine the template of this element in XAML. That's the way how the platform works. 

    Expression Blend has some issues with Bindings, when you try to extract the template. By that reason the part to the left is empty. If you are using any items control I recommend you to keep the Bindings defined in the default template. 

    <ListBox x:Name="PART_CollectionListBox"
                             Grid.Row="1"
                             IsEnabled="{TemplateBinding IsEnabled}"
                             ItemTemplate="{TemplateBinding ItemTemplate}"
                             BorderBrush="{x:Null}"
                             Background="Transparent"
                             BorderThickness="0"
                             ItemsSource="{TemplateBinding CollectionView}"
                             SelectedItem="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CurrentItem, Mode=TwoWay}"/>

    If you experience any other issues I will be glad to assist you further. 

    Regards,
    Vanya Pavlova
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  11. Steven
    Steven avatar
    3 posts
    Member since:
    Jul 2016

    Posted 24 Jul in reply to Vanya Pavlova Link to this post

    Hi Vanya, sorry to bring up a old thread again but this was the only place I found the relevant information I needed.  I'm trying to replace the ListBox in the CollectionEditor with a RadListBox but I'm using the SelectedItem binding you wrote in your post.

    My end goal is to modify the CollectionEditor to support drag and drop sorting in the ListBox.  Any help would be greatly appreciated!

  12. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    279 posts

    Posted 25 Jul Link to this post

    Hi Steven,

    The SelectedItem binding shown is the default one for the CollectionEditor. I tried setting RadListBox instead of a ListBox and the binding seems to work as expected. Can you please clarify what exactly is the issue with the binding at your end? 

    Regards,
    Stefan Nenchev
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  13. Steven
    Steven avatar
    3 posts
    Member since:
    Jul 2016

    Posted 25 Jul in reply to Stefan Nenchev Link to this post

    Thanks for the quick reply. I'm experiencing ItemsChanged in the propertygrid is not being called when I select any of the items in the RadListBox. I can use the movenext moveprevious button and see the propertygrid update, but not when I select items in the RadListBox.
  14. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    279 posts

    Posted 26 Jul Link to this post

    Hello Steven,

    I have updated the sample project that was used previously in the thread. I have modified the Control Template of the CollectionEditor to use a RadListBox. As observed in the sample, the SelectionChanged event of the RadListBox is fired each time the item is changed. Is the approach that you use at your end the same?

    Regards,
    Stefan Nenchev
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  15. Steven
    Steven avatar
    3 posts
    Member since:
    Jul 2016

    Posted 26 Jul in reply to Stefan Nenchev Link to this post

    Hi Stefan,

    I'm using VS to create the template for me (see App.xaml), and I would prefer this method if it is reliable.  I successfully got the drag and drop functionality in the RadListBox, but still can't get the PropertyGrid to update when selecting an item in the RadListBox.  I wish I could upload my project.

    I tried to add the drag and drop behavior to your sample project but the list ended up empty.  Also, when I opened up your project I got a Telerik notice that I was using an out of date version.  FYI: I am using the 2016.2.613.45 (Trial) version.

  16. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    279 posts

    Posted 29 Jul Link to this post

    Hi Steven,

    You are using the version from our latest release. The issue should not be related to it, though. Can you please raise a ticket in our system with a sample project so we can have a look at the specific scenario.
    Please, provide a solution as simple as possible that concentrates on the exact problem. The following blog post should be of help - Isolating a problem in a sample project.

    Regards,
    Stefan Nenchev
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WPF is Visual Studio 2017 Ready