Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ToolBar > Databinding with ItemsSource causes items to multiply

Not answered Databinding with ItemsSource causes items to multiply

Feed from this thread
  • Marius avatar

    Posted on Nov 1, 2010 (permalink)

    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?

    Reply

  • Miro Miroslavov Miro Miroslavov admin's avatar

    Posted on Nov 3, 2010 (permalink)

    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

    Reply

  • Marius avatar

    Posted on Nov 3, 2010 (permalink)

    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.

    Reply

  • Viktor Tsvetkov Viktor Tsvetkov admin's avatar

    Posted on Nov 5, 2010 (permalink)

    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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ToolBar > Databinding with ItemsSource causes items to multiply
Related resources for "Databinding with ItemsSource causes items to multiply"

WPF ToolBar Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]