diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/AssemblyVersionInfo.cs
index d0386451..5187d3fa 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/AssemblyVersionInfo.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/AssemblyVersionInfo.cs
@@ -21,7 +21,7 @@
internal static class _XceedVersionInfo
{
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
- public const string BaseVersion = "3.1";
+ public const string BaseVersion = "3.2";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/AssemblyVersionInfo.cs
index d0386451..5187d3fa 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/AssemblyVersionInfo.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/AssemblyVersionInfo.cs
@@ -21,7 +21,7 @@
internal static class _XceedVersionInfo
{
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
- public const string BaseVersion = "3.1";
+ public const string BaseVersion = "3.2";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/AssemblyVersionInfo.cs
index d0386451..5187d3fa 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/AssemblyVersionInfo.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/AssemblyVersionInfo.cs
@@ -21,7 +21,7 @@
internal static class _XceedVersionInfo
{
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
- public const string BaseVersion = "3.1";
+ public const string BaseVersion = "3.2";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs
index d0386451..5187d3fa 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs
@@ -21,7 +21,7 @@
internal static class _XceedVersionInfo
{
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
- public const string BaseVersion = "3.1";
+ public const string BaseVersion = "3.2";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs
index cee976ec..048554c0 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs
@@ -26,66 +26,73 @@ using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
- public class LayoutAnchorablePaneControl : TabControl, ILayoutControl//, ILogicalChildrenContainer
+ public class LayoutAnchorablePaneControl : TabControl, ILayoutControl//, ILogicalChildrenContainer
+ {
+ static LayoutAnchorablePaneControl()
{
- static LayoutAnchorablePaneControl()
- {
- FocusableProperty.OverrideMetadata(typeof(LayoutAnchorablePaneControl), new FrameworkPropertyMetadata(false));
- }
+ FocusableProperty.OverrideMetadata( typeof( LayoutAnchorablePaneControl ), new FrameworkPropertyMetadata( false ) );
+ }
- public LayoutAnchorablePaneControl(LayoutAnchorablePane model)
- {
- if (model == null)
- throw new ArgumentNullException("model");
+ public LayoutAnchorablePaneControl( LayoutAnchorablePane model )
+ {
+ if( model == null )
+ throw new ArgumentNullException( "model" );
- _model = model;
+ _model = model;
- SetBinding(ItemsSourceProperty, new Binding("Model.Children") { Source = this });
- SetBinding(FlowDirectionProperty, new Binding("Model.Root.Manager.FlowDirection") { Source = this });
+ SetBinding( ItemsSourceProperty, new Binding( "Model.Children" ) { Source = this } );
+ SetBinding( FlowDirectionProperty, new Binding( "Model.Root.Manager.FlowDirection" ) { Source = this } );
- this.LayoutUpdated += new EventHandler(OnLayoutUpdated);
- }
+ this.LayoutUpdated += new EventHandler( OnLayoutUpdated );
+ }
- void OnLayoutUpdated(object sender, EventArgs e)
- {
- var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
- modelWithAtcualSize.ActualWidth = ActualWidth;
- modelWithAtcualSize.ActualHeight = ActualHeight;
- }
+ void OnLayoutUpdated( object sender, EventArgs e )
+ {
+ var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
+ modelWithAtcualSize.ActualWidth = ActualWidth;
+ modelWithAtcualSize.ActualHeight = ActualHeight;
+ }
- LayoutAnchorablePane _model;
+ LayoutAnchorablePane _model;
- public ILayoutElement Model
- {
- get { return _model; }
- }
+ public ILayoutElement Model
+ {
+ get
+ {
+ return _model;
+ }
+ }
- protected override void OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
- {
- if ((_model != null) && (_model.SelectedContent != null))
- {
- _model.SelectedContent.IsActive = true;
- }
+ protected override void OnGotKeyboardFocus( System.Windows.Input.KeyboardFocusChangedEventArgs e )
+ {
+ if( ( _model != null ) && ( _model.SelectedContent != null ) )
+ {
+ _model.SelectedContent.IsActive = true;
+ }
- base.OnGotKeyboardFocus(e);
- }
+ base.OnGotKeyboardFocus( e );
+ }
- protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
- {
- base.OnMouseLeftButtonDown(e);
+ protected override void OnMouseLeftButtonDown( System.Windows.Input.MouseButtonEventArgs e )
+ {
+ base.OnMouseLeftButtonDown( e );
- if (!e.Handled && _model.SelectedContent != null)
- _model.SelectedContent.IsActive = true;
- }
+ if( !e.Handled && ( _model != null ) && ( _model.SelectedContent != null ) )
+ {
+ _model.SelectedContent.IsActive = true;
+ }
+ }
- protected override void OnMouseRightButtonDown(System.Windows.Input.MouseButtonEventArgs e)
- {
- base.OnMouseRightButtonDown(e);
+ protected override void OnMouseRightButtonDown( System.Windows.Input.MouseButtonEventArgs e )
+ {
+ base.OnMouseRightButtonDown( e );
- if (!e.Handled && _model.SelectedContent != null)
- _model.SelectedContent.IsActive = true;
+ if( !e.Handled && ( _model != null ) && ( _model.SelectedContent != null ) )
+ {
+ _model.SelectedContent.IsActive = true;
+ }
+ }
- }
+ }
- }
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs
index 856260cf..f376bd89 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs
@@ -28,197 +28,203 @@ using System.Diagnostics;
namespace Xceed.Wpf.AvalonDock.Controls
{
- public class LayoutAnchorableTabItem : Control
- {
- static LayoutAnchorableTabItem()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(LayoutAnchorableTabItem), new FrameworkPropertyMetadata(typeof(LayoutAnchorableTabItem)));
- }
-
- public LayoutAnchorableTabItem()
- {
- }
-
-
-
- #region Model
-
- ///
- /// Model Dependency Property
- ///
- public static readonly DependencyProperty ModelProperty =
- DependencyProperty.Register("Model", typeof(LayoutContent), typeof(LayoutAnchorableTabItem),
- new FrameworkPropertyMetadata((LayoutContent)null,
- new PropertyChangedCallback(OnModelChanged)));
-
- ///
- /// Gets or sets the Model property. This dependency property
- /// indicates model attached to the anchorable tab item.
- ///
- public LayoutContent Model
- {
- get { return (LayoutContent)GetValue(ModelProperty); }
- set { SetValue(ModelProperty, value); }
- }
-
- ///
- /// Handles changes to the Model property.
- ///
- private static void OnModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- ((LayoutAnchorableTabItem)d).OnModelChanged(e);
- }
-
- ///
- /// Provides derived classes an opportunity to handle changes to the Model property.
- ///
- protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e)
- {
- if (Model != null)
- SetLayoutItem(Model.Root.Manager.GetLayoutItemFromModel(Model));
- else
- SetLayoutItem(null);
- //UpdateLogicalParent();
- }
-
- #endregion
-
- #region LayoutItem
-
- ///
- /// LayoutItem Read-Only Dependency Property
- ///
- private static readonly DependencyPropertyKey LayoutItemPropertyKey
- = DependencyProperty.RegisterReadOnly("LayoutItem", typeof(LayoutItem), typeof(LayoutAnchorableTabItem),
- new FrameworkPropertyMetadata((LayoutItem)null));
-
- public static readonly DependencyProperty LayoutItemProperty
- = LayoutItemPropertyKey.DependencyProperty;
-
- ///
- /// Gets the LayoutItem property. This dependency property
- /// indicates the LayoutItem attached to this tag item.
- ///
- public LayoutItem LayoutItem
- {
- get { return (LayoutItem)GetValue(LayoutItemProperty); }
- }
-
- ///
- /// Provides a secure method for setting the LayoutItem property.
- /// This dependency property indicates the LayoutItem attached to this tag item.
- ///
- /// The new value for the property.
- protected void SetLayoutItem(LayoutItem value)
- {
- SetValue(LayoutItemPropertyKey, value);
- }
-
- #endregion
-
- private bool _isMouseDown = false;
- private static LayoutAnchorableTabItem _draggingItem = null;
- // There's an issue with panes resizing when selecting another tab, causing a
- // mouse leave event to make the tab undock. This fixes that.
- private static bool _cancelNextMouseLeave = false;
-
- internal static bool IsDraggingItem()
- {
- return _draggingItem != null;
- }
-
- internal static LayoutAnchorableTabItem GetDraggingItem()
- {
- return _draggingItem;
- }
- internal static void ResetDraggingItem()
- {
- _draggingItem = null;
- }
- internal static void CancelNextMouseLeave()
- {
- _cancelNextMouseLeave = true;
- }
-
- protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
- {
- base.OnMouseLeftButtonDown(e);
-
- _isMouseDown = true;
- _draggingItem = this;
- }
-
- protected override void OnMouseMove(System.Windows.Input.MouseEventArgs e)
- {
- base.OnMouseMove(e);
-
- if (e.LeftButton != MouseButtonState.Pressed)
- {
- _isMouseDown = false;
- _draggingItem = null;
- }
- else
- {
- _cancelNextMouseLeave = false;
- }
-
- }
-
- protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e)
- {
- _isMouseDown = false;
-
- base.OnMouseLeftButtonUp(e);
-
- Model.IsActive = true;
- }
-
- protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
- {
- base.OnMouseLeave(e);
-
- if (_isMouseDown && e.LeftButton == MouseButtonState.Pressed)
- {
- if (!_cancelNextMouseLeave)
- {
- _draggingItem = this;
- }
- else
- {
- _draggingItem = null;
- }
- }
-
- _isMouseDown = false;
- _cancelNextMouseLeave = false;
- }
-
- protected override void OnMouseEnter(MouseEventArgs e)
- {
- base.OnMouseEnter(e);
-
- if (_draggingItem != null &&
- _draggingItem != this &&
- e.LeftButton == MouseButtonState.Pressed)
- {
- var model = Model;
- var container = model.Parent as ILayoutContainer;
- var containerPane = model.Parent as ILayoutPane;
-
- if( (containerPane is LayoutAnchorablePane) && !((LayoutAnchorablePane)containerPane).CanRepositionItems )
- return;
- if( (containerPane.Parent != null) && (containerPane.Parent is LayoutAnchorablePaneGroup) && !((LayoutAnchorablePaneGroup)containerPane.Parent).CanRepositionItems )
- return;
-
- var childrenList = container.Children.ToList();
- containerPane.MoveChild( childrenList.IndexOf( _draggingItem.Model ), childrenList.IndexOf( model ) );
- }
- }
-
- protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
- {
- base.OnPreviewGotKeyboardFocus(e);
-
- }
+ public class LayoutAnchorableTabItem : Control
+ {
+ #region Members
+
+ private bool _isMouseDown = false;
+ private static LayoutAnchorableTabItem _draggingItem = null;
+ private static bool _cancelMouseLeave = false;
+
+ #endregion
+
+ static LayoutAnchorableTabItem()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutAnchorableTabItem ), new FrameworkPropertyMetadata( typeof( LayoutAnchorableTabItem ) ) );
+ }
+
+ public LayoutAnchorableTabItem()
+ {
+ }
+
+
+
+ #region Model
+
+ ///
+ /// Model Dependency Property
+ ///
+ public static readonly DependencyProperty ModelProperty =
+ DependencyProperty.Register( "Model", typeof( LayoutContent ), typeof( LayoutAnchorableTabItem ),
+ new FrameworkPropertyMetadata( (LayoutContent)null,
+ new PropertyChangedCallback( OnModelChanged ) ) );
+
+ ///
+ /// Gets or sets the Model property. This dependency property
+ /// indicates model attached to the anchorable tab item.
+ ///
+ public LayoutContent Model
+ {
+ get
+ {
+ return (LayoutContent)GetValue( ModelProperty );
+ }
+ set
+ {
+ SetValue( ModelProperty, value );
+ }
+ }
+
+ ///
+ /// Handles changes to the Model property.
+ ///
+ private static void OnModelChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
+ {
+ ( (LayoutAnchorableTabItem)d ).OnModelChanged( e );
+ }
+
+ ///
+ /// Provides derived classes an opportunity to handle changes to the Model property.
+ ///
+ protected virtual void OnModelChanged( DependencyPropertyChangedEventArgs e )
+ {
+ if( Model != null )
+ SetLayoutItem( Model.Root.Manager.GetLayoutItemFromModel( Model ) );
+ else
+ SetLayoutItem( null );
+ //UpdateLogicalParent();
+ }
+
+ #endregion
+
+ #region LayoutItem
+
+ ///
+ /// LayoutItem Read-Only Dependency Property
+ ///
+ private static readonly DependencyPropertyKey LayoutItemPropertyKey
+ = DependencyProperty.RegisterReadOnly( "LayoutItem", typeof( LayoutItem ), typeof( LayoutAnchorableTabItem ),
+ new FrameworkPropertyMetadata( (LayoutItem)null ) );
+
+ public static readonly DependencyProperty LayoutItemProperty
+ = LayoutItemPropertyKey.DependencyProperty;
+
+ ///
+ /// Gets the LayoutItem property. This dependency property
+ /// indicates the LayoutItem attached to this tag item.
+ ///
+ public LayoutItem LayoutItem
+ {
+ get
+ {
+ return (LayoutItem)GetValue( LayoutItemProperty );
+ }
+ }
+
+ ///
+ /// Provides a secure method for setting the LayoutItem property.
+ /// This dependency property indicates the LayoutItem attached to this tag item.
+ ///
+ /// The new value for the property.
+ protected void SetLayoutItem( LayoutItem value )
+ {
+ SetValue( LayoutItemPropertyKey, value );
+ }
+
+ #endregion
+
+ protected override void OnMouseLeftButtonDown( System.Windows.Input.MouseButtonEventArgs e )
+ {
+ base.OnMouseLeftButtonDown( e );
+
+ _isMouseDown = true;
+ _draggingItem = this;
+ }
+
+ protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e )
+ {
+ base.OnMouseMove( e );
+
+ if( e.LeftButton != MouseButtonState.Pressed )
+ {
+ _isMouseDown = false;
+ _draggingItem = null;
+ }
+ else
+ {
+ _cancelMouseLeave = false;
+ }
+ }
+
+ protected override void OnMouseLeftButtonUp( System.Windows.Input.MouseButtonEventArgs e )
+ {
+ _isMouseDown = false;
+
+ base.OnMouseLeftButtonUp( e );
+
+ Model.IsActive = true;
+ }
+
+ protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e )
+ {
+ base.OnMouseLeave( e );
+
+ if( _isMouseDown && e.LeftButton == MouseButtonState.Pressed )
+ {
+ // drag the item if the mouse leave is not canceled.
+ // Mouse leave should be canceled when selecting a new tab to prevent automatic undock when Panel size is Auto.
+ _draggingItem = !_cancelMouseLeave ? this : null;
+ }
+
+ _isMouseDown = false;
+ _cancelMouseLeave = false;
+ }
+
+ protected override void OnMouseEnter( MouseEventArgs e )
+ {
+ base.OnMouseEnter( e );
+
+ if( _draggingItem != null &&
+ _draggingItem != this &&
+ e.LeftButton == MouseButtonState.Pressed )
+ {
+ var model = Model;
+ var container = model.Parent as ILayoutContainer;
+ var containerPane = model.Parent as ILayoutPane;
+
+ if( ( containerPane is LayoutAnchorablePane ) && !( (LayoutAnchorablePane)containerPane ).CanRepositionItems )
+ return;
+ if( ( containerPane.Parent != null ) && ( containerPane.Parent is LayoutAnchorablePaneGroup ) && !( (LayoutAnchorablePaneGroup)containerPane.Parent ).CanRepositionItems )
+ return;
+
+ var childrenList = container.Children.ToList();
+ containerPane.MoveChild( childrenList.IndexOf( _draggingItem.Model ), childrenList.IndexOf( model ) );
+ }
+ }
+
+ protected override void OnPreviewGotKeyboardFocus( KeyboardFocusChangedEventArgs e )
+ {
+ base.OnPreviewGotKeyboardFocus( e );
+
+ }
+
+ internal static bool IsDraggingItem()
+ {
+ return _draggingItem != null;
+ }
+
+ internal static LayoutAnchorableTabItem GetDraggingItem()
+ {
+ return _draggingItem;
+ }
+ internal static void ResetDraggingItem()
+ {
+ _draggingItem = null;
+ }
+
+ internal static void CancelMouseLeave()
+ {
+ _cancelMouseLeave = true;
}
+ }
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutFloatingWindowControl.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutFloatingWindowControl.cs
index d3063cad..d2cbe8b3 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutFloatingWindowControl.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutFloatingWindowControl.cs
@@ -36,6 +36,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
public abstract class LayoutFloatingWindowControl : Window, ILayoutControl
{
private ResourceDictionary currentThemeResourceDictionary; // = null
+ private bool _isInternalChange; //false
static LayoutFloatingWindowControl()
{
@@ -387,7 +388,9 @@ namespace Xceed.Wpf.AvalonDock.Controls
posElement.IsMaximized = isMaximized;
}
IsMaximized = isMaximized;
+ _isInternalChange = true;
WindowState = isMaximized ? WindowState.Maximized : WindowState.Normal;
+ _isInternalChange = false;
}
@@ -529,19 +532,21 @@ namespace Xceed.Wpf.AvalonDock.Controls
protected override void OnStateChanged( EventArgs e )
{
- //Windows sometimes send unwanted state changes (when minimizing application for instance)
- //We force internal state to be used
- WindowState = IsMaximized ? WindowState.Maximized : WindowState.Normal;
+ if( !_isInternalChange )
+ {
+ if( WindowState == WindowState.Maximized )
+ {
+ UpdateMaximizedState( true );
+ }
+ else
+ {
+ WindowState = IsMaximized ? WindowState.Maximized : WindowState.Normal;
+ }
+ }
+
base.OnStateChanged( e );
}
#endregion
-
-
-
-
-
-
-
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridControl.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridControl.cs
index 94d4f831..de21dc28 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridControl.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridControl.cs
@@ -380,62 +380,50 @@ namespace Xceed.Wpf.AvalonDock.Controls
var prevChildModel = (ILayoutPositionableElement)(prevChild as ILayoutControl).Model;
var nextChildModel = (ILayoutPositionableElement)(nextChild as ILayoutControl).Model;
- if (Orientation == System.Windows.Controls.Orientation.Horizontal)
- {
- if (prevChildModel.DockWidth.IsStar)
- {
- prevChildModel.DockWidth = new GridLength(prevChildModel.DockWidth.Value * (prevChildActualSize.Width + delta) / prevChildActualSize.Width, GridUnitType.Star);
- }
- else if (prevChildModel.DockWidth.IsAuto)
- {
- prevChildModel.DockWidth = new GridLength(prevChildActualSize.Width + delta, GridUnitType.Pixel);
- }
- else
- {
- prevChildModel.DockWidth = new GridLength(prevChildModel.DockWidth.Value + delta, GridUnitType.Pixel);
- }
+ if( Orientation == System.Windows.Controls.Orientation.Horizontal )
+ {
+ if( prevChildModel.DockWidth.IsStar )
+ {
+ prevChildModel.DockWidth = new GridLength( prevChildModel.DockWidth.Value * ( prevChildActualSize.Width + delta ) / prevChildActualSize.Width, GridUnitType.Star );
+ }
+ else
+ {
+ var width = ( prevChildModel.DockWidth.IsAuto ) ? prevChildActualSize.Width : prevChildModel.DockWidth.Value;
+ prevChildModel.DockWidth = new GridLength( width + delta, GridUnitType.Pixel );
+ }
- if (nextChildModel.DockWidth.IsStar)
- {
- nextChildModel.DockWidth = new GridLength(nextChildModel.DockWidth.Value * (nextChildActualSize.Width - delta) / nextChildActualSize.Width, GridUnitType.Star);
- }
- else if (nextChildModel.DockWidth.IsAuto)
- {
- nextChildModel.DockWidth = new GridLength(nextChildActualSize.Width - delta, GridUnitType.Pixel);
- }
- else
- {
- nextChildModel.DockWidth = new GridLength(nextChildModel.DockWidth.Value - delta, GridUnitType.Pixel);
- }
- }
- else
- {
- if (prevChildModel.DockHeight.IsStar)
- {
- prevChildModel.DockHeight = new GridLength(prevChildModel.DockHeight.Value * (prevChildActualSize.Height + delta) / prevChildActualSize.Height, GridUnitType.Star);
- }
- else if (prevChildModel.DockHeight.IsAuto)
- {
- prevChildModel.DockHeight = new GridLength(prevChildActualSize.Height + delta, GridUnitType.Pixel);
- }
- else
- {
- prevChildModel.DockHeight = new GridLength(prevChildModel.DockHeight.Value + delta, GridUnitType.Pixel);
- }
+ if( nextChildModel.DockWidth.IsStar )
+ {
+ nextChildModel.DockWidth = new GridLength( nextChildModel.DockWidth.Value * ( nextChildActualSize.Width - delta ) / nextChildActualSize.Width, GridUnitType.Star );
+ }
+ else
+ {
+ var width = ( nextChildModel.DockWidth.IsAuto ) ? nextChildActualSize.Width : nextChildModel.DockWidth.Value;
+ nextChildModel.DockWidth = new GridLength( width - delta, GridUnitType.Pixel );
+ }
+ }
+ else
+ {
+ if( prevChildModel.DockHeight.IsStar )
+ {
+ prevChildModel.DockHeight = new GridLength( prevChildModel.DockHeight.Value * ( prevChildActualSize.Height + delta ) / prevChildActualSize.Height, GridUnitType.Star );
+ }
+ else
+ {
+ var height = ( prevChildModel.DockHeight.IsAuto ) ? prevChildActualSize.Height : prevChildModel.DockHeight.Value;
+ prevChildModel.DockHeight = new GridLength( height + delta, GridUnitType.Pixel );
+ }
- if (nextChildModel.DockHeight.IsStar)
- {
- nextChildModel.DockHeight = new GridLength(nextChildModel.DockHeight.Value * (nextChildActualSize.Height - delta) / nextChildActualSize.Height, GridUnitType.Star);
- }
- else if (nextChildModel.DockHeight.IsAuto)
- {
- nextChildModel.DockHeight = new GridLength(nextChildActualSize.Height - delta, GridUnitType.Pixel);
- }
- else
- {
- nextChildModel.DockHeight = new GridLength(nextChildModel.DockHeight.Value - delta, GridUnitType.Pixel);
- }
- }
+ if( nextChildModel.DockHeight.IsStar )
+ {
+ nextChildModel.DockHeight = new GridLength( nextChildModel.DockHeight.Value * ( nextChildActualSize.Height - delta ) / nextChildActualSize.Height, GridUnitType.Star );
+ }
+ else
+ {
+ var height = ( nextChildModel.DockHeight.IsAuto ) ? nextChildActualSize.Height : nextChildModel.DockHeight.Value;
+ nextChildModel.DockHeight = new GridLength( height - delta, GridUnitType.Pixel );
+ }
+ }
HideResizerOverlayWindow();
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs
index 374952b6..683c95af 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs
@@ -203,17 +203,17 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
_view = new ContentPresenter();
- _view.SetBinding(ContentPresenter.ContentProperty, new Binding("Content") { Source = LayoutElement });
- if ((LayoutElement != null) && (LayoutElement.Root != null))
- {
- _view.SetBinding(ContentPresenter.ContentTemplateProperty, new Binding("LayoutItemTemplate") { Source = LayoutElement.Root.Manager });
- _view.SetBinding(ContentPresenter.ContentTemplateSelectorProperty, new Binding("LayoutItemTemplateSelector") { Source = LayoutElement.Root.Manager });
- if (LayoutElement.Root.Manager != null)
- {
- LayoutElement.Root.Manager.InternalAddLogicalChild(_view);
- }
- }
- }
+ _view.SetBinding( ContentPresenter.ContentProperty, new Binding( "Content" ) { Source = LayoutElement } );
+ if( ( LayoutElement != null ) && ( LayoutElement.Root != null ) )
+ {
+ _view.SetBinding( ContentPresenter.ContentTemplateProperty, new Binding( "LayoutItemTemplate" ) { Source = LayoutElement.Root.Manager } );
+ _view.SetBinding( ContentPresenter.ContentTemplateSelectorProperty, new Binding( "LayoutItemTemplateSelector" ) { Source = LayoutElement.Root.Manager } );
+ if( LayoutElement.Root.Manager != null )
+ {
+ LayoutElement.Root.Manager.InternalAddLogicalChild( _view );
+ }
+ }
+ }
return _view;
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindow.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindow.cs
index bc3d88b2..ee618808 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindow.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindow.cs
@@ -209,7 +209,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetTop.GetScreenArea(), DropTargetType.AnchorablePaneDockTop);
yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetRight.GetScreenArea(), DropTargetType.AnchorablePaneDockRight);
yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetBottom.GetScreenArea(), DropTargetType.AnchorablePaneDockBottom);
- yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetInto.GetScreenArea(), DropTargetType.AnchorablePaneDockInside);
+ if( _anchorablePaneDropTargetInto.IsVisible )
+ yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetInto.GetScreenArea(), DropTargetType.AnchorablePaneDockInside);
var parentPaneModel = dropAreaAnchorablePane.AreaElement.Model as LayoutAnchorablePane;
LayoutAnchorableTabItem lastAreaTabItem = null;
@@ -342,6 +343,137 @@ namespace Xceed.Wpf.AvalonDock.Controls
_floatingWindow = null;
}
+ ///
+ /// This method controls the DropTargetInto button of the overlay window.
+ /// It checks that only 1 of the defined ContentLayouts can be present on the LayoutDocumentPane or LayoutAnchorablePane.
+ /// The combination between the ContentLayout Title and the ContentId is the search key, and has to be unique.
+ /// If a floating window is dropped on a LayoutDocumentPane or LayoutAnchorablePane, it checks if one of the containing LayoutContents
+ /// is already present on the LayoutDocumentPane or LayoutAnchorablePane. If so, then it will disable the DropTargetInto button.
+ ///
+ /// The given LayoutDocumentPane or LayoutAnchorablePane
+ private void SetDropTargetIntoVisibility( ILayoutPositionableElement positionableElement )
+ {
+ if( positionableElement is LayoutAnchorablePane )
+ {
+ _anchorablePaneDropTargetInto.Visibility = Visibility.Visible;
+ }
+ else if( positionableElement is LayoutDocumentPane )
+ {
+ _documentPaneDropTargetInto.Visibility = Visibility.Visible;
+ }
+
+ if( positionableElement == null || _floatingWindow.Model == null || positionableElement.AllowDuplicateContent )
+ {
+ return;
+ }
+
+ // Find all content layouts in the anchorable pane (object to drop on)
+ var contentLayoutsOnPositionableElementPane = GetAllLayoutContents( positionableElement );
+
+ // Find all content layouts in the floating window (object to drop)
+ var contentLayoutsOnFloatingWindow = GetAllLayoutContents( _floatingWindow.Model );
+
+ // If any of the content layouts is present in the drop area, then disable the DropTargetInto button.
+ foreach( var content in contentLayoutsOnFloatingWindow )
+ {
+ if( !contentLayoutsOnPositionableElementPane.Any( item =>
+ item.Title == content.Title &&
+ item.ContentId == content.ContentId ) )
+ {
+ continue;
+ }
+
+ if( positionableElement is LayoutAnchorablePane )
+ {
+ _anchorablePaneDropTargetInto.Visibility = Visibility.Hidden;
+ }
+ else if( positionableElement is LayoutDocumentPane )
+ {
+ _documentPaneDropTargetInto.Visibility = Visibility.Hidden;
+ }
+ break;
+ }
+ }
+
+ ///
+ /// Find any LayoutDocument or LayoutAnchorable from a given source (e.g. LayoutDocumentPane, LayoutAnchorableFloatingWindow, etc.)
+ ///
+ /// The given source to search in
+ /// A list of all LayoutContent's
+ private List GetAllLayoutContents( object source )
+ {
+ var result = new List();
+
+ var documentFloatingWindow = source as LayoutDocumentFloatingWindow;
+ if( documentFloatingWindow != null )
+ {
+ foreach( var layoutElement in documentFloatingWindow.Children )
+ {
+ result.AddRange( GetAllLayoutContents( layoutElement ) );
+ }
+ }
+
+ var anchorableFloatingWindow = source as LayoutAnchorableFloatingWindow;
+ if( anchorableFloatingWindow != null )
+ {
+ foreach( var layoutElement in anchorableFloatingWindow.Children )
+ {
+ result.AddRange( GetAllLayoutContents( layoutElement ) );
+ }
+ }
+
+ var documentPaneGroup = source as LayoutDocumentPaneGroup;
+ if( documentPaneGroup != null )
+ {
+ foreach( var layoutDocumentPane in documentPaneGroup.Children )
+ {
+ result.AddRange( GetAllLayoutContents( layoutDocumentPane ) );
+ }
+ }
+
+ var anchorablePaneGroup = source as LayoutAnchorablePaneGroup;
+ if( anchorablePaneGroup != null )
+ {
+ foreach( var layoutDocumentPane in anchorablePaneGroup.Children )
+ {
+ result.AddRange( GetAllLayoutContents( layoutDocumentPane ) );
+ }
+ }
+
+ var documentPane = source as LayoutDocumentPane;
+ if( documentPane != null )
+ {
+ foreach( var layoutContent in documentPane.Children )
+ {
+ result.Add( layoutContent );
+ }
+ }
+
+ var anchorablePane = source as LayoutAnchorablePane;
+ if( anchorablePane != null )
+ {
+ foreach( var layoutContent in anchorablePane.Children )
+ {
+ result.Add( layoutContent );
+ }
+ }
+
+ var document = source as LayoutDocument;
+ if( document != null )
+ {
+ result.Add( document );
+ }
+
+ var anchorable = source as LayoutAnchorable;
+ if( anchorable != null )
+ {
+ result.Add( anchorable );
+ }
+
+ return result;
+ }
+
+
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
base.OnClosing(e);
@@ -361,7 +493,11 @@ namespace Xceed.Wpf.AvalonDock.Controls
break;
case DropAreaType.AnchorablePane:
areaElement = _gridAnchorablePaneDropTargets;
- break;
+
+ var dropAreaAnchorablePaneGroup = area as DropArea;
+ var layoutAnchorablePane = dropAreaAnchorablePaneGroup.AreaElement.Model as LayoutAnchorablePane;
+ SetDropTargetIntoVisibility( layoutAnchorablePane );
+ break;
case DropAreaType.DocumentPaneGroup:
{
areaElement = _gridDocumentPaneDropTargets;
@@ -386,6 +522,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
var layoutDocumentPane = dropAreaDocumentPaneGroup.AreaElement.Model as LayoutDocumentPane;
var parentDocumentPaneGroup = layoutDocumentPane.Parent as LayoutDocumentPaneGroup;
+ SetDropTargetIntoVisibility( layoutDocumentPane );
+
if (parentDocumentPaneGroup != null &&
parentDocumentPaneGroup.Children.Where(c => c.IsVisible).Count() > 1)
{
@@ -475,6 +613,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
var layoutDocumentPane = dropAreaDocumentPaneGroup.AreaElement.Model as LayoutDocumentPane;
var parentDocumentPaneGroup = layoutDocumentPane.Parent as LayoutDocumentPaneGroup;
+ SetDropTargetIntoVisibility( layoutDocumentPane );
+
if (parentDocumentPaneGroup != null &&
parentDocumentPaneGroup.Children.Where(c => c.IsVisible).Count() > 1)
{
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/ILayoutPositionableElement.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/ILayoutPositionableElement.cs
index 95b1e5db..34027fe9 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/ILayoutPositionableElement.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/ILayoutPositionableElement.cs
@@ -39,7 +39,7 @@ namespace Xceed.Wpf.AvalonDock.Layout
double DockMinWidth { get; set; }
double DockMinHeight { get; set; }
-
+ bool AllowDuplicateContent { get; set; }
bool IsVisible { get; }
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutAnchorableFloatingWindow.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutAnchorableFloatingWindow.cs
index 12500be7..0cbd88b3 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutAnchorableFloatingWindow.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutAnchorableFloatingWindow.cs
@@ -21,6 +21,7 @@ using System.Text;
using System.Windows.Markup;
using System.Diagnostics;
using System.Xml.Serialization;
+using System.Xml;
namespace Xceed.Wpf.AvalonDock.Layout
{
@@ -156,11 +157,15 @@ namespace Xceed.Wpf.AvalonDock.Layout
void ILayoutElementWithVisibility.ComputeVisibility()
{
- if (RootPanel != null)
- IsVisible = RootPanel.IsVisible;
- else
- IsVisible = false;
+ ComputeVisibility();
+ }
+ private void ComputeVisibility()
+ {
+ if( RootPanel != null )
+ IsVisible = RootPanel.IsVisible;
+ else
+ IsVisible = false;
}
public override bool IsValid
@@ -168,6 +173,53 @@ namespace Xceed.Wpf.AvalonDock.Layout
get { return RootPanel != null; }
}
+ public override void ReadXml( XmlReader reader )
+ {
+ reader.MoveToContent();
+ if( reader.IsEmptyElement )
+ {
+ reader.Read();
+ ComputeVisibility();
+ return;
+ }
+
+ var localName = reader.LocalName;
+ reader.Read();
+
+ while( true )
+ {
+ if( reader.LocalName.Equals( localName ) && (reader.NodeType == XmlNodeType.EndElement) )
+ {
+ break;
+ }
+
+ if( reader.NodeType == XmlNodeType.Whitespace )
+ {
+ reader.Read();
+ continue;
+ }
+
+ XmlSerializer serializer;
+ if( reader.LocalName.Equals("LayoutAnchorablePaneGroup") )
+ {
+ serializer = new XmlSerializer( typeof( LayoutAnchorablePaneGroup ) );
+ }
+ else
+ {
+ var type = LayoutRoot.FindType( reader.LocalName );
+ if( type == null )
+ {
+ throw new ArgumentException( "AvalonDock.LayoutAnchorableFloatingWindow doesn't know how to deserialize " + reader.LocalName );
+ }
+ serializer = new XmlSerializer( type );
+ }
+
+ RootPanel = ( LayoutAnchorablePaneGroup )serializer.Deserialize( reader );
+ }
+
+ reader.ReadEndElement();
+ }
+
#if TRACE
public override void ConsoleDump(int tab)
{
@@ -176,6 +228,6 @@ namespace Xceed.Wpf.AvalonDock.Layout
RootPanel.ConsoleDump(tab + 1);
}
-#endif
- }
+#endif
+ }
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs
index e0676604..5be6de32 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs
@@ -24,6 +24,7 @@ using System.Windows;
using System.Globalization;
using System.Windows.Media;
using System.ComponentModel;
+using Xceed.Wpf.AvalonDock.Controls;
namespace Xceed.Wpf.AvalonDock.Layout
{
@@ -84,31 +85,25 @@ namespace Xceed.Wpf.AvalonDock.Layout
#region ContentId
- //Added to make ContentId bindable
- public static DependencyProperty ContentIdProperty =
- DependencyProperty.Register(nameof(ContentId),
- typeof(string), typeof(LayoutContent), new FrameworkPropertyMetadata(null, (s, e) =>
- {
- (s as LayoutContent)?.RaisePropertyChanged(nameof(ContentId));
- }));
-
+ private string _contentId = null;
public string ContentId
{
- get
+ get
{
- if (GetValue(ContentIdProperty) == null)
- {
+ if (_contentId == null)
+ {
var contentAsControl = _content as FrameworkElement;
if (contentAsControl != null && !string.IsNullOrWhiteSpace(contentAsControl.Name))
return contentAsControl.Name;
}
- return (string)GetValue(ContentIdProperty);
+ return _contentId;
}
set
{
- if (!String.Equals(GetValue(ContentIdProperty) as string, value))
+ if (_contentId != value)
{
- SetValue(ContentIdProperty, value);
+ _contentId = value;
+ RaisePropertyChanged("ContentId");
}
}
}
@@ -133,7 +128,7 @@ namespace Xceed.Wpf.AvalonDock.Layout
parentSelector.SelectedContentIndex = _isSelected ? parentSelector.IndexOf(this) : -1;
OnIsSelectedChanged(oldValue, value);
RaisePropertyChanged("IsSelected");
- Controls.LayoutAnchorableTabItem.CancelNextMouseLeave();
+ LayoutAnchorableTabItem.CancelMouseLeave();
}
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutDocumentFloatingWindow.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutDocumentFloatingWindow.cs
index db08fadd..6e4018f3 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutDocumentFloatingWindow.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutDocumentFloatingWindow.cs
@@ -20,6 +20,8 @@ using System.Linq;
using System.Text;
using System.Windows.Markup;
using System.Diagnostics;
+using System.Xml.Serialization;
+using System.Xml;
namespace Xceed.Wpf.AvalonDock.Layout
{
@@ -92,6 +94,51 @@ namespace Xceed.Wpf.AvalonDock.Layout
get { return RootDocument != null; }
}
+ public override void ReadXml( XmlReader reader )
+ {
+ reader.MoveToContent();
+ if( reader.IsEmptyElement )
+ {
+ reader.Read();
+ return;
+ }
+
+ var localName = reader.LocalName;
+ reader.Read();
+
+ while( true )
+ {
+ if( reader.LocalName.Equals(localName) && (reader.NodeType == XmlNodeType.EndElement) )
+ {
+ break;
+ }
+
+ if( reader.NodeType == XmlNodeType.Whitespace )
+ {
+ reader.Read();
+ continue;
+ }
+
+ XmlSerializer serializer;
+ if( reader.LocalName.Equals( "LayoutDocument" ) )
+ {
+ serializer = new XmlSerializer( typeof( LayoutDocument ) );
+ }
+ else
+ {
+ var type = LayoutRoot.FindType( reader.LocalName );
+ if( type == null )
+ {
+ throw new ArgumentException( "AvalonDock.LayoutDocumentFloatingWindow doesn't know how to deserialize " + reader.LocalName );
+ }
+ serializer = new XmlSerializer( type );
+ }
+
+ RootDocument = ( LayoutDocument )serializer.Deserialize( reader );
+ }
+
+ reader.ReadEndElement();
+ }
#if TRACE
public override void ConsoleDump(int tab)
@@ -102,6 +149,6 @@ namespace Xceed.Wpf.AvalonDock.Layout
RootDocument.ConsoleDump(tab + 1);
}
#endif
- }
+ }
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutFloatingWindow.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutFloatingWindow.cs
index 6f174897..64fd83fd 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutFloatingWindow.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutFloatingWindow.cs
@@ -21,14 +21,14 @@ using System.Text;
using System.Windows.Markup;
using System.Windows;
using System.Xml.Serialization;
+using System.Xml.Schema;
+using System.Xml;
namespace Xceed.Wpf.AvalonDock.Layout
{
[Serializable]
- [XmlInclude(typeof(LayoutAnchorableFloatingWindow))]
- [XmlInclude(typeof(LayoutDocumentFloatingWindow))]
- public abstract class LayoutFloatingWindow : LayoutElement, ILayoutContainer
- {
+ public abstract class LayoutFloatingWindow : LayoutElement, ILayoutContainer, IXmlSerializable
+ {
public LayoutFloatingWindow()
{
@@ -45,8 +45,22 @@ namespace Xceed.Wpf.AvalonDock.Layout
public abstract bool IsValid { get; }
+ public XmlSchema GetSchema()
+ {
+ return null;
+ }
+ public abstract void ReadXml( XmlReader reader );
+ public virtual void WriteXml( XmlWriter writer )
+ {
+ foreach( var child in Children )
+ {
+ var type = child.GetType();
+ var serializer = new XmlSerializer( type );
+ serializer.Serialize( writer, child );
+ }
+ }
- }
+ }
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutPositionableGroup.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutPositionableGroup.cs
index fa05d8ea..8257d7f3 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutPositionableGroup.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutPositionableGroup.cs
@@ -80,6 +80,34 @@ namespace Xceed.Wpf.AvalonDock.Layout
}
+ #region AllowDuplicateContent
+
+ private bool _allowDuplicateContent = true;
+ ///
+ /// Gets or sets the AllowDuplicateContent property.
+ /// When this property is true, then the LayoutDocumentPane or LayoutAnchorablePane allows dropping
+ /// duplicate content (according to its Title and ContentId). When this dependency property is false,
+ /// then the LayoutDocumentPane or LayoutAnchorablePane hides the OverlayWindow.DropInto button to prevent dropping of duplicate content.
+ ///
+ public bool AllowDuplicateContent
+ {
+ get
+ {
+ return _allowDuplicateContent;
+ }
+ set
+ {
+ if( _allowDuplicateContent != value )
+ {
+ RaisePropertyChanging( "AllowDuplicateContent" );
+ _allowDuplicateContent = value;
+ RaisePropertyChanged( "AllowDuplicateContent" );
+ }
+ }
+ }
+
+ #endregion
+
#region CanRepositionItems
private bool _canRepositionItems = true;
@@ -102,7 +130,6 @@ namespace Xceed.Wpf.AvalonDock.Layout
#endregion
-
#region DockMinWidth
private double _dockMinWidth = 25.0;
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutRoot.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutRoot.cs
index 63ed07f0..d55bf630 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutRoot.cs
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutRoot.cs
@@ -23,12 +23,14 @@ using System.Collections.ObjectModel;
using System.Windows.Markup;
using System.Xml.Serialization;
using Standard;
+using System.Xml;
+using System.Xml.Schema;
namespace Xceed.Wpf.AvalonDock.Layout
{
[ContentProperty("RootPanel")]
[Serializable]
- public class LayoutRoot : LayoutElement, ILayoutContainer, ILayoutRoot
+ public class LayoutRoot : LayoutElement, ILayoutContainer, ILayoutRoot, IXmlSerializable
{
public LayoutRoot()
{
@@ -660,7 +662,289 @@ namespace Xceed.Wpf.AvalonDock.Layout
public event EventHandler ElementRemoved;
- #endregion
+ #endregion
+
+ public XmlSchema GetSchema()
+ {
+ return null;
+ }
+
+ public void ReadXml( XmlReader reader )
+ {
+ reader.MoveToContent();
+ if( reader.IsEmptyElement )
+ {
+ reader.Read();
+ return;
+ }
+
+ var layoutPanelElements = ReadRootPanel( reader );
+ if( layoutPanelElements != null )
+ {
+ //Create the RootPanel with the first child
+ RootPanel = new LayoutPanel( layoutPanelElements.First() );
+ //Add all children to RootPanel
+ for( int i = 1; i < layoutPanelElements.Count; ++i )
+ {
+ RootPanel.Children.Add( layoutPanelElements[ i ] );
+ }
+ }
+
+ TopSide = ( LayoutAnchorSide )ReadElement( reader );
+ if( TopSide != null )
+ {
+ TopSide.Children.Add( ( LayoutAnchorGroup )ReadElement( reader ) );
+ reader.Read();
+ }
+ RightSide = ( LayoutAnchorSide )ReadElement( reader );
+ if( RightSide != null )
+ {
+ RightSide.Children.Add( ( LayoutAnchorGroup )ReadElement( reader ) );
+ reader.Read();
+ }
+ LeftSide = ( LayoutAnchorSide )ReadElement( reader );
+ if( LeftSide != null )
+ {
+ LeftSide.Children.Add( ( LayoutAnchorGroup )ReadElement( reader ) );
+ reader.Read();
+ }
+ BottomSide = ( LayoutAnchorSide )ReadElement( reader );
+ if( BottomSide != null )
+ {
+ BottomSide.Children.Add( ( LayoutAnchorGroup )ReadElement( reader ) );
+ reader.Read();
+ }
+
+ FloatingWindows.Clear();
+ var floatingWindows = ReadElementList( reader );
+ foreach( var floatingWindow in floatingWindows )
+ {
+ FloatingWindows.Add( ( LayoutFloatingWindow )floatingWindow );
+ }
+
+ Hidden.Clear();
+ var hidden = ReadElementList( reader );
+ foreach( var hiddenObject in hidden )
+ {
+ Hidden.Add( ( LayoutAnchorable )hiddenObject );
+ }
+ }
+
+ private List ReadRootPanel( XmlReader reader )
+ {
+ var result = new List();
+
+ var startElementName = reader.LocalName;
+ reader.Read();
+ if( reader.LocalName.Equals(startElementName) && (reader.NodeType == XmlNodeType.EndElement) )
+ {
+ return null;
+ }
+
+ while( reader.NodeType == XmlNodeType.Whitespace )
+ {
+ reader.Read();
+ }
+
+ if( reader.LocalName.Equals("RootPanel"))
+ {
+ reader.Read();
+
+ while( true )
+ {
+ //Read all RootPanel children
+ var element = ReadElement( reader ) as ILayoutPanelElement;
+ if( element != null )
+ {
+ result.Add( element );
+ }
+ else if( reader.NodeType == XmlNodeType.EndElement )
+ {
+ break;
+ }
+ }
+ }
+
+ reader.ReadEndElement();
+
+ return result;
+ }
+
+ private List