Loading files
366e28f22This file is pinned to the selected release. Download the original to open it in your design tool.
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using IDE.Controls.WPF.Docking.Layout;
namespace IDE.Controls.WPF.Docking.Controls;
public class LayoutDocumentPaneControl : TabControl, ILayoutControl//, ILogicalChildrenContainer
{
#region Members
private List<object> _logicalChildren = new List<object>();
private LayoutDocumentPane _model;
#endregion
#region Constructors
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 });
// Handle SizeChanged event instead of LayoutUpdated. It will exlude fluctuations of Actual size values.
// this.LayoutUpdated += new EventHandler( OnLayoutUpdated );
this.SizeChanged += OnSizeChanged;
}
#endregion
#region Properties
public ILayoutElement Model
{
get
{
return _model;
}
}
#endregion
#region Overrides
protected override System.Collections.IEnumerator LogicalChildren
{
get
{
return _logicalChildren.GetEnumerator();
}
}
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
{
base.OnSelectionChanged(e);
if (_model.SelectedContent != null)
_model.SelectedContent.IsActive = true;
}
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;
}
#endregion
#region Private Methods
private void OnSizeChanged(object sender, SizeChangedEventArgs e)
{
var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
modelWithAtcualSize.ActualWidth = ActualWidth;
modelWithAtcualSize.ActualHeight = ActualHeight;
}
#endregion
}