Пример #1
0
        public void OpenDocumentWindow(DockingControl content, bool canClose = true)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            var document = _documents.TryGetValue(content.Key);

            if (document == null)
            {
                content.Changed += OnDockingControlChanged;

                document = new LayoutDocument
                {
                    ContentId = content.Key,
                    Content   = content,
                    CanClose  = canClose
                };

                document.SetBindings(LayoutContent.TitleProperty, content, "Title");

                _documents.Add(content.Key, document);

                TabGroups.First().Children.Add(document);
                OnDockingControlChanged(content);
            }

            DockingManager.ActiveContent = document.Content;
        }
Пример #2
0
        public void OpenDocumentWindow(string key, string title, object content, bool canClose = true)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (title == null)
            {
                throw new ArgumentNullException(nameof(title));
            }

            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            var document = _documents.TryGetValue(key);

            if (document == null)
            {
                document = new LayoutDocument
                {
                    ContentId = key.ToString(),
                    Title     = title,
                    Content   = content,
                    CanClose  = canClose
                };

                _documents.Add(key, document);
                TabGroups.First().Children.Add(document);
            }

            DockingManager.ActiveContent = document.Content;
        }