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

KineticScrolling fires ItemMouseClick event

3 Answers 68 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Lars
Top achievements
Rank 1
Lars asked on 09 Aug 2011, 08:48 AM
Hello,

I am evaluating the new ListView with kinetic scrolling and discovered a strange behavior when releasing the mouse after a kinetic scroll - the ItemMouseClick event is fired and the item is also selected. Is there some way to avoid this?

Best Regards
Lars Krog-Jensen

3 Answers, 1 is accepted

Sort by
0
Alex Lawson
Top achievements
Rank 1
answered on 10 Aug 2011, 02:43 PM
Hi Lars,

Scary - We are doing much the same thing it seems, heres how I dealt with it temporarily:

private Point _downXY ;
private int _tolerance = 50;
 
private void lstSelect_ItemMouseDown(object sender, ListViewItemMouseEventArgs e)
{
  // Store press detection
 
  _downXY = Cursor.Position;
 
  // Find object key
 
  var selectedView = (DataRowView)e.Item.Value;
  _selectedUserId = Convert.ToInt32(selectedView.Row.ItemArray[0]);
}
 
private void lstSelect_ItemMouseUp(object sender, ListViewItemMouseEventArgs e)
{
  // Evaluate location
 
  var upXy = Cursor.Position;
  var xDiff = _downXY.X - upXy.X;
  var yDiff = _downXY.Y - upXy.Y;
 
  if (xDiff < 0)
  {
    xDiff = -xDiff;
  }
 
  if (yDiff < 0)
  {
    yDiff = -yDiff;
  }
 
  if (xDiff < _tolerance && yDiff < _tolerance)
  {
    // Select
 
    Close();
  }
}

Hope that helps.
0
Lars
Top achievements
Rank 1
answered on 10 Aug 2011, 05:00 PM
Hello Alex,

Thanks for your reply and the suggested workaround fixes a part of the problem; I have more control over when to trigger a mouse click action, but the item (row) where the mouse is release is still being selected.

BR
Lars
0
Stefan
Telerik team
answered on 11 Aug 2011, 12:05 PM
Hello Lars,

Thank you for writing.

@Alex: Thank you for the community effort. 

@Lars: Currently this is the default behavior of RadListView when kinetic scrolling is executed. However, your suggestion seems quite reasonable, and this is why I have added it to our PITS system as a feature request, which we will implement in a future release. Please follow this link to add your vote for this request and increase its priority. 

I have updated your Telerik points for this suggestion.

Should you have any other questions, do not hesitate to contact us.

Kind regards,
Stefan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
ListView
Asked by
Lars
Top achievements
Rank 1
Answers by
Alex Lawson
Top achievements
Rank 1
Lars
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or