Esempio n. 1
0
            private static void AddDraggedDataToNewPageDispatcherCallback(MetroControl parentControl, object newPageItem, object tileData, int callCount = 0)
            {
                var newPage = parentControl.ItemContainerGenerator.ContainerFromItem(newPageItem) as MetroStartPage;

                if (newPage == null)
                {
                    if (callCount < 1)
                    {
                        parentControl.Dispatcher.BeginInvoke(
                            new Action <MetroControl, object, object, int>(AddDraggedDataToNewPageDispatcherCallback),
                            DispatcherPriority.ApplicationIdle,
                            parentControl, newPageItem, tileData, callCount + 1);
                    }
                    return;
                }

                // Must repeat process of checking for ItemsSource with the new page.
                if (newPage.ItemsSource == null)
                {
                    newPage.Items.Add(tileData);
                }
                else
                {
                    dynamic list  = newPage.ItemsSource;
                    dynamic ddata = tileData;
                    list.Add(ddata);
                }
            }
Esempio n. 2
0
 public MetroControlDragDropHelper(MetroControl metroControl)
 {
     _MetroControl = metroControl;
     IsEnabled     = true; // Trigger the setter which sets up the event handlers.
 }