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

RowActivated event and sending argument

1 Answer 363 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Petter
Top achievements
Rank 1
Petter asked on 06 Feb 2014, 04:48 AM
Hi,

I am using RowActivated for my RadGridView and have a few issues:

- The RowActivated event is triggered on a mouse double click but NOT when Enter is pressed. According to the documentation and a lot of posts (with provided examples) it should. Since a lot a users get the event triggered successfully by Enter key down, I probably have some properties set that prevents this. If so, which properties would block the event (please see my XAML below).

- With the RowActivated event, I'd like to send a command argument that contains the string displayed in the first column. How do I achieve that (in XAML and in C# code)?

This is my XAML:

                <Telerik:RadGridView
                    RowActivated="HandleEvent_GridRowDoubleClick"
                    Telerik:StyleManager.Theme="Office_Blue"
                    RowIndicatorVisibility="Collapsed"
                    SelectionMode="Single"
                    Width="Auto"
                    CanUserFreezeColumns="False"
                    CanUserSortColumns="True"
                    HorizontalAlignment="Left"
                    HorizontalContentAlignment="Left"
                    ItemsSource="{Binding DataTableUnitLoads.DefaultView, Mode=OneWay}"
                    VerticalAlignment="Stretch"
                    AutoGenerateColumns="False"
                    ShowGroupPanel="False"
                    EnableColumnVirtualization="True"
                    ShowColumnFooters="True"
                    hlp:RadGridViewCustomKeyboardCommandProvider.PreventEnter="True"
                    ScrollViewer.HorizontalScrollBarVisibility="Auto"
                    EnableRowVirtualization="True"
                    CanUserReorderColumns="False">

And this is my C#:

        private void HandleEvent_GridRowDoubleClick(object sender, RowEventArgs e)
        {
        }

Thanks in advance for your help!

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 10 Feb 2014, 03:56 PM
Hello,

RowActivated event should be raised upon both the actions of double clicking with the mouse and pressing the Enter key.

Once the event is raised, you can access the item like so:
private void clubsGrid_RowActivated(object sender, Telerik.Windows.Controls.GridView.RowEventArgs e)
{
    Club item = e.Row.Item as Club;
}

Then you can access any of the properties of the item and work with it further.

Regards,
Didie
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

Tags
GridView
Asked by
Petter
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or