private ElementBindingSourceNode BuildTree(SceneElement element, BindingEditor bindingEditor) { ElementBindingSourceNode bindingSourceNode1 = new ElementBindingSourceNode(element, this.selectionContext); foreach (SceneNode sceneNode in element.GetAllContent()) { BaseFrameworkElement frameworkElement = sceneNode as BaseFrameworkElement; if (frameworkElement != null) { ElementBindingSourceNode bindingSourceNode2 = this.BuildTree((SceneElement)frameworkElement, bindingEditor); if (bindingSourceNode2 != null) { bindingSourceNode1.AddChild((ElementNode)bindingSourceNode2); } } } if (element.ViewModel.TimelineItemManager.SortByZOrder) { bindingSourceNode1.Children.Reverse(); } if (bindingSourceNode1.Element is StyleNode) { bindingSourceNode1.IsSelectable = false; } return(bindingSourceNode1); }
private void UnhookSelectedNode() { if (this.selectedNode == null) { return; } this.selectedNode.PropertyChanged -= new PropertyChangedEventHandler(this.selectedNode_PropertyChanged); if (this.dataSchemaFilter != null) { this.selectedNode.SchemaItem.ClearDataSchemaItemFilter(); } this.selectedNode = (ElementBindingSourceNode)null; }
public ElementPropertyBindingSourceModel(SceneNode targetElement, DataSchemaItemFilter dataSchemaFilter) { this.selectionContext = (SelectionContext <ElementNode>) new SingleSelectionContext <ElementNode>(); this.selectionContext.PropertyChanged += new PropertyChangedEventHandler(this.selectionContext_PropertyChanged); this.root = this.BuildTree((SceneElement)targetElement.ViewModel.ActiveEditingContainer, targetElement.ViewModel.BindingEditor); this.root.IsExpanded = true; this.dataSchemaFilter = dataSchemaFilter; ElementNode elementNode = this.root.FindDescendantSceneNode(targetElement) ?? (ElementNode)this.root; if (!elementNode.IsSelectable) { return; } elementNode.ExpandAncestors(); this.selectionContext.SetSelection(elementNode); }
private void selectionContext_PropertyChanged(object sender, PropertyChangedEventArgs e) { this.UnhookSelectedNode(); this.selectedNode = (ElementBindingSourceNode)this.selectionContext.PrimarySelection; if (this.selectedNode != null) { this.selectedNode.PropertyChanged += new PropertyChangedEventHandler(this.selectedNode_PropertyChanged); if (this.dataSchemaFilter != null) { this.selectedNode.SchemaItem.SetDataSchemaItemFilter(this.dataSchemaFilter); } } this.OnPropertyChanged("SelectedNode"); this.OnPropertyChanged("Source"); this.OnPropertyChanged("Path"); this.OnPropertyChanged("Schema"); }
private void InitializeElementName(string elementName, string path) { this.CurrentBindingSource = (IBindingSourceModel)this.elementPropertyModel; if (elementName == null) { return; } ElementBindingSourceNode elementNodeByName = this.elementPropertyModel.FindElementNodeByName(elementName); if (elementNodeByName == null) { return; } elementNodeByName.ExpandAncestors(); this.elementPropertyModel.SelectedNode = elementNodeByName; DataSchemaItem itemFromPath = elementNodeByName.SchemaItem.GetItemFromPath(path); if (itemFromPath == null) { return; } elementNodeByName.SchemaItem.SelectedItem = itemFromPath; itemFromPath.ExpandAncestors(); }