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

Displaying items count in the Collection Editor combobox

12 Answers 441 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Dodd
Top achievements
Rank 1
Dodd asked on 23 May 2013, 02:33 AM
Hello,

When a property grid cell is bound to a collection object, currently the comobox for it is displayed empty.
Can I have this show the number of items the object holds?
Thanks!!

12 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 27 May 2013, 11:51 AM
Hi,

You can predefine the template and bind the TextBox's Text to the Control's CollectionView property. Then, in a converter you can retrieve the SourceCollection's Count and pass it to the binding.

Regards,
Ivan Ivanov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ivan Ivanov
Telerik team
answered on 27 May 2013, 11:56 AM
Hello,

 Just a quick note, In case you are using a List<T> as Source, you can directly bind it to Source.Count.

Regards,
Ivan Ivanov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dodd
Top achievements
Rank 1
answered on 28 May 2013, 02:59 AM
Could you please give me a simple project demonstrating how to do it?
Thank you very much!
0
Accepted
Maya
Telerik team
answered on 29 May 2013, 11:13 AM
Hi Dodd,

You can check this article on how to extract the template of a control. Once you have the template of CollectionEditorPicker, you can bind the TextBlock's Text property to Source.Count (if you use List<T> as mentioned above) - it should be something similar to: Text="{Binding Source.Count ..... }". 

Regards,
Maya
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Joel
Top achievements
Rank 1
Iron
answered on 16 Dec 2013, 02:45 AM
Problem is i do not use Expression Blend.
Is there any other ways to display text like (Collection) instead of leaving the field empty?
0
Maya
Telerik team
answered on 18 Dec 2013, 02:56 PM
Hello Dodd,

You can try getting the template of collection editor from the xaml files provided with our NoXaml binaries and edit it without the need of working with Blend. 

Regards,
Maya
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
Joel
Top achievements
Rank 1
Iron
answered on 19 Dec 2013, 01:27 AM
While it is not obvious how to do that, i have tried using the method mentioned here:
http://stackoverflow.com/questions/8825030/how-to-extract-default-control-template-in-visual-studio

1. Create a new WPF project. (VS2010)
2. Add a Collection Editor from toolbox.
3. Change the reference to NoXaml binaries.
4. From Visual studio - right click the control, choose properties,

5. In the properties window look for the Template Property and right click it, choose Extract Value To Resource

However, no success. (See attached screen shot).

By the way, i am not Dodd and sorry for hijacking this thread.

0
Maya
Telerik team
answered on 19 Dec 2013, 08:31 AM
Hi Joel,

I'm sorry, I should have been more detailed. Together with our NoXaml binaries, we provide all xaml files containing the styles and templates of the controls. Please take a look at this article for more information. The file you need to work with for RadPropertyGrid is Telerik.Windonws.Controls.Data.xaml.
As for extracting the template with Visual Studio, as far as I know this is supported with Visual Studio 2012 and above.

Regards,
Maya
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
Joel
Top achievements
Rank 1
Iron
answered on 19 Dec 2013, 10:18 AM
I figure that:
1) there is nothing for me to look at in Telerik\RadControls for WPF Q3 2013\Binaries.NoXaml
2) i can get the Telerik.Windows.Controls.Data.xaml file from Telerik\RadControls for WPF Q3 2013\Themes.Implicit\WPF40\OfficeBlack\Themes - assuming i am using OfficBlack theme.
3) There is a risk for the control to misbehave if i change to another theme.

Will dig more into it and see whether i can display the (Collection) text in the empty space.

Which make me wonder shouldn't this be a default behavior or something easily accomplished?


0
Maya
Telerik team
answered on 24 Dec 2013, 08:07 AM
Hi Dodd,

We will consider improving the behavior and I will research whether we can change the behavior without introducing breaking changes. But indeed, you will have to modify the template in each theme you want to work with. 


Regards,
Maya
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
Joel
Top achievements
Rank 1
Iron
answered on 26 Dec 2013, 02:32 AM
Hi Maya,
  Thanks. Wonderful support.
  And again, i am not Dodd.

joel
0
Maya
Telerik team
answered on 26 Dec 2013, 07:52 AM
Hi Joel,

I'm really sorry for mixing up the names again. It looks like I'm a bit absent-minded during the holidays :)


Regards,
Maya
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 >>
Tags
PropertyGrid
Asked by
Dodd
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Dodd
Top achievements
Rank 1
Maya
Telerik team
Joel
Top achievements
Rank 1
Iron
Share this question
or