コード例 #1
0
        private void DecimalUpDown_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            //USED ONLY FOR VECTOR3 BINDS
            Vector3 v = (Vector3)(WPFHelper.FindParent <DataNodeControl>(sender as DependencyObject).DataContext as PropertyValueConverter.PropertyInfo)
                        .PropertyValue;
            IEnumerable <float> comps = ((sender as FrameworkElement).DataContext as IEnumerable <float>);

            v.X = comps.ElementAt(0);
            v.Y = comps.ElementAt(1);
            v.Z = comps.ElementAt(2);
            (WPFHelper.FindParent <DataNodeControl>(sender as DependencyObject).DataContext as PropertyValueConverter.PropertyInfo)
            .PropertyValue = v;
        }
コード例 #2
0
        public void Drop(object sender, DragEventArgs e, DropType type)
        {
            //var source = WPFHelper.FindParent<HierarchyControl>(e.Data.GetData() as TextBlock);
            var source        = e.Data.GetData("control") as HierarchyControl;
            var target        = WPFHelper.FindParent <HierarchyControl>(sender as DependencyObject);
            var source_parent = WPFHelper.FindParent <HierarchyControl>(source);

            source.Effect          = null;
            source.RenderTransform = null;

            //make sure we aren't double dropping
            if (source != target)
            {
                //drop into the target hierarchy control as child
                switch (type)
                {
                case DropType.NORMAL:
                    foreach (GameObject g in EngineManagerViewModel.instance.SelectedGameObjects)
                    {
                        if (g != source.GetDataContext())
                        {
                            target.Virtual_AddChild(g);
                        }
                    }
                    target.Virtual_AddChild(source);
                    break;

                case DropType.SEPARATOR:
                    target.Virtual_DetachChild(source);
                    break;

                case DropType.FOLDER:
                    target.Virtual_DetachChild(source);
                    break;
                }

                //remove it from the intermediate visualization
                foreach (GameObject g in EngineManagerViewModel.instance.SelectedGameObjects)
                {
                    source_parent.IntermediateSource.Remove(g);
                }
                source_parent.IntermediateSource.Remove(source.myGameObject);
            }

            DestroyDragDropWindow();

            e.Handled = true;
        }
コード例 #3
0
        void HierarchyControl_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            //not working ------------------
            if (sender is TextBlock)
            {
                var clickedItem = WPFHelper.FindParent <HierarchyControl>(sender as TextBlock);

                if (!clickedItem.IsFolder)
                {
                    clickedItem.Select();
                }
                else
                {
                    foreach (var child in clickedItem.Children)
                    {
                        child.IsSelected = true;
                        HierarchyControlSelectionManager.HierarchyControlStateManager.GObjAdditiveSelectRefresh(child);
                    }
                }
            }
        }
コード例 #4
0
        void HierarchyControl_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (sender is TextBlock)
            {
                var draggedItem = WPFHelper.FindParent <HierarchyControl>(sender as TextBlock);

                //create drag and drop item
                DragController.CreateDragDropWindow(draggedItem);

                //get rid of this hierarchy control manually
                HierarchyControl_Unloaded(null, null);

                DataObject dragData = new DataObject("control", draggedItem);
                DragDrop.DoDragDrop(draggedItem, dragData, DragDropEffects.All);

                DragController.DestroyDragDropWindow();

                e.Handled = true;
            }
            ;
        }