January 16, 2018, 11:40:12 AM

See more Support incidents in our old archived forum.

Author Topic: getting task by coordinates  (Read 952 times)

Marlene.Witsch

  • Customers
  • Newbie
  • *
  • Posts: 9
getting task by coordinates
« on: June 10, 2016, 08:47:09 AM »
I know you can get the DateTime for a x position. Now I was wondering if it is possible to get a task with for example the mouse position or just a x and y corrdinate?

Regards,
Marlene

Rajagopal

  • RQ Members
  • Jr. Member
  • *
  • Posts: 92
Re: getting task by coordinates
« Reply #1 on: June 10, 2016, 02:08:56 PM »
Marlene, yes you can. But, to begin with can you tell us what exactly you are trying to implement? We will confirm that you are following the right/best approach and then we will also share some code.


Thanks,
- Raja.

Marlene.Witsch

  • Customers
  • Newbie
  • *
  • Posts: 9
Re: getting task by coordinates
« Reply #2 on: October 31, 2016, 10:44:22 AM »
Oh sry for the long time for my reply. I can have multiple tasks in the same row at the same time window (using dynamic row height). And I want to drag an object on to a task.

Now I already have a drop target on the row so i can not use the task as drop target since the drop target of the row swallow the one for the task.

Currently i handle this situation via the drop handler of the row, by using the get time via X position of mouse and then check via code if there is a task at that time. If there is more then one i will sadly throw a error message saying that there are to many task and the object can not be assigned. 

Rajagopal

  • RQ Members
  • Jr. Member
  • *
  • Posts: 92
Re: getting task by coordinates
« Reply #3 on: November 02, 2016, 01:57:12 PM »
Marlene,

You can get the GanttTaskItemBar if you can get hold of "OriginalSource" on drop handler like this,

GanttTaskItemBar taskBar = Extensions.FindAncestor<GanttTaskItemBar>(e.OriginalSource as FrameworkElement);

The "taskBar" will be null if there is no task on drop location.


Thanks,
- Raja.