コード例 #1
0
        void IActivationSite.NotifyActivation(object child)
        {
            var layoutInstance = child as LayoutInstance;

            if (layoutInstance != null)
            {
                this.lastActiveLayout = layoutInstance;
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        public void ReplicateLayoutState(LayoutInstance layoutToCopy)
        {
            foreach (var kvp in this.existingSlotContents)
            {
                var ourSlotContent    = kvp.Value;
                var slotContentToCopy = layoutToCopy.existingSlotContents[kvp.Key];

                ourSlotContent.ReplicateSlotContentState(slotContentToCopy);
            }
        }
コード例 #4
0
            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;
                }
            }
コード例 #5
0
            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);
            }
コード例 #6
0
        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;
            }
        }
コード例 #7
0
 public SlotContent(LayoutInstance layoutInstance, string slotName)
 {
     this.ParentSite    = layoutInstance;
     this.SlotName      = slotName;
     this.layoutControl = layoutInstance.LayoutControl;
 }
コード例 #8
0
 public LayoutControl(LayoutInstance layoutInstance)
 {
     this.LayoutInstance = layoutInstance;
     this.CommandBindings.Add(new CommandBinding(ViewShortcutCommand, OnViewShortcutExecuted));
 }
コード例 #9
0
 public ViewBindingComparer(LayoutInstance targetLayoutInstance)
 {
     this.targetLayoutInstance = targetLayoutInstance;
 }