All the controls missing in WPF. Over 1 million downloads.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
3.2 KiB

/*************************************************************************************
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 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;
}
}
}