Command call from RowDetailsTemplate

2 posts, 0 answers
  1. George
    George avatar
    14 posts
    Member since:
    Sep 2010

    Posted 09 Jan 2013 Link to this post

    We have a RadGridView and within this grid we have another RadGridView. We are trying to get the selected item from this nested sub-grid. The code below just shows a button (we have ripped out the other grid) we are unable to get this button to call the command in our viewModel. We have tried buttons, the grid enabled select checkboxes. Nothing will call our command property. 

    <telerik:RadGridView.RowDetailsTemplate>
                            <DataTemplate>
                                <Button Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.SelectCommand}" CommandParameter="{Binding}" Content="Button" Margin="4"></Button>
                            </DataTemplate>
                        </telerik:RadGridView.RowDetailsTemplate>
                    </telerik:RadGridView>

    we have also tried - where Root is the name of our UserControl.

    <Button Command="{Binding ElementName=Root, Path=DataContext.SelectCommand}" CommandParameter="{Binding}" Content="Button" Margin="4"></Button>

    We have read online that there may be a limitation of this control doing what we would like it to do - can someone please give some clarity on how we can best solve this situation.

    thank you.
  2. Yoan
    Admin
    Yoan avatar
    1214 posts

    Posted 14 Jan 2013 Link to this post

    Hello George,

     
    In order to achieve your goal, I can suggest you to check this forum thread. In the forum you can find a sample project, showing you how to bind a command from your ViewModel to a button in RadGridView.

    I hope this helps.


    Regards,
    Yoan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top