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

RadGridView SelectionChanged and MVVM DelegateCommand ???

0 Answers 590 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bernard Grosperrin
Top achievements
Rank 1
Bernard Grosperrin asked on 17 Apr 2012, 05:47 PM
I am quite new to all of this, so it maybe no surprise that I would be a little lost...
Here is where I am at: I would like to get the CustomerID (from a viewModel) when a row is selected, to pass it to anotherViewModel to filter orders matching the currently selected Customer.
in XAML I have:
<telerik:RadGridView x:Name="CustomersGrid" IsReadOnly="true"
                                                     ItemsSource="{Binding CustomersList, Mode=TwoWay}"                                                    
                                                     CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed"                                                      
                                                     AutoGenerateColumns="False">
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="SelectionChanged" >
                                            <Command:EventToCommand Command="{Binding SelectCustomer}" PassEventArgsToCommand="True" />
                                            <!--<Command:EventToCommand CommandParameter="{Binding SelectedItem, ElementName=CustomersGrid}" Command="{Binding SelectCustomer, Mode=OneWay}" /> -->
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>

In the viewModel, I have a delegate command.
I have been following the example in the documentation about RadEventsToCommandExamples, and when I look in the debugger, I can see that my Object is of type Telerik.Windows.Controls.SelectionChangeEventsArgs, but if I try to cast the Object to this, I get an error, as it find Windows.Controls.SelectionChangedEventsArgs (note the difference between change and changed).
I did try to cast it from RadRoutedEventArgs, but I am not too sure how to do.

How should I do? Looks like a bug to me, but I would really like to know about a work around. Thanks in advance!
Bernard

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Bernard Grosperrin
Top achievements
Rank 1
Share this question
or