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

RadPanelBarItem Command

16 Answers 232 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 09 Sep 2009, 01:58 PM
Hello,

Is there a reason why the RadPanelBarItem does not have a Command property ?

This would be nice in MVVM scenarios. Are there any plans to implement it ?

16 Answers, 1 is accepted

Sort by
0
Accepted
Valentin.Stoychev
Telerik team
answered on 09 Sep 2009, 02:44 PM
Hello Roland,

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.
0
Tau Sick
Top achievements
Rank 1
answered on 27 Jan 2010, 11:43 AM
Do you have a specific release planned with that feature?

I hope it will work for both silverslight and wpf?
0
Tihomir Petkov
Telerik team
answered on 27 Jan 2010, 01:46 PM
Hi Tau,

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.
0
Roland
Top achievements
Rank 1
answered on 27 Jan 2010, 03:07 PM
Is it available for WPF also ?
0
Tau Sick
Top achievements
Rank 1
answered on 28 Jan 2010, 07:31 AM
I have a wpf app where my xaml is bound to a viewmodel with an EditProductCommand.What I would like is to be able to write the following xaml (in bold):

<

 

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>

 

0
Tau Sick
Top achievements
Rank 1
answered on 28 Jan 2010, 07:39 AM
I could just put a control with commanding into the template, but in doing so I have big problems getting a mouseclick to register in the entire aera of the RadPanelBarItem. I can't event get a UIElement to fill out the entire RadPanelBarItem.

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.
0
Tihomir Petkov
Telerik team
answered on 28 Jan 2010, 03:23 PM
Hi guys,

@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.
0
Roland
Top achievements
Rank 1
answered on 28 Jan 2010, 03:29 PM
I was referring to RadPanelBarItem Command property (that was missing in WPF at the time of fist post.). Is it available now ?


0
Tau Sick
Top achievements
Rank 1
answered on 28 Jan 2010, 04:08 PM

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.

0
Roland
Top achievements
Rank 1
answered on 28 Jan 2010, 04:25 PM
This is exactly what I was asking.

I think this should implement ICommandSource interface.


0
Bo
Top achievements
Rank 1
answered on 15 Oct 2010, 09:09 AM
Hi

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.
0
Accepted
Miro Miroslavov
Telerik team
answered on 19 Oct 2010, 09:12 AM
Hello Roland,

 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.
0
Roland
Top achievements
Rank 1
answered on 19 Oct 2010, 02:50 PM
Thanks, I can try that
0
Nicole
Top achievements
Rank 1
answered on 26 Jan 2011, 01:09 PM
Is there a solution for the .NET-Framework 3.5? In 3.5 it don't works.

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
0
Petar Mladenov
Telerik team
answered on 31 Jan 2011, 05:29 PM
Hello Josef,

Could you please check out this article and let us know if it works for you ?

Regards,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Nicole
Top achievements
Rank 1
answered on 03 Feb 2011, 12:51 PM
It don't works. I will use events now. It's not very nice, because I would like to use mvvm, but I can't put more time in finding out why this don't works.

Tags
PanelBar
Asked by
Roland
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Tau Sick
Top achievements
Rank 1
Tihomir Petkov
Telerik team
Roland
Top achievements
Rank 1
Bo
Top achievements
Rank 1
Miro Miroslavov
Telerik team
Nicole
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or