Displaying items count in the Collection Editor combobox

13 posts, 1 answers
  1. Dodd
    Dodd avatar
    44 posts
    Member since:
    Dec 2012

    Posted 22 May 2013 Link to this post

    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!!
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 27 May 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 27 May 2013 Link to this post

    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.

  5. Dodd
    Dodd avatar
    44 posts
    Member since:
    Dec 2012

    Posted 27 May 2013 Link to this post

    Could you please give me a simple project demonstrating how to do it?
    Thank you very much!
  6. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 29 May 2013 Link to this post

    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.

  7. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 15 Dec 2013 Link to this post

    Problem is i do not use Expression Blend.
    Is there any other ways to display text like (Collection) instead of leaving the field empty?
  8. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 18 Dec 2013 Link to this post

    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 >>
  9. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 18 Dec 2013 Link to this post

    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.

  10. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 19 Dec 2013 Link to this post

    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 >>
  11. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 19 Dec 2013 Link to this post

    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?


  12. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 24 Dec 2013 Link to this post

    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 >>
  13. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 25 Dec 2013 Link to this post

    Hi Maya,
      Thanks. Wonderful support.
      And again, i am not Dodd.

    joel
  14. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 26 Dec 2013 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready