Databinding with ItemsSource causes items to multiply

4 posts, 0 answers
  1. Marius
    Marius avatar
    21 posts
    Member since:
    Oct 2010

    Posted 01 Nov 2010 Link to this post

    This works (default Microsoft toolbar):

            <ToolBar ItemsSource="{Binding Path=Actions}"></ToolBar>

    This does not:

            <telerik:RadToolBar ItemsSource="{Binding Path=Actions}"></telerik:RadToolBar>

    What i get is number of items x 2 when the toolbar is shown.

    I notice that there are multiple questions revolving around this issue, but they are old. Is this still a problem in Telerik WPF controls, or am I missing something?
  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 03 Nov 2010 Link to this post

    Hello Marius,

     Can you take a look at this blog post. It is very new and the ToolBar should work normally with binding.
    I've also just tested your example and both MS and Telerik's behave the same way - just show the item as text.
    If you can send us example project demonstrating your specific problem, it will be very helpful.
    Thank you.

    All the best,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Marius
    Marius avatar
    21 posts
    Member since:
    Oct 2010

    Posted 03 Nov 2010 Link to this post

    Does this work without specifying a ToolBarTemplateSelector? We can not create a template selector which does a switch case on the type of viewmodels statically because the viewmodel types are not known before runtime (this breaks OCP by the way :-)). We are creating a modularized applicaton which means that ViewModels and their corresponding DataTemplates are registered at startup in our module initializers.
  5. Viktor Tsvetkov
    Admin
    Viktor Tsvetkov avatar
    382 posts

    Posted 05 Nov 2010 Link to this post

    Hello Marius,

    If you remove the TemplateSelector you wouldn't know what kind of ToolBarItem should be created, so you can modify the logic in the TemplateSelector (not to use the type of the ViewModels), but you need it.

    All the best,
    Viktor Tsvetkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top