RadPanelBarItem Command

17 posts, 2 answers
  1. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 09 Sep 2009 Link to this post

    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 ?
  2. Answer
    Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 09 Sep 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Tau Sick
    Tau Sick avatar
    14 posts
    Member since:
    Jul 2009

    Posted 27 Jan 2010 Link to this post

    Do you have a specific release planned with that feature?

    I hope it will work for both silverslight and wpf?
  5. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 27 Jan 2010 Link to this post

    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.
  6. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 27 Jan 2010 Link to this post

    Is it available for WPF also ?
  7. Tau Sick
    Tau Sick avatar
    14 posts
    Member since:
    Jul 2009

    Posted 28 Jan 2010 Link to this post

    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>

     

  8. Tau Sick
    Tau Sick avatar
    14 posts
    Member since:
    Jul 2009

    Posted 28 Jan 2010 Link to this post

    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.
  9. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 28 Jan 2010 Link to this post

    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.
  10. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 28 Jan 2010 Link to this post

    I was referring to RadPanelBarItem Command property (that was missing in WPF at the time of fist post.). Is it available now ?


  11. Tau Sick
    Tau Sick avatar
    14 posts
    Member since:
    Jul 2009

    Posted 28 Jan 2010 Link to this post

    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.

  12. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 28 Jan 2010 Link to this post

    This is exactly what I was asking.

    I think this should implement ICommandSource interface.


  13. Bo
    Bo avatar
    2 posts
    Member since:
    Aug 2010

    Posted 15 Oct 2010 Link to this post

    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.
  14. Answer
    Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 19 Oct 2010 Link to this post

    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.
  15. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 19 Oct 2010 Link to this post

    Thanks, I can try that
  16. Josef
    Josef avatar
    25 posts
    Member since:
    Nov 2010

    Posted 26 Jan 2011 Link to this post

    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
  17. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 31 Jan 2011 Link to this post

    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>>
  18. Josef
    Josef avatar
    25 posts
    Member since:
    Nov 2010

    Posted 03 Feb 2011 Link to this post

    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.

Back to Top
UI for WPF is Visual Studio 2017 Ready