| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- /*************************************************************************************
- Extended WPF Toolkit
- Copyright (C) 2007-2013 Xceed Software Inc.
- This program is provided to you under the terms of the Microsoft Public
- License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
- For more features, controls, and fast professional support,
- pick up the Plus Edition at http://xceed.com/wpf_toolkit
- Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
- ***********************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Collections.ObjectModel;
- using System.Windows.Controls;
- using System.Windows.Data;
- using Xceed.Wpf.AvalonDock.Layout;
- namespace Xceed.Wpf.AvalonDock.Controls
- {
- public class LayoutDocumentPaneControl : TabControl, ILayoutControl//, ILogicalChildrenContainer
- {
- static LayoutDocumentPaneControl()
- {
- FocusableProperty.OverrideMetadata(typeof(LayoutDocumentPaneControl), new FrameworkPropertyMetadata(false));
- }
- internal LayoutDocumentPaneControl(LayoutDocumentPane model)
- {
- if (model == null)
- throw new ArgumentNullException("model");
- _model = model;
- SetBinding(ItemsSourceProperty, new Binding("Model.Children") { Source = this });
- SetBinding(FlowDirectionProperty, new Binding("Model.Root.Manager.FlowDirection") { Source = this });
- this.LayoutUpdated += new EventHandler(OnLayoutUpdated);
- }
- void OnLayoutUpdated(object sender, EventArgs e)
- {
- var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
- modelWithAtcualSize.ActualWidth = ActualWidth;
- modelWithAtcualSize.ActualHeight = ActualHeight;
- }
- protected override void OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
- {
- base.OnGotKeyboardFocus(e);
- System.Diagnostics.Trace.WriteLine( string.Format( "OnGotKeyboardFocus({0}, {1})", e.Source, e.NewFocus ) );
- //if (_model.SelectedContent != null)
- // _model.SelectedContent.IsActive = true;
- }
- protected override void OnSelectionChanged(SelectionChangedEventArgs e)
- {
- base.OnSelectionChanged(e);
- if (_model.SelectedContent != null)
- _model.SelectedContent.IsActive = true;
- }
- List<object> _logicalChildren = new List<object>();
- protected override System.Collections.IEnumerator LogicalChildren
- {
- get
- {
- return _logicalChildren.GetEnumerator();
- }
- }
- LayoutDocumentPane _model;
- public ILayoutElement Model
- {
- get { return _model; }
- }
- protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
- {
- base.OnMouseLeftButtonDown(e);
- if (!e.Handled && _model.SelectedContent != null)
- _model.SelectedContent.IsActive = true;
- }
- protected override void OnMouseRightButtonDown(System.Windows.Input.MouseButtonEventArgs e)
- {
- base.OnMouseRightButtonDown(e);
- if (!e.Handled && _model.SelectedContent != null)
- _model.SelectedContent.IsActive = true;
- }
- }
- }
|