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

CollectionEditor customizing

14 Answers 428 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Hyunho
Top achievements
Rank 1
Hyunho asked on 03 Apr 2013, 06:51 AM
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,

14 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 08 Apr 2013, 03:56 PM
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.

0
Alexandru
Top achievements
Rank 1
answered on 13 Nov 2013, 06:37 AM
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
0
Dimitrina
Telerik team
answered on 18 Nov 2013, 08:24 AM
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 >>
0
Alexandru
Top achievements
Rank 1
answered on 18 Nov 2013, 09:57 AM
Thanks Didie,

This worked.

Alex
0
Eric
Top achievements
Rank 1
answered on 09 Mar 2015, 07:13 PM
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?
0
Stefan
Telerik team
answered on 12 Mar 2015, 05:03 PM
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.

 
0
Eric
Top achievements
Rank 1
answered on 12 Mar 2015, 05:24 PM
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.
0
Vanya Pavlova
Telerik team
answered on 16 Mar 2015, 09:43 AM
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.

 
0
Steven
Top achievements
Rank 1
answered on 24 Jul 2016, 03:53 PM

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!

0
Stefan Nenchev
Telerik team
answered on 25 Jul 2016, 08:10 AM
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.
0
Steven
Top achievements
Rank 1
answered on 25 Jul 2016, 10:48 AM
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.
0
Stefan Nenchev
Telerik team
answered on 26 Jul 2016, 12:08 PM
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.
0
Steven
Top achievements
Rank 1
answered on 26 Jul 2016, 02:07 PM

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.

0
Stefan Nenchev
Telerik team
answered on 29 Jul 2016, 11:22 AM
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.
Tags
PropertyGrid
Asked by
Hyunho
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Alexandru
Top achievements
Rank 1
Dimitrina
Telerik team
Eric
Top achievements
Rank 1
Stefan
Telerik team
Vanya Pavlova
Telerik team
Steven
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Share this question
or