void IActivationSite.NotifyActivation(object child) { var layoutInstance = child as LayoutInstance; if (layoutInstance != null) { this.lastActiveLayout = layoutInstance; } }
void IActivationSite.BubbleActivation(object child) { var layoutInstance = child as LayoutInstance; if (layoutInstance != null && this.Items.Contains(layoutInstance)) { this.lastActiveLayout = layoutInstance; this.SelectedIndex = this.Items.IndexOf(layoutInstance); } }
public void ReplicateLayoutState(LayoutInstance layoutToCopy) { foreach (var kvp in this.existingSlotContents) { var ourSlotContent = kvp.Value; var slotContentToCopy = layoutToCopy.existingSlotContents[kvp.Key]; ourSlotContent.ReplicateSlotContentState(slotContentToCopy); } }
public void Dispose() { if (this.view != null) { this.view.Closed -= OnViewClosed; this.view.PropertyChanged -= OnViewPropertyChanged; this.view = null; } if (this.targetLayoutInstance != null) { this.targetLayoutInstance.viewBindings.Remove(this); this.targetLayoutInstance = null; } }
public ViewBinding(LayoutInstance targetLayoutInstance, Func <View, bool> searchPredicate) { // Terminology reminder for bindings: // "Target" refers to the thing that wants to track another view (the "target" of the update when the source changes) // "Source" refers to the thing the target wants to be bound to this.targetLayoutInstance = targetLayoutInstance; this.searchPredicate = searchPredicate; targetLayoutInstance.viewBindings.Add(this); // Delay the first attempt at binding to the view, to avoid mis-bindings on initial // layout creation. (The rest of the layout may not be populated yet, so doing a // binding immediately will usually not resolve correctly). Dispatcher.CurrentDispatcher.BeginInvoke((Action)(() => UpdateBinding()), DispatcherPriority.Background); }
protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { var tabItem = element as TabItem; var data = item as LayoutInstance; if (tabItem == null) { base.PrepareContainerForItemOverride(element, item); return; } if (data != null) { var headerBinding = new Binding { Source = data.LayoutDefinition, Path = new PropertyPath(LayoutDefinition.HeaderProperty), Mode = BindingMode.TwoWay }; tabItem.SetBinding(TabItem.HeaderProperty, headerBinding); tabItem.SetBinding(System.Windows.Automation.AutomationProperties.AutomationIdProperty, headerBinding); tabItem.Content = data.LayoutControl; } else if (item is LayoutDefinition) { var tabData = item as LayoutDefinition; var headerBinding = new Binding { Source = tabData, Path = new PropertyPath(LayoutDefinition.HeaderProperty), Mode = BindingMode.TwoWay }; tabItem.SetBinding(TabItem.HeaderProperty, headerBinding); tabItem.SetBinding(System.Windows.Automation.AutomationProperties.AutomationIdProperty, headerBinding); // WPF's bindings are strange, so if our ServiceProvider is bound, it shows as null here var sp = this.ServiceProvider ?? this.FindParent <ToolsUIWindow>().ServiceProvider; var layoutInstance = new LayoutInstance(sp, this, tabData, true); tabItem.Content = layoutInstance.LayoutControl; } }
public SlotContent(LayoutInstance layoutInstance, string slotName) { this.ParentSite = layoutInstance; this.SlotName = slotName; this.layoutControl = layoutInstance.LayoutControl; }
public LayoutControl(LayoutInstance layoutInstance) { this.LayoutInstance = layoutInstance; this.CommandBindings.Add(new CommandBinding(ViewShortcutCommand, OnViewShortcutExecuted)); }
public ViewBindingComparer(LayoutInstance targetLayoutInstance) { this.targetLayoutInstance = targetLayoutInstance; }