RadiantQ Forum

Product => WPF Gantt Package => Topic started by: Marlene.Witsch on June 10, 2016, 08:47:09 AM

Title: getting task by coordinates
Post by: Marlene.Witsch 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
Title: Re: getting task by coordinates
Post by: Rajagopal 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.
Title: Re: getting task by coordinates
Post by: Marlene.Witsch 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. 
Title: Re: getting task by coordinates
Post by: Rajagopal 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.