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

Databinding with ItemsSource causes items to multiply

3 Answers 83 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Marius
Top achievements
Rank 1
Marius asked on 01 Nov 2010, 01:19 PM
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?

3 Answers, 1 is accepted

Sort by
0
Miro Miroslavov
Telerik team
answered on 03 Nov 2010, 11:04 AM
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
0
Marius
Top achievements
Rank 1
answered on 03 Nov 2010, 01:46 PM
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.
0
Viktor Tsvetkov
Telerik team
answered on 05 Nov 2010, 02:02 PM
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
Tags
ToolBar
Asked by
Marius
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
Marius
Top achievements
Rank 1
Viktor Tsvetkov
Telerik team
Share this question
or