none
GalaSoft RelayCommand with Parameter not working

    Question

  • I want to pass RadTreeview (rtvTaskCategories) in The RelayCommand which is located in Viewmodel, its passing nothing

      

      <Grid x:Name="LayoutRoot" Background="White">

    <telerikNavigation:RadTreeView x:Name="rtvTaskCategories" AllowDrop="True" IsDragDropEnabled="True" SelectionMode="Multiple" IsDragPreviewEnabled="True" IsDragTooltipEnabled="False" IsDropPreviewLineEnabled="False"
    IsEditable="True" Style="{StaticResource DraggableTreeNode}" ItemTemplate="{StaticResource ItemTemplate}"
    ItemsSource="{Binding ViewModel.TreeViewData,Converter={StaticResource HierarchyConverter}}" SelectedValuePath="ID">
    <telerikNavigation:RadContextMenu.ContextMenu>
    <telerikNavigation:RadContextMenu x:Name="TreeViewContext">
    <telerikNavigation:RadMenuItem Header="New Task" Command="{Binding TreeViewContextCommand}" CommandParameter="{Binding ElementName=LayoutRoot}"></telerikNavigation:RadMenuItem>

    <telerikNavigation:RadMenuItem Header="New Folder" />
    <telerikNavigation:RadMenuItem Header="Delete Folder" />
    </telerikNavigation:RadContextMenu>
    </telerikNavigation:RadContextMenu.ContextMenu>
    </telerikNavigation:RadTreeView>
    </Grid>

     //Viewmodel

     

    [Export]
        public class DoneItTreeViewTaskNavigationViewModel : Doit_ProjectViewModelBase 
        { 
    
    private RelayCommand<Object> _treeViewContextCommand;
            public RelayCommand<Object> TreeViewContextCommand
            {
                get { return _treeViewContextCommand ?? (_treeViewContextCommand = new RelayCommand<Object>(OnTreeView)); }
            }
    public void OnTreeView(Object item)
    {
    }
    
        }
      
    Sunday, May 30, 2010 11:52 PM