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
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.
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
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
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.
Didie
Telerik
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 >>
This worked.
Alex
Why is it not getting bound to the name?
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.
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.
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.
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!
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
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
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.
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