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

RadGridView DoubleClick fires on the header, the scrollbar, and on non-rows

1 Answer 276 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 11 Dec 2012, 11:23 PM
I wish for my edit window (RentalTicket) to only open when I double click on a valid row.  I want nothing to happen if the headers are double clicked, or if the scrollbar is double clicked.
Also, when I click on blank space in my RadGridView, the selected row is still selected.  I think that the selected row should de-select if I click on a non row in the RadView Grid.

My RadGridView:
</telerik:RadGridView>
        <telerik:RadGridView AutoGenerateColumns="False" Margin="12,0,12,12" Name="radGridViewNeedsShipping" SelectionMode="Extended" ShowGroupPanel="False" Height="190" VerticalAlignment="Bottom" MouseDoubleClick="rgvOpenTicket" >
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="PO Number" IsReadOnly="True" UniqueName="SerialNumber" CellStyleSelector="{StaticResource transactionStyleSelector}"/>
                <telerik:GridViewDataColumn Header="Customer" IsReadOnly="True" UniqueName="Customer.EntityName" />
                <telerik:GridViewDataColumn Header="Ship By Date" IsReadOnly="True" UniqueName="TransactionDate" DataFormatString="{}{0:MM/dd/yyyy}"/>
                <telerik:GridViewDataColumn Header="Type" IsReadOnly="True" DataMemberBinding="{Binding Path=TransactionTypeId, Converter={StaticResource transactionTypeConverter}}" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

and this is my doubleClicked function:
private void rgvOpenTicket(object sender, MouseButtonEventArgs e)       
        {
            RentalTicket rt = new RentalTicket(((Transaction)((Telerik.Windows.Controls.RadGridView)sender).SelectedItem));
            rt.Closing += new System.ComponentModel.CancelEventHandler(dispatcherTimer_Tick);
            rt.Show();
        }

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 14 Dec 2012, 10:14 AM
Hello Craig,

You can easily achieve the behavior you are looking for. 
I wish for my edit window (RentalTicket) to only open when I double click on a valid row.  I want nothing to happen if the headers are double clicked, or if the scrollbar is double clicked.
You can subscribe to the RowActivated event and open the edit window there. 

Also, when I click on blank space in my RadGridView, the selected row is still selected.  I think that the selected row should de-select if I click on a non row in the RadView Grid.
You can handle the row's MouseDown events and deselect the row if no cell was clicked.

Hope this helps! 

Regards,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Craig
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or