16 Answers, 1 is accepted
thank you for your suggestion - we will surely add it now that we have and Commands in Silverlight.
All the best,
Valentin.Stoychev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

I hope it will work for both silverslight and wpf?
The feature is already available. You can read more details in the following blog post:
http://blogs.telerik.com/silverlightteam/posts/10-01-08/telerik_commanding_mechanism_for_silverlight_overview.aspx
Greetings,
Tihomir Petkov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.


<
UserControl x:Name="ProductList" >
<UserControl.Resources>
<DataTemplate x:Key="ProductTemplate">
<DockPanel Margin="0" LastChildFill="True" Background="Blue" >
<Image DockPanel.Dock="Left" Source="{Binding icon}"></Image>
<TextBlock Text="{Binding}"></TextBlock>
</DockPanel >
</DataTemplate>
</UserControl.Resources>
<telerik:RadPanelBar ExpandMode="Multiple" x:Name="panel">
<telerik:RadPanelBarItem Header="MyProducts" ItemsSource="{Binding Path=AvailableProducts}" Command={Binding ElementName=ProductList, Path=EditProductCommand} CommandParamenter={Binding} ItemTemplate="{StaticResource ProductTemplate}">
</telerik:RadPanelBarItem >
</ControlTemplate>
</telerik:RadPanelBarItem.ChildItemsTemplate>
</telerik:RadPanelBarItem>
</telerik:RadPanelBar>
</StackPanel>
</
UserControl>

To get a feeling of the problem I constantly end up with when trying to get the command to fire, take a look at the demo application under "TimePicker" and "FirstLook". To choose a time, the user has to hit the tini-tiny triangle inside of the dropdown button to get the dropdown.
@Roland: Commanding is a native part of WPF:
http://msdn.microsoft.com/en-us/library/ms752308.aspx
@Tau: Can you please describe exactly what you are after? If you provide a bit more details about your goal I should be able to help. When do you want your command to be fired and what do you want it to do?
All the best,
Tihomir Petkov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.


When the user left-click on a RadPanelBartItem, I want to fire a command on my ViewModel with the RadPanelBarItem’s bound Item (from the RadPanels ItemsSource) as a parameter.
I have done it now with an event to my XAMLs code-behind that calls the command on the DataContext by typecasting it to my ViewModel, but that requires me to do the code-behind and I would like to avoid that if possible.
I would like the RadPanelBarItem to implement the ICommandSource interface like a Button or MenuItem.
If the Command property was working on the RadPanelBarItem, everything would be great for me.
The other problem was part of an attempt to do a workaround by putting something “invisible” that implement ICommandSource inside of the RadPanelBarItem. This works, but I can’t get control inside the RadPanelBarItem to fill out the RadPanelBarItems visible area. This results in the user clicking outside the area of my control with the command– and no command fires. The user gets confused and this sometimes it works, sometimes it does not. The TimePicker First look example is very illustrative of the kind problem I encounter with the RadPanelBarItem. In tehe TimePicker example, the user has to click exactly on the small triangle. That just doesn’t cut it for real-life applications. I really think you should redo that example in the demo application.

I think this should implement ICommandSource interface.

What was the conclusion here - is it possible to fire a command when clicking on the on a RadPanelBarItem?
I can't see a Command attribute on the RadPanelBarItem.
You can't do this out-of -the-box, but can easily use the goods from Expression Blend SDK, called InvokeCommandAction.
<
telerik:RadPanelBar
HorizontalAlignment
=
"Left"
>
<
telerik:RadPanelBarItem
Header
=
"RadPanelBarItem"
x:Name
=
"panelItem1"
>
<
i:Interaction.Triggers
>
<
i:EventTrigger
EventName
=
"MouseLeftButtonDown"
SourceName
=
"panelItem1"
>
<
i:InvokeCommandAction
Command
=
"{Binding Command}"
/>
</
i:EventTrigger
>
</
i:Interaction.Triggers
>
</
telerik:RadPanelBarItem
>
<
telerik:RadPanelBarItem
Header
=
"RadPanelBarItem"
/>
</
telerik:RadPanelBar
>
You just need to reference the "C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries\System.Windows.Interactivity.dll" and use the CommandAction that will invoke your command when a custom event happens.
This is very useful technique in MVVM, so you will benefit from incorporating it in your project.
Hope this will help you.
Regards,
Miro Miroslavov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.


I have tried this code but got no success:
<
telerik:RadPanelBarItem
>
<
ia:Interaction.Triggers
>
<
ia:EventTrigger
EventName
=
"MouseLeftButtonDown"
>
<
ia:InvokeCommandAction
CommandName
=
"cmdNavigateFrame"
/>
</
ia:EventTrigger
>
</
ia:Interaction.Triggers
>
<
telerik:RadPanelBarItem.Header
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"10 4 5 5"
>
<
Image
Source
=
"Images/suchen.png"
></
Image
>
<
Label
Content
=
"Anzeigen/Bearbeiten"
/>
</
StackPanel
>
</
telerik:RadPanelBarItem.Header
>
</
telerik:RadPanelBarItem
>
I get the following error message:
Cannot add content of type 'System.Windows.Interactivity.EventTrigger' to an object of type 'System.Windows.Interactivity.TriggerCollection'. Error at object 'System.Windows.Interactivity.EventTrigger' in markup file 'InteractivityTest;component/window1.xaml' Line 16 Position 19.
Google is not very helpful with this. Does anyone have any idea how I can find a solution for this problem? I want to use the MVVM-Pattern using commands is essential.
Best regards from Germany
Could you please check out this article and let us know if it works for you ?
Regards,
Petar Mladenov
the Telerik team
