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

RadGridView Details open on doubleClick event.

1 Answer 538 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brahim
Top achievements
Rank 1
Brahim asked on 06 Jul 2017, 12:30 PM

Hello,

I have a RadGridView and I would like that the details for one row to be opened on double clicking on them and that several rows could be open on the same time.

Here is a sample of code :

 <telerik:RadGridView x:Name="rdGrid"
                                                 ShowGroupPanel="False"
                                                 SnapsToDevicePixels="True"
                                                 BorderThickness="0"
                                                 RowDetailsVisibilityMode="VisibleWhenSelected"
                                                 RowDetailsStyle="{StaticResource simpleRowDetailsStyle}"
                                                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                                 ItemsSource="{Binding CompartmentsAnalysis, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                 AutoGenerateColumns="False"
                                                 SelectedItem="{Binding Path=SelectedCompartmentAnalysis, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}">
                            <telerik:RadGridView.Columns>
                                <telerik:GridViewDataColumn Header="Name"
                                                                DataMemberBinding="{Binding xxxx.Name, IsAsync=True}"
                                                                IsReadOnly="True"
                                                                Width="*" />
                            </telerik:RadGridView.Columns>
                        </telerik:RadGridView>



1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 11 Jul 2017, 08:50 AM
Hello Brahim,

Please note that when the RowDetailsVisibilityMode property is set to VisibleWhenSelected, row details will be displayed only for a single row (the selected one). I believe that in this case you would want to leave this property set to Collapsed - row details won't be displayed for any of the rows (until you specify that).

If all of your columns are read-only and no editing will occur (which is normally activated once the cells are double-clicked), you can add the following handler to your rows to have row details expanded upon double-click:

private void ClubsGrid_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
    if (e.Row is GridViewRow)
    {
        e.Row.AddHandler(GridViewRow.MouseDoubleClickEvent, new MouseButtonEventHandler(OnMouseDoubleClick), true);
    }
}
 
private void OnMouseDoubleClick(object sender, MouseButtonEventArgs args)
{
    var row = sender as GridViewRow;
    row.DetailsVisibility = row.DetailsVisibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
}

Please let me know if this is what you had in mind. If that is not the case, please share some more details on the desired result and I will gladly assist you further.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Brahim
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or