We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Is it possible to drag items to Schedule from the DataGrid or a ListBox?

Thread ID:

Created:

Updated:

Platform:

Replies:

120947 Oct 29,2015 03:04 AM UTC May 29,2017 10:07 AM UTC WPF 13
loading
Tags: Schedule
Jethro
Asked On October 29, 2015 03:04 AM UTC

I would like to make a Schedule where the items from a DataGrid or a listbox can migrate to the schedule where the items that is dragged to the Schedule will Show like this:
ListBox
Schedule
Math ---> DraggedMath
9:00 - 12:00











and the item Math contains particular length of time and the user can place it in the schedule wherever he wants. And also how to get the time where the item is dragged.
If you have a suggestion please do. Thanks

Vigneshkumar Ramasamy [Syncfusion]
Replied On November 2, 2015 03:12 PM UTC

Hi Jethro,

As of now we don’t have any support to drag items from data grid or list view in schedule control

Regards

Vigneshkumar R.


Jethro
Replied On November 4, 2015 05:44 AM UTC

I made a listBox with subjects in it. This is the code:
private void listSubjects_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ListBox parent = (ListBox)sender;
            dragSource = parent;
            object data = GetDataFromListBox(dragSource, e.GetPosition(parent));

            if (data != null)
            {
                DragDrop.DoDragDrop(parent, data, DragDropEffects.Move);
            }
        }
private static object GetDataFromListBox(ListBox source, Point point)
        {
            UIElement element = source.InputHitTest(point) as UIElement;
            if (element != null)
            {
                object data = DependencyProperty.UnsetValue;
                while (data == DependencyProperty.UnsetValue)
                {
                    data = source.ItemContainerGenerator.ItemFromContainer(element);
                    if (data == DependencyProperty.UnsetValue)
                    {
                        element = VisualTreeHelper.GetParent(element) as UIElement;
                    }
                    if (element == source)
                    {
                        return null;
                    }
                }
                if (data != DependencyProperty.UnsetValue)
                {
                    return data;
                }
            }
            return null;
        }
private void Schedule_Drop(object sender, DragEventArgs e)
        {
            SfSchedule parent = (SfSchedule)sender;
            object data = e.Data.GetData(typeof(string));
            

            AppointmentCollection.Add(new ScheduleAppointment()
            {

                StartTime = Convert.ToDateTime("13:00"),
                EndTime = Convert.ToDateTime("16:00"),
                Subject = data.ToString()
            });

            Schedule.Appointments = AppointmentCollection;
            listSubjects.Items.Remove(data);

        }

I would like to get the day and time where I drop the data. You see in the codes above that I manually added the time which is I want to enter the date where I dropped it. 
Can you help me?

Vigneshkumar Ramasamy [Syncfusion]
Replied On November 5, 2015 08:41 AM UTC

Hi Jethro

We have implemented the similar requirement in the schedule WinRT platform. In WinRT SfScehdule, we place the dragged item where we have dropped. Please refer to the following KB article.

KB Link: http://www.syncfusion.com/kb/2854/how-to-do-a-draganddrop-of-listview-items-into-sfschedule-control

Also, we have implementing this requirement in the Schedule wpf platform which will be available in upcoming service pack release at the end of November.

Regards

Vigneshkumar R 


Pera Dragan
Replied On May 14, 2017 06:09 PM UTC

Hello Vigneshkumar,

Has this feature been released for the WPF Schedule control?

Regards,
Pera D

Vigneshkumar Ramasamy [Syncfusion]
Replied On May 15, 2017 10:41 AM UTC

Hi Pera, 
 
We have not implemented this feature in schedule control, since we have other important release related tasks. We have already logged a feature report on this for SfSchedule control and it will be implemented in any of our upcoming release. 
 
Regards 
Vigneshkumar R 


Pera Dragan
Replied On May 21, 2017 02:20 PM UTC

Hello Vigneshkumar,

Is there a workaround for this feature and could you provide me with a code sample for it?

Regards,
Pera D

Jethro
Replied On May 22, 2017 05:25 AM UTC

Hi Pera,

Are you doing the similar thing I wanted to accomplish?

Regards,
Jethro



Pera Dragan
Replied On May 22, 2017 06:52 PM UTC

Hello Jethro,

Yes, I want to do exactly the same thing. Did you find the solution?

Regards,
Pera D

Sivakumar Punniya Moorthi [Syncfusion]
Replied On May 24, 2017 02:02 PM UTC

Hi Pera & Jethro, 
 
Sorry for the inconvenience caused. 
 
we don’t have any work around to achieve this requirement, since we need some control level changes for this requirement. As per the earlier update logged a feature report on this for SfSchedule control and it will be implemented in any of our upcoming release. We will let you know once the implementation has done. 
 
Regards, 
Sivakumar P 


Jethro
Replied On May 25, 2017 08:41 AM UTC

Hello Pera,

Have you checked the codes above that I used?
In the appointment collection, you could just make the one variable unique so that you can still have the identity of the data,
Example:

7:00 is start time
10 is end time
subject would be English.
you could use the other variables to save your Primary Key.

Is this what you want to know? Just kindly ask what you need maybe I can help you with it.

Regards,
 Jethro

Pera Dragan
Replied On May 25, 2017 01:37 PM UTC

Hello Jethro,

We would like the start time of the event to be the same as for the cell where we dropped the item, not hard-coded to 7:00 for instance.

Thank you for the help
Regards,
Pera

Pera Dragan
Replied On May 29, 2017 08:57 AM UTC

I tried to mimic mouse clicks (raising mouse click events) in the drop event handler of the scheduler in order to open the event adding dialog but it didn't work. I probably didn't find the correct event that needs to be raised. Could you perhaps help me out with that?

Thanks,
Pera

Jethro
Replied On May 29, 2017 10:07 AM UTC

Hello Pera,

You are using ListBox?
Try to imitate the codes I used above. you can make an object. like I did and it has a property as a drag and drop.
I'll try to find the program that I used in the mean time try this.

Regards, 
Jethro

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;