how use CommandParameter

Thread is closed for posting
2 posts, 1 answers
  1. Park
    Park avatar
    39 posts
    Member since:
    Sep 2010

    Posted 31 Jan 2012 Link to this post


    my project is using MVVM Light Toolkit.
    so, all property, all command binding
    but, i can't bind CommandParameter with control in view

         <telerikPrimitives:RadDataBoundListBox x:Name="lbStationDetail" Grid.Row="1" EmptyContent="검색된 결과가 없습니다."
                                                                 ItemsSource="{Binding BusVM.StationNoCollection}" ItemTemplate="{StaticResource StationNoRouteDataTemplate}" >
            <telerikPrimitives:RadContextMenuItem Content="즐겨찾기 추가" Command="{Binding AddFavoriteCommand, Mode=OneWay}" CommandParameter="{Binding }"/>

    how can i know hold item?


    i find somting. but, i can't get RadDataBoundListBoxItem
    menu is get currentFocusedElement property.
    how can i do get it?

            RelayCommand<object> addFavoriteCommand;
            /// <summary>
            /// 즐겨찾기에 추가
            /// </summary>
            public RelayCommand<object> AddFavoriteCommand
                    if (addFavoriteCommand == null)
                        addFavoriteCommand = new RelayCommand<object>(item =>
                            var menuItem = item as RadContextMenuItem;
                            var menu = menuItem.Parent as RadContextMenu;
                            var tt = menu.GetElementUnderMenu<RadDataBoundListBoxItem>();
                            //var tt = menu.GetType().GetElementType();
                            //var lb = menu.Parent as RadDataBoundListBox;
                            if (tt != null)

                    return addFavoriteCommand;

  2. Answer
    Victor avatar
    1358 posts

    Posted 03 Feb 2012 Link to this post

    Hi Park,

     Thank you for writing.
    Please have a look at this help article. In short, you can always get a reference to the focused element in RadContextMenu's Opening event. Please write again if you need further assistance.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top