private static DataBindingDragDropModel UpdateDragModel(DataBindingDragDropModel dragModel)
        {
            if (!JoltHelper.DatabindingSupported(dragModel.TargetNode.ProjectContext))
            {
                dragModel.DropFlags = DataBindingDragDropFlags.None;
                return(dragModel);
            }
            DataBindingDragDropHandler bindingDragDropHandler = (DataBindingDragDropHandler)null;

            for (int index = 0; index < DataBindingDragDropManager.handlers.Length; ++index)
            {
                bindingDragDropHandler = DataBindingDragDropManager.handlers[index];
                using (bindingDragDropHandler.InitDragModel(dragModel))
                {
                    if (bindingDragDropHandler.CanHandle())
                    {
                        dragModel = bindingDragDropHandler.DragModel;
                        break;
                    }
                    bindingDragDropHandler = (DataBindingDragDropHandler)null;
                }
            }
            DataBindingDragDropManager.targetHandler = bindingDragDropHandler;
            if (bindingDragDropHandler == null)
            {
                dragModel.DropFlags = DataBindingDragDropFlags.None;
            }
            else
            {
                dragModel.DropFlags &= dragModel.DragFlags;
            }
            return(dragModel);
        }
예제 #2
0
        protected BaseFrameworkElement GetReusableDetailsContainer(bool setDataContextIfMissing, bool canCheckParent)
        {
            SceneElement sceneElement = this.DragModel.TargetNode as SceneElement;

            if (sceneElement == null)
            {
                return((BaseFrameworkElement)null);
            }
            if (!this.IsSupportedDetailsContainer(sceneElement) && canCheckParent)
            {
                sceneElement = sceneElement.Parent as SceneElement;
                if (sceneElement == null || !this.IsSupportedDetailsContainer(sceneElement))
                {
                    return((BaseFrameworkElement)null);
                }
            }
            DataContextInfo dataContextInfo = new DataContextEvaluator().Evaluate((SceneNode)sceneElement);

            if (dataContextInfo != null && dataContextInfo.RawDataSource != null)
            {
                DataSourceInfo other = new DataSourceInfo(this.DragModel.DetailsContainerSchemaPath);
                if (dataContextInfo.DataSource.CompareSources(other) == DataSourceMatchCriteria.Exact)
                {
                    return((BaseFrameworkElement)sceneElement);
                }
            }
            DocumentCompositeNode documentCompositeNode = (DocumentCompositeNode)sceneElement.DocumentNode;

            if (documentCompositeNode.Properties[DesignTimeProperties.DesignDataContextProperty] != null || documentCompositeNode.Properties[BaseFrameworkElement.DataContextProperty] != null)
            {
                return((BaseFrameworkElement)null);
            }
            if (DataBindingDragDropHandler.ContainsDescendantsWithSourcelessBindings((DocumentNode)documentCompositeNode))
            {
                return((BaseFrameworkElement)null);
            }
            if (setDataContextIfMissing)
            {
                this.DragModel.ViewModel.BindingEditor.CreateAndSetBindingOrData((SceneNode)sceneElement, DesignTimeProperties.DesignDataContextProperty, this.DragModel.DetailsContainerSchemaPath);
                this.LinkDetailsWithMasterControl(sceneElement);
            }
            return((BaseFrameworkElement)sceneElement);
        }
예제 #3
0
        protected static bool ContainsDescendantsWithSourcelessBindings(DocumentNode documentNode)
        {
            DocumentCompositeNode documentCompositeNode = documentNode as DocumentCompositeNode;

            if (documentCompositeNode == null)
            {
                return(false);
            }
            if (documentCompositeNode.Type.IsBinding)
            {
                return(documentCompositeNode.Properties[BindingSceneNode.SourceProperty] == null);
            }
            foreach (DocumentNode documentNode1 in documentCompositeNode.ChildNodes)
            {
                if (DataBindingDragDropHandler.ContainsDescendantsWithSourcelessBindings(documentNode1))
                {
                    return(true);
                }
            }
            return(false);
        }
 public static void Reset()
 {
     DataBindingDragDropManager.isAltModifier      = new bool?();
     DataBindingDragDropManager.effectiveDragModel = (DataBindingDragDropModel)null;
     DataBindingDragDropManager.targetHandler      = (DataBindingDragDropHandler)null;
 }
예제 #5
0
 public void Dispose()
 {
     this.handler = (DataBindingDragDropHandler)null;
     GC.SuppressFinalize((object)this);
 }
예제 #6
0
 public DataModelSetter(DataBindingDragDropHandler handler, DataBindingDragDropModel dragModel)
 {
     this.handler           = handler;
     this.handler.DragModel = dragModel;
 }