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

Clickable Cells in Q3 Release

1 Answer 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 05 Nov 2009, 08:32 AM
Hello

I've just installed the Q3 release and it looks to be working well!  I've come across one issue so far.  I have a lot of clickable cells in my grids, which are used to drill down further into the software and retrieve more detail.  These have all stopped working since installing the release.

Here's how I implement the event handlers in a column:
                <telerik:GridViewDataColumn Width="Auto" Header="Job Number" Name="JobNumber" 
                                            DataMemberBinding="{Binding sgContractNo}" SortingState="Ascending" Focusable="False" > 
                    <telerik:GridViewColumn.CellStyle> 
                        <Style TargetType="{x:Type telerik:GridViewCell}"
                            <EventSetter Event="MouseUp" Handler="JobNumber_LeftMouseUp" /> 
                        </Style> 
                    </telerik:GridViewColumn.CellStyle> 
 
                </telerik:GridViewDataColumn> 

For some reason this has stopped working!  Any ideas on how to get it going again? Basically, the event specified doesn't fire at all.

1 Answer, 1 is accepted

Sort by
0
Accepted
Milan
Telerik team
answered on 05 Nov 2009, 05:15 PM
Hi James,

The latest version of RadGridView handles the MouseLeftButtonUp, and MouseLeftButtonUp events and as a result the EventSetter in your code is not working. 

You can workaround this problem by subscribing to MouseUp events in code which gives the option to handle already handles events. For example:

public Window1()
{
    this.InitializeComponent();
     
    this.gridView.AddHandler(GridViewCell.MouseLeftButtonUpEvent, new MouseButtonEventHandler(OnGridMouseLeftButtonUp), true);
}
  
private void OnGridMouseLeftButtonUp(object s, MouseButtonEventArgs args)
{
    var senderElement = (FrameworkElement)args.OriginalSource;
    var clickedCell = senderElement.ParentOfType<GridViewCell>();
  
    if (clickedCell != null)
    {
        // execute logic
    }
}

Hope this helps.

Kind regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
James
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or