Browse Source

V3.4.0 Released

pull/1359/merge
BoucherS 8 years ago
parent
commit
24ecc09cf3
  1. 2
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/AssemblyVersionInfo.cs
  2. 47
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/Theme.xaml
  3. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Brushes.baml
  4. 2
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/GeneratedInternalTypeHelper.g.cs
  5. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Theme.baml
  6. 23
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Aero.csproj.FileListAbsolute.txt
  7. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Aero.g.resources
  8. 5
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.i.lref
  9. 5
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.lref
  10. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Brushes.baml
  11. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Theme.baml
  12. 46
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Xceed.Wpf.AvalonDock.Themes.Aero.csproj.FileListAbsolute.txt
  13. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Xceed.Wpf.AvalonDock.Themes.Aero.g.resources
  14. 5
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.i.lref
  15. 6
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.lref
  16. 2
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/AssemblyVersionInfo.cs
  17. 62
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/Theme.xaml
  18. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Brushes.baml
  19. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Theme.baml
  20. 22
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Metro.csproj.FileListAbsolute.txt
  21. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Metro.g.resources
  22. 4
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.i.lref
  23. 4
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.lref
  24. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Theme.baml
  25. 44
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Xceed.Wpf.AvalonDock.Themes.Metro.csproj.FileListAbsolute.txt
  26. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Xceed.Wpf.AvalonDock.Themes.Metro.g.resources
  27. 4
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.i.lref
  28. 2
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.lref
  29. 2
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/AssemblyVersionInfo.cs
  30. 62
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/Theme.xaml
  31. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Brushes.baml
  32. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Theme.baml
  33. 22
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Xceed.Wpf.AvalonDock.Themes.VS2010.csproj.FileListAbsolute.txt
  34. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Xceed.Wpf.AvalonDock.Themes.VS2010.g.resources
  35. 4
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.i.lref
  36. 4
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.lref
  37. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Theme.baml
  38. 44
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Xceed.Wpf.AvalonDock.Themes.VS2010.csproj.FileListAbsolute.txt
  39. BIN
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Xceed.Wpf.AvalonDock.Themes.VS2010.g.resources
  40. 4
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.i.lref
  41. 2
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.lref
  42. 2
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs
  43. 79
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Commands/RelayCommand.cs
  44. 39
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneControlOverlayArea.cs
  45. 593
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneDropTarget.cs
  46. 143
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneTabPanel.cs
  47. 281
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneTitle.cs
  48. 136
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AutoHideWindowManager.cs
  49. 49
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/BindingHelper.cs
  50. 44
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/ContextMenuEx.cs
  51. 427
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DockingManagerDropTarget.cs
  52. 33
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DockingManagerOverlayArea.cs
  53. 34
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneControlOverlayArea.cs
  54. 460
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneDropAsAnchorableTarget.cs
  55. 922
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneDropTarget.cs
  56. 145
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneGroupDropTarget.cs
  57. 131
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneTabPanel.cs
  58. 297
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DragService.cs
  59. 100
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropArea.cs
  60. 227
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropDownButton.cs
  61. 161
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropDownControlArea.cs
  62. 161
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTarget.cs
  63. 65
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTargetBase.cs
  64. 57
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTargetType.cs
  65. 158
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Extentions.cs
  66. 400
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/FocusElementManager.cs
  67. 158
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/FullWeakDictionary.cs
  68. 31
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IDropTarget.cs
  69. 25
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IOverlayWindow.cs
  70. 11
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IOverlayWindowArea.cs
  71. 16
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IOverlayWindowDropTarget.cs
  72. 28
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IOverlayWindowHost.cs
  73. 130
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorControl.cs
  74. 135
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorGroupControl.cs
  75. 158
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorSideControl.cs
  76. 21
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableControl.cs
  77. 243
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs
  78. 600
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableItem.cs
  79. 34
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs
  80. 82
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneGroupControl.cs
  81. 49
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs
  82. 378
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAutoHideWindowControl.cs
  83. 29
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentControl.cs
  84. 80
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs
  85. 168
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentItem.cs
  86. 58
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentPaneControl.cs
  87. 81
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentPaneGroupControl.cs
  88. 383
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentTabItem.cs
  89. 666
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutFloatingWindowControl.cs
  90. 823
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridControl.cs
  91. 129
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridResizerControl.cs
  92. 477
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs
  93. 198
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutPanelControl.cs
  94. 250
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/MenuItemEx.cs
  95. 448
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/NavigatorWindow.cs
  96. 56
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayArea.cs
  97. 1244
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindow.cs
  98. 61
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindowDropTarget.cs
  99. 45
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindowDropTargetType.cs
  100. 79
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/ReentrantFlag.cs

2
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.3";
public const string BaseVersion = "3.4";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";

47
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/Theme.xaml

@ -1161,8 +1161,9 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2"
<Border Grid.ColumnSpan="3"
Background="Transparent" />
<ContentPresenter Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
@ -1172,8 +1173,7 @@
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Grid.Column="1"
Margin="5,0,0,0"
Grid.Column="2"
Padding="-1"
Visibility="Hidden"
Command="{Binding Path=LayoutItem.CloseCommand, RelativeSource={RelativeSource TemplatedParent}}"
@ -1186,24 +1186,30 @@
</Border>
</avalonDockControls:DropDownControlArea>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected}"
Value="true">
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsSelected}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
</DataTrigger>
</MultiDataTrigger>
<DataTrigger Binding="{Binding Path=IsActive}"
Value="true">
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
</DataTrigger>
<Trigger Property="IsMouseOver"
Value="True">
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource TemplatedParent}}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
</Trigger>
</MultiDataTrigger>
<DataTrigger Binding="{Binding Path=CanClose}"
Value="false">
<Setter Property="Visibility"
@ -1847,7 +1853,8 @@
Stretch="None"
Visibility="{Binding SelectedDocument.LayoutElement.IconSource, Converter={StaticResource BoolToVisibilityConverter} }" >
</Image>
<TextBlock Text="{Binding SelectedDocument.LayoutElement.Title}"
<TextBlock x:Name="selectedElementTitle"
Text="{Binding SelectedDocument.LayoutElement.Title}"
TextTrimming="CharacterEllipsis"
Grid.Column="1"
VerticalAlignment="Center"
@ -1855,7 +1862,8 @@
Margin="4,0,0,0" >
</TextBlock>
</Grid>
<TextBlock Text="{Binding SelectedDocument.LayoutElement.Description}"
<TextBlock x:Name="selectedElementDescription"
Text="{Binding SelectedDocument.LayoutElement.Description}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" >
</TextBlock>
@ -1880,7 +1888,8 @@
FontWeight="Bold"
Margin="0,3,0,4" >
</TextBlock>
<ListBox Grid.Row="1"
<ListBox x:Name="PART_AnchorableListBox"
Grid.Row="1"
ItemsSource="{Binding Anchorables}"
SelectedItem="{Binding SelectedAnchorable, Mode=TwoWay}"
ItemContainerStyle="{StaticResource AvalonDock_ThemeAero_NavigatorWindowListBoxItemStyle}"
@ -1917,7 +1926,8 @@
FontWeight="Bold"
Margin="0,3,0,4" >
</TextBlock>
<ListBox Grid.Row="1"
<ListBox x:Name="PART_DocumentListBox"
Grid.Row="1"
ItemsSource="{Binding Documents}"
SelectedItem="{Binding SelectedDocument, Mode=TwoWay}"
ItemContainerStyle="{StaticResource AvalonDock_ThemeAero_NavigatorWindowListBoxItemStyle}"
@ -1961,6 +1971,17 @@
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="SelectedDocument"
Value="{x:Null}">
<Setter Property="Text"
Value="{Binding SelectedAnchorable.LayoutElement.Title}"
TargetName="selectedElementTitle" />
<Setter Property="Text"
Value="{x:Null}"
TargetName="selectedElementDescription" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Brushes.baml

Binary file not shown.

2
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/GeneratedInternalTypeHelper.g.cs

@ -1,2 +0,0 @@


BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Theme.baml

Binary file not shown.

23
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Aero.csproj.FileListAbsolute.txt

@ -1,23 +0,0 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\Xceed.Wpf.AvalonDock.Themes.Aero.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\Xceed.Wpf.AvalonDock.Themes.Aero.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\Xceed.Wpf.AvalonDock.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\Xceed.Wpf.AvalonDock.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\de\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\es\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\fr\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\hu\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\it\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\pt-BR\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\ro\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\ru\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\sv\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Debug\zh-Hans\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Aero.csprojResolveAssemblyReference.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\GeneratedInternalTypeHelper.g.cs
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.lref
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\Brushes.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\Theme.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Aero.g.resources
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Aero.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Aero.pdb

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Aero.g.resources

Binary file not shown.

5
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.i.lref

@ -1,5 +0,0 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\GeneratedInternalTypeHelper.g.i.cs
FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Brushes.xaml;;
FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Theme.xaml;;

5
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.lref

@ -1,5 +0,0 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Debug\GeneratedInternalTypeHelper.g.cs
FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Brushes.xaml;;
FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Theme.xaml;;

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Brushes.baml

Binary file not shown.

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Theme.baml

Binary file not shown.

46
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Xceed.Wpf.AvalonDock.Themes.Aero.csproj.FileListAbsolute.txt

@ -1,23 +1,23 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\Xceed.Wpf.AvalonDock.Themes.Aero.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\Xceed.Wpf.AvalonDock.Themes.Aero.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\Xceed.Wpf.AvalonDock.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\Xceed.Wpf.AvalonDock.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\de\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\es\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\fr\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\hu\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\it\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\pt-BR\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\ro\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\ru\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\sv\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\zh-Hans\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero.csprojResolveAssemblyReference.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\GeneratedInternalTypeHelper.g.cs
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.lref
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Brushes.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Theme.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero.g.resources
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\Xceed.Wpf.AvalonDock.Themes.Aero.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\Xceed.Wpf.AvalonDock.Themes.Aero.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\Xceed.Wpf.AvalonDock.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\Xceed.Wpf.AvalonDock.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\de\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\es\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\fr\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\hu\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\it\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\pt-BR\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\ro\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\ru\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\sv\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\bin\Release\zh-Hans\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero.csprojResolveAssemblyReference.cache
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\GeneratedInternalTypeHelper.g.cs
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.cache
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.lref
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Brushes.baml
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Theme.baml
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero.g.resources
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\Xceed.Wpf.AvalonDock.Themes.Aero.pdb

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Xceed.Wpf.AvalonDock.Themes.Aero.g.resources

Binary file not shown.

5
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.i.lref

@ -1,5 +0,0 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\GeneratedInternalTypeHelper.g.i.cs
FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Brushes.xaml;;
FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Theme.xaml;;

6
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/obj/Release/Xceed.Wpf.AvalonDock.Themes.Aero_MarkupCompile.lref

@ -1,5 +1,5 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\GeneratedInternalTypeHelper.g.cs
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\obj\Release\GeneratedInternalTypeHelper.g.cs
FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Brushes.xaml;;
FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Theme.xaml;;
FD:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Brushes.xaml;;
FD:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Aero\Theme.xaml;;

2
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.3";
public const string BaseVersion = "3.4";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";

62
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/Theme.xaml

@ -1185,8 +1185,9 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2"
<Border Grid.ColumnSpan="3"
Background="Transparent" />
<ContentPresenter Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
@ -1196,8 +1197,7 @@
Style="{StaticResource AvalonDock_ThemeMetro_ButtonStyle}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Grid.Column="1"
Margin="5,0,0,0"
Grid.Column="2"
Visibility="Hidden"
Command="{Binding Path=LayoutItem.CloseCommand, RelativeSource={RelativeSource TemplatedParent}}"
ToolTip="{x:Static avalonDockProperties:Resources.Document_Close}">
@ -1209,12 +1209,24 @@
</Border>
</avalonDockControls:DropDownControlArea>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected}"
Value="true">
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsSelected}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
</DataTrigger>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource TemplatedParent}}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
</MultiDataTrigger>
<DataTrigger Binding="{Binding Path=IsLastFocusedDocument}"
Value="true">
<Setter Property="Visibility"
@ -1224,21 +1236,18 @@
Value="Images/PinClose_Dark.png"
TargetName="PART_ImgPinClose" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsActive}"
Value="true">
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsActive}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
<Setter Property="Source"
Value="Images/PinClose_Dark.png"
TargetName="PART_ImgPinClose" />
</DataTrigger>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
</Trigger>
</MultiDataTrigger>
<DataTrigger Binding="{Binding Path=CanClose}"
Value="false">
<Setter Property="Visibility"
@ -1912,7 +1921,8 @@
Stretch="None"
Visibility="{Binding SelectedDocument.LayoutElement.IconSource, Converter={StaticResource BoolToVisibilityConverter} }" >
</Image>
<TextBlock Text="{Binding SelectedDocument.LayoutElement.Title}"
<TextBlock x:Name="selectedElementTitle"
Text="{Binding SelectedDocument.LayoutElement.Title}"
TextTrimming="CharacterEllipsis"
Grid.Column="1"
VerticalAlignment="Center"
@ -1920,7 +1930,8 @@
Margin="4,0,0,0" >
</TextBlock>
</Grid>
<TextBlock Text="{Binding SelectedDocument.LayoutElement.Description}"
<TextBlock x:Name="selectedElementDescription"
Text="{Binding SelectedDocument.LayoutElement.Description}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" >
</TextBlock>
@ -1944,7 +1955,8 @@
FontWeight="Bold"
Margin="0,3,0,4" >
</TextBlock>
<ListBox Grid.Row="1"
<ListBox x:Name="PART_AnchorableListBox"
Grid.Row="1"
ItemsSource="{Binding Anchorables}"
SelectedItem="{Binding SelectedAnchorable, Mode=TwoWay}"
ItemContainerStyle="{StaticResource AvalonDock_ThemeMetro_NavigatorWindowListBoxItemStyle}"
@ -1981,7 +1993,8 @@
FontWeight="Bold"
Margin="0,3,0,4" >
</TextBlock>
<ListBox Grid.Row="1"
<ListBox x:Name="PART_DocumentListBox"
Grid.Row="1"
ItemsSource="{Binding Documents}"
SelectedItem="{Binding SelectedDocument, Mode=TwoWay}"
ItemContainerStyle="{StaticResource AvalonDock_ThemeMetro_NavigatorWindowListBoxItemStyle}"
@ -2025,6 +2038,17 @@
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="SelectedDocument"
Value="{x:Null}">
<Setter Property="Text"
Value="{Binding SelectedAnchorable.LayoutElement.Title}"
TargetName="selectedElementTitle" />
<Setter Property="Text"
Value="{x:Null}"
TargetName="selectedElementDescription" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Brushes.baml

Binary file not shown.

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Theme.baml

Binary file not shown.

22
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Metro.csproj.FileListAbsolute.txt

@ -1,22 +0,0 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\Xceed.Wpf.AvalonDock.Themes.Metro.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\Xceed.Wpf.AvalonDock.Themes.Metro.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\Xceed.Wpf.AvalonDock.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\Xceed.Wpf.AvalonDock.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\de\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\es\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\fr\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\hu\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\it\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\pt-BR\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\ro\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\ru\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\sv\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Debug\zh-Hans\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Metro.csprojResolveAssemblyReference.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Debug\Brushes.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.lref
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Debug\Theme.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Metro.g.resources
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Metro.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Debug\Xceed.Wpf.AvalonDock.Themes.Metro.pdb

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Metro.g.resources

Binary file not shown.

4
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.i.lref

@ -1,4 +0,0 @@

FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\Theme.xaml;;

4
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Debug/Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.lref

@ -1,4 +0,0 @@

FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\Theme.xaml;;

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Theme.baml

Binary file not shown.

44
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Xceed.Wpf.AvalonDock.Themes.Metro.csproj.FileListAbsolute.txt

@ -1,22 +1,22 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\Xceed.Wpf.AvalonDock.Themes.Metro.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\Xceed.Wpf.AvalonDock.Themes.Metro.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\Xceed.Wpf.AvalonDock.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\Xceed.Wpf.AvalonDock.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\de\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\es\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\fr\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\hu\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\it\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\pt-BR\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\ro\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\ru\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\sv\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\zh-Hans\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro.csprojResolveAssemblyReference.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Brushes.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.lref
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Theme.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro.g.resources
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\Xceed.Wpf.AvalonDock.Themes.Metro.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\Xceed.Wpf.AvalonDock.Themes.Metro.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\Xceed.Wpf.AvalonDock.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\Xceed.Wpf.AvalonDock.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\de\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\es\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\fr\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\hu\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\it\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\pt-BR\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\ro\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\ru\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\sv\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\bin\Release\zh-Hans\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro.csprojResolveAssemblyReference.cache
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Brushes.baml
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.cache
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.lref
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Theme.baml
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro.g.resources
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\obj\Release\Xceed.Wpf.AvalonDock.Themes.Metro.pdb

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Xceed.Wpf.AvalonDock.Themes.Metro.g.resources

Binary file not shown.

4
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.i.lref

@ -1,4 +0,0 @@

FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\Theme.xaml;;

2
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/obj/Release/Xceed.Wpf.AvalonDock.Themes.Metro_MarkupCompile.lref

@ -1,4 +1,4 @@

FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\Theme.xaml;;
FD:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.Metro\Theme.xaml;;

2
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.3";
public const string BaseVersion = "3.4";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";

62
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/Theme.xaml

@ -1279,8 +1279,9 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2"
<Border Grid.ColumnSpan="3"
Background="Transparent" />
<ContentPresenter Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
@ -1290,8 +1291,7 @@
Style="{StaticResource AvalonDock_ThemeVS2010_ButtonStyle}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Grid.Column="1"
Margin="5,0,0,0"
Grid.Column="2"
Visibility="Hidden"
Command="{Binding Path=LayoutItem.CloseCommand, RelativeSource={RelativeSource TemplatedParent}}"
ToolTip="{x:Static avalonDockProperties:Resources.Document_Close}">
@ -1303,12 +1303,24 @@
</Border>
</avalonDockControls:DropDownControlArea>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected}"
Value="true">
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsSelected}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
</DataTrigger>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource TemplatedParent}}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
</MultiDataTrigger>
<DataTrigger Binding="{Binding Path=IsLastFocusedDocument}"
Value="true">
<Setter Property="Visibility"
@ -1318,21 +1330,18 @@
Value="Images/PinClose_Dark.png"
TargetName="PART_ImgPinClose" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsActive}"
Value="true">
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsActive}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
<Setter Property="Source"
Value="Images/PinClose_Dark.png"
TargetName="PART_ImgPinClose" />
</DataTrigger>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Visibility"
Value="Visible"
TargetName="DocumentCloseButton" />
</Trigger>
</MultiDataTrigger>
<DataTrigger Binding="{Binding Path=CanClose}"
Value="false">
<Setter Property="Visibility"
@ -2051,7 +2060,8 @@
Stretch="None"
Visibility="{Binding SelectedDocument.LayoutElement.IconSource, Converter={StaticResource BoolToVisibilityConverter} }" >
</Image>
<TextBlock Text="{Binding SelectedDocument.LayoutElement.Title}"
<TextBlock x:Name="selectedElementTitle"
Text="{Binding SelectedDocument.LayoutElement.Title}"
TextTrimming="CharacterEllipsis"
Grid.Column="1"
VerticalAlignment="Center"
@ -2059,7 +2069,8 @@
Margin="4,0,0,0" >
</TextBlock>
</Grid>
<TextBlock Text="{Binding SelectedDocument.LayoutElement.Description}"
<TextBlock x:Name="selectedElementDescription"
Text="{Binding SelectedDocument.LayoutElement.Description}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" >
</TextBlock>
@ -2084,7 +2095,8 @@
FontWeight="Bold"
Margin="0,3,0,4" >
</TextBlock>
<ListBox Grid.Row="1"
<ListBox x:Name="PART_AnchorableListBox"
Grid.Row="1"
ItemsSource="{Binding Anchorables}"
SelectedItem="{Binding SelectedAnchorable, Mode=TwoWay}"
ItemContainerStyle="{StaticResource AvalonDock_ThemeVS2010_NavigatorWindowListBoxItemStyle}"
@ -2121,7 +2133,8 @@
FontWeight="Bold"
Margin="0,3,0,4">
</TextBlock>
<ListBox Grid.Row="1"
<ListBox x:Name="PART_DocumentListBox"
Grid.Row="1"
ItemsSource="{Binding Documents}"
SelectedItem="{Binding SelectedDocument, Mode=TwoWay}"
ItemContainerStyle="{StaticResource AvalonDock_ThemeVS2010_NavigatorWindowListBoxItemStyle}"
@ -2165,6 +2178,17 @@
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="SelectedDocument"
Value="{x:Null}">
<Setter Property="Text"
Value="{Binding SelectedAnchorable.LayoutElement.Title}"
TargetName="selectedElementTitle" />
<Setter Property="Text"
Value="{x:Null}"
TargetName="selectedElementDescription" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Brushes.baml

Binary file not shown.

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Theme.baml

Binary file not shown.

22
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Xceed.Wpf.AvalonDock.Themes.VS2010.csproj.FileListAbsolute.txt

@ -1,22 +0,0 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\Xceed.Wpf.AvalonDock.Themes.VS2010.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\Xceed.Wpf.AvalonDock.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\Xceed.Wpf.AvalonDock.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\de\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\es\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\fr\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\hu\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\it\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\pt-BR\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\ro\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\ru\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\sv\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Debug\zh-Hans\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Debug\Xceed.Wpf.AvalonDock.Themes.VS2010.csprojResolveAssemblyReference.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Debug\Brushes.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Debug\Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Debug\Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.lref
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Debug\Theme.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Debug\Xceed.Wpf.AvalonDock.Themes.VS2010.g.resources
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Debug\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Debug\Xceed.Wpf.AvalonDock.Themes.VS2010.pdb

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Xceed.Wpf.AvalonDock.Themes.VS2010.g.resources

Binary file not shown.

4
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.i.lref

@ -1,4 +0,0 @@

FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\Theme.xaml;;

4
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Debug/Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.lref

@ -1,4 +0,0 @@

FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\Theme.xaml;;

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Theme.baml

Binary file not shown.

44
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Xceed.Wpf.AvalonDock.Themes.VS2010.csproj.FileListAbsolute.txt

@ -1,22 +1,22 @@
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\Xceed.Wpf.AvalonDock.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\Xceed.Wpf.AvalonDock.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\de\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\es\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\fr\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\hu\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\it\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\pt-BR\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\ro\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\ru\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\sv\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\zh-Hans\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.csprojResolveAssemblyReference.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Brushes.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.cache
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.lref
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Theme.baml
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.g.resources
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
D:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\Xceed.Wpf.AvalonDock.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\Xceed.Wpf.AvalonDock.pdb
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\de\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\es\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\fr\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\hu\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\it\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\pt-BR\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\ro\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\ru\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\sv\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\bin\Release\zh-Hans\Xceed.Wpf.AvalonDock.resources.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.csprojResolveAssemblyReference.cache
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Brushes.baml
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.cache
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.lref
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Theme.baml
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.g.resources
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
D:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\obj\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.pdb

BIN
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Xceed.Wpf.AvalonDock.Themes.VS2010.g.resources

Binary file not shown.

4
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.i.lref

@ -1,4 +0,0 @@

FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\Theme.xaml;;

2
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/obj/Release/Xceed.Wpf.AvalonDock.Themes.VS2010_MarkupCompile.lref

@ -1,4 +1,4 @@

FD:\Dev\ExtendedWPFToolkit\Release\3.3.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\Theme.xaml;;
FD:\Dev\ExtendedWPFToolkit\Release\3.4.0\OpenSource\Generated\Src\Xceed.Wpf.AvalonDock.Themes.VS2010\Theme.xaml;;

2
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.3";
public const string BaseVersion = "3.4";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";

79
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Commands/RelayCommand.cs

@ -15,57 +15,60 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
namespace Xceed.Wpf.AvalonDock.Commands
{
internal class RelayCommand : ICommand
{
#region Fields
readonly Action<object> _execute;
readonly Predicate<object> _canExecute;
internal class RelayCommand : ICommand
{
#region Fields
#endregion // Fields
private readonly Action<object> _execute;
private readonly Predicate<object> _canExecute;
#region Constructors
#endregion // Fields
public RelayCommand(Action<object> execute)
: this(execute, null)
{
}
#region Constructors
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
{
if (execute == null)
throw new ArgumentNullException("execute");
public RelayCommand( Action<object> execute )
: this( execute, null )
{
}
_execute = execute;
_canExecute = canExecute;
}
#endregion // Constructors
public RelayCommand( Action<object> execute, Predicate<object> canExecute )
{
if( execute == null )
throw new ArgumentNullException( "execute" );
#region ICommand Members
_execute = execute;
_canExecute = canExecute;
}
#endregion // Constructors
public bool CanExecute(object parameter)
{
return _canExecute == null ? true : _canExecute(parameter);
}
#region ICommand Members
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
public bool CanExecute( object parameter )
{
return _canExecute == null ? true : _canExecute( parameter );
}
public void Execute(object parameter)
{
_execute(parameter);
}
public event EventHandler CanExecuteChanged
{
add
{
CommandManager.RequerySuggested += value;
}
remove
{
CommandManager.RequerySuggested -= value;
}
}
#endregion // ICommand Members
public void Execute( object parameter )
{
_execute( parameter );
}
#endregion // ICommand Members
}
}

39
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneControlOverlayArea.cs

@ -14,30 +14,33 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class AnchorablePaneControlOverlayArea : OverlayArea
{
internal AnchorablePaneControlOverlayArea(
IOverlayWindow overlayWindow,
LayoutAnchorablePaneControl anchorablePaneControl)
: base(overlayWindow)
{
public class AnchorablePaneControlOverlayArea : OverlayArea
{
#region Members
private LayoutAnchorablePaneControl _anchorablePaneControl;
#endregion
_anchorablePaneControl = anchorablePaneControl;
base.SetScreenDetectionArea(new Rect(
_anchorablePaneControl.PointToScreenDPI(new Point()),
_anchorablePaneControl.TransformActualSizeToAncestor()));
#region constructors
}
internal AnchorablePaneControlOverlayArea(
IOverlayWindow overlayWindow,
LayoutAnchorablePaneControl anchorablePaneControl )
: base( overlayWindow )
{
_anchorablePaneControl = anchorablePaneControl;
base.SetScreenDetectionArea( new Rect(
_anchorablePaneControl.PointToScreenDPI( new Point() ),
_anchorablePaneControl.TransformActualSizeToAncestor() ) );
LayoutAnchorablePaneControl _anchorablePaneControl;
}
#endregion
}
}

593
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneDropTarget.cs

@ -14,323 +14,330 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal class AnchorablePaneDropTarget : DropTarget<LayoutAnchorablePaneControl>
internal class AnchorablePaneDropTarget : DropTarget<LayoutAnchorablePaneControl>
{
#region Members
private LayoutAnchorablePaneControl _targetPane;
int _tabIndex = -1;
#endregion
#region Constructors
internal AnchorablePaneDropTarget( LayoutAnchorablePaneControl paneControl, Rect detectionRect, DropTargetType type )
: base( paneControl, detectionRect, type )
{
internal AnchorablePaneDropTarget(LayoutAnchorablePaneControl paneControl, Rect detectionRect, DropTargetType type)
: base(paneControl, detectionRect, type)
{
_targetPane = paneControl;
}
_targetPane = paneControl;
}
internal AnchorablePaneDropTarget(LayoutAnchorablePaneControl paneControl, Rect detectionRect, DropTargetType type, int tabIndex)
: base(paneControl, detectionRect, type)
{
_targetPane = paneControl;
_tabIndex = tabIndex;
}
internal AnchorablePaneDropTarget( LayoutAnchorablePaneControl paneControl, Rect detectionRect, DropTargetType type, int tabIndex )
: base( paneControl, detectionRect, type )
{
_targetPane = paneControl;
_tabIndex = tabIndex;
}
#endregion
LayoutAnchorablePaneControl _targetPane;
#region Overrides
int _tabIndex = -1;
protected override void Drop( LayoutAnchorableFloatingWindow floatingWindow )
{
ILayoutAnchorablePane targetModel = _targetPane.Model as ILayoutAnchorablePane;
LayoutAnchorable anchorableActive = floatingWindow.Descendents().OfType<LayoutAnchorable>().FirstOrDefault();
switch( Type )
{
case DropTargetType.AnchorablePaneDockBottom:
#region DropTargetType.AnchorablePaneDockBottom
{
var parentModel = targetModel.Parent as ILayoutGroup;
var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup;
int insertToIndex = parentModel.IndexOfChild( targetModel );
if( parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Vertical &&
parentModel.ChildrenCount == 1 )
parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Vertical;
if( parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Vertical )
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if( layoutAnchorablePaneGroup != null &&
( layoutAnchorablePaneGroup.Children.Count == 1 ||
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical ) )
{
var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray();
for( int i = 0; i < anchorablesToMove.Length; i++ )
parentModel.InsertChildAt( insertToIndex + 1 + i, anchorablesToMove[ i ] );
}
else
parentModel.InsertChildAt( insertToIndex + 1, floatingWindow.RootPanel );
}
else
{
var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement;
var newOrientedPanel = new LayoutAnchorablePaneGroup()
{
Orientation = System.Windows.Controls.Orientation.Vertical,
DockWidth = targetModelAsPositionableElement.DockWidth,
DockHeight = targetModelAsPositionableElement.DockHeight,
};
parentModel.InsertChildAt( insertToIndex, newOrientedPanel );
newOrientedPanel.Children.Add( targetModel );
newOrientedPanel.Children.Add( floatingWindow.RootPanel );
}
}
break;
#endregion
case DropTargetType.AnchorablePaneDockTop:
#region DropTargetType.AnchorablePaneDockTop
{
var parentModel = targetModel.Parent as ILayoutGroup;
var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup;
int insertToIndex = parentModel.IndexOfChild( targetModel );
if( parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Vertical &&
parentModel.ChildrenCount == 1 )
parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Vertical;
if( parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Vertical )
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if( layoutAnchorablePaneGroup != null &&
( layoutAnchorablePaneGroup.Children.Count == 1 ||
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical ) )
{
var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray();
for( int i = 0; i < anchorablesToMove.Length; i++ )
parentModel.InsertChildAt( insertToIndex + i, anchorablesToMove[ i ] );
}
else
parentModel.InsertChildAt( insertToIndex, floatingWindow.RootPanel );
}
else
{
var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement;
var newOrientedPanel = new LayoutAnchorablePaneGroup()
{
Orientation = System.Windows.Controls.Orientation.Vertical,
DockWidth = targetModelAsPositionableElement.DockWidth,
DockHeight = targetModelAsPositionableElement.DockHeight,
};
parentModel.InsertChildAt( insertToIndex, newOrientedPanel );
//the floating window must be added after the target modal as it could be raise a CollectGarbage call
newOrientedPanel.Children.Add( targetModel );
newOrientedPanel.Children.Insert( 0, floatingWindow.RootPanel );
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{
ILayoutAnchorablePane targetModel = _targetPane.Model as ILayoutAnchorablePane;
LayoutAnchorable anchorableActive = floatingWindow.Descendents().OfType<LayoutAnchorable>().FirstOrDefault();
}
}
break;
#endregion
case DropTargetType.AnchorablePaneDockLeft:
#region DropTargetType.AnchorablePaneDockLeft
{
var parentModel = targetModel.Parent as ILayoutGroup;
var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup;
int insertToIndex = parentModel.IndexOfChild( targetModel );
if( parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Horizontal &&
parentModel.ChildrenCount == 1 )
parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Horizontal;
if( parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if( layoutAnchorablePaneGroup != null &&
( layoutAnchorablePaneGroup.Children.Count == 1 ||
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal ) )
{
var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray();
for( int i = 0; i < anchorablesToMove.Length; i++ )
parentModel.InsertChildAt( insertToIndex + i, anchorablesToMove[ i ] );
}
else
parentModel.InsertChildAt( insertToIndex, floatingWindow.RootPanel );
}
else
{
var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement;
var newOrientedPanel = new LayoutAnchorablePaneGroup()
{
Orientation = System.Windows.Controls.Orientation.Horizontal,
DockWidth = targetModelAsPositionableElement.DockWidth,
DockHeight = targetModelAsPositionableElement.DockHeight,
};
parentModel.InsertChildAt( insertToIndex, newOrientedPanel );
//the floating window must be added after the target modal as it could be raise a CollectGarbage call
newOrientedPanel.Children.Add( targetModel );
newOrientedPanel.Children.Insert( 0, floatingWindow.RootPanel );
switch (Type)
}
}
break;
#endregion
case DropTargetType.AnchorablePaneDockRight:
#region DropTargetType.AnchorablePaneDockRight
{
var parentModel = targetModel.Parent as ILayoutGroup;
var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup;
int insertToIndex = parentModel.IndexOfChild( targetModel );
if( parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Horizontal &&
parentModel.ChildrenCount == 1 )
parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Horizontal;
if( parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
case DropTargetType.AnchorablePaneDockBottom:
#region DropTargetType.AnchorablePaneDockBottom
{
var parentModel = targetModel.Parent as ILayoutGroup;
var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup;
int insertToIndex = parentModel.IndexOfChild(targetModel);
if (parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Vertical &&
parentModel.ChildrenCount == 1)
parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Vertical;
if (parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Vertical)
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if (layoutAnchorablePaneGroup != null &&
(layoutAnchorablePaneGroup.Children.Count == 1 ||
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical))
{
var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray();
for (int i = 0; i < anchorablesToMove.Length; i++)
parentModel.InsertChildAt(insertToIndex + 1 + i, anchorablesToMove[i]);
}
else
parentModel.InsertChildAt(insertToIndex + 1, floatingWindow.RootPanel);
}
else
{
var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement;
var newOrientedPanel = new LayoutAnchorablePaneGroup()
{
Orientation = System.Windows.Controls.Orientation.Vertical,
DockWidth = targetModelAsPositionableElement.DockWidth,
DockHeight = targetModelAsPositionableElement.DockHeight,
};
parentModel.InsertChildAt(insertToIndex, newOrientedPanel);
newOrientedPanel.Children.Add(targetModel);
newOrientedPanel.Children.Add(floatingWindow.RootPanel);
}
}
break;
#endregion
case DropTargetType.AnchorablePaneDockTop:
#region DropTargetType.AnchorablePaneDockTop
{
var parentModel = targetModel.Parent as ILayoutGroup;
var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup;
int insertToIndex = parentModel.IndexOfChild(targetModel);
if (parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Vertical &&
parentModel.ChildrenCount == 1)
parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Vertical;
if (parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Vertical)
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if (layoutAnchorablePaneGroup != null &&
(layoutAnchorablePaneGroup.Children.Count == 1 ||
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical))
{
var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray();
for (int i = 0; i < anchorablesToMove.Length; i++)
parentModel.InsertChildAt(insertToIndex + i, anchorablesToMove[i]);
}
else
parentModel.InsertChildAt(insertToIndex, floatingWindow.RootPanel);
}
else
{
var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement;
var newOrientedPanel = new LayoutAnchorablePaneGroup()
{
Orientation = System.Windows.Controls.Orientation.Vertical,
DockWidth = targetModelAsPositionableElement.DockWidth,
DockHeight = targetModelAsPositionableElement.DockHeight,
};
parentModel.InsertChildAt(insertToIndex, newOrientedPanel);
//the floating window must be added after the target modal as it could be raise a CollectGarbage call
newOrientedPanel.Children.Add(targetModel);
newOrientedPanel.Children.Insert(0, floatingWindow.RootPanel);
}
}
break;
#endregion
case DropTargetType.AnchorablePaneDockLeft:
#region DropTargetType.AnchorablePaneDockLeft
{
var parentModel = targetModel.Parent as ILayoutGroup;
var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup;
int insertToIndex = parentModel.IndexOfChild(targetModel);
if (parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Horizontal &&
parentModel.ChildrenCount == 1)
parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Horizontal;
if (parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if (layoutAnchorablePaneGroup != null &&
(layoutAnchorablePaneGroup.Children.Count == 1 ||
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal))
{
var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray();
for (int i = 0; i < anchorablesToMove.Length; i++)
parentModel.InsertChildAt(insertToIndex + i, anchorablesToMove[i]);
}
else
parentModel.InsertChildAt(insertToIndex, floatingWindow.RootPanel);
}
else
{
var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement;
var newOrientedPanel = new LayoutAnchorablePaneGroup()
{
Orientation = System.Windows.Controls.Orientation.Horizontal,
DockWidth = targetModelAsPositionableElement.DockWidth,
DockHeight = targetModelAsPositionableElement.DockHeight,
};
parentModel.InsertChildAt(insertToIndex, newOrientedPanel);
//the floating window must be added after the target modal as it could be raise a CollectGarbage call
newOrientedPanel.Children.Add(targetModel);
newOrientedPanel.Children.Insert(0, floatingWindow.RootPanel);
}
}
break;
#endregion
case DropTargetType.AnchorablePaneDockRight:
#region DropTargetType.AnchorablePaneDockRight
{
var parentModel = targetModel.Parent as ILayoutGroup;
var parentModelOrientable = targetModel.Parent as ILayoutOrientableGroup;
int insertToIndex = parentModel.IndexOfChild(targetModel);
if (parentModelOrientable.Orientation != System.Windows.Controls.Orientation.Horizontal &&
parentModel.ChildrenCount == 1)
parentModelOrientable.Orientation = System.Windows.Controls.Orientation.Horizontal;
if (parentModelOrientable.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if (layoutAnchorablePaneGroup != null &&
(layoutAnchorablePaneGroup.Children.Count == 1 ||
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal))
{
var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray();
for (int i = 0; i < anchorablesToMove.Length; i++)
parentModel.InsertChildAt(insertToIndex + 1 + i, anchorablesToMove[i]);
}
else
parentModel.InsertChildAt(insertToIndex + 1, floatingWindow.RootPanel);
}
else
{
var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement;
var newOrientedPanel = new LayoutAnchorablePaneGroup()
{
Orientation = System.Windows.Controls.Orientation.Horizontal,
DockWidth = targetModelAsPositionableElement.DockWidth,
DockHeight = targetModelAsPositionableElement.DockHeight,
};
parentModel.InsertChildAt(insertToIndex, newOrientedPanel);
newOrientedPanel.Children.Add(targetModel);
newOrientedPanel.Children.Add(floatingWindow.RootPanel);
}
}
break;
#endregion
case DropTargetType.AnchorablePaneDockInside:
#region DropTargetType.AnchorablePaneDockInside
{
var paneModel = targetModel as LayoutAnchorablePane;
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
int i = _tabIndex == -1 ? 0 : _tabIndex;
foreach (var anchorableToImport in
layoutAnchorablePaneGroup.Descendents().OfType<LayoutAnchorable>().ToArray())
{
paneModel.Children.Insert(i, anchorableToImport);
i++;
}
}
break;
#endregion
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if( layoutAnchorablePaneGroup != null &&
( layoutAnchorablePaneGroup.Children.Count == 1 ||
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal ) )
{
var anchorablesToMove = layoutAnchorablePaneGroup.Children.ToArray();
for( int i = 0; i < anchorablesToMove.Length; i++ )
parentModel.InsertChildAt( insertToIndex + 1 + i, anchorablesToMove[ i ] );
}
else
parentModel.InsertChildAt( insertToIndex + 1, floatingWindow.RootPanel );
}
else
{
var targetModelAsPositionableElement = targetModel as ILayoutPositionableElement;
var newOrientedPanel = new LayoutAnchorablePaneGroup()
{
Orientation = System.Windows.Controls.Orientation.Horizontal,
DockWidth = targetModelAsPositionableElement.DockWidth,
DockHeight = targetModelAsPositionableElement.DockHeight,
};
parentModel.InsertChildAt( insertToIndex, newOrientedPanel );
newOrientedPanel.Children.Add( targetModel );
newOrientedPanel.Children.Add( floatingWindow.RootPanel );
}
}
break;
#endregion
case DropTargetType.AnchorablePaneDockInside:
#region DropTargetType.AnchorablePaneDockInside
{
var paneModel = targetModel as LayoutAnchorablePane;
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
int i = _tabIndex == -1 ? 0 : _tabIndex;
foreach( var anchorableToImport in
layoutAnchorablePaneGroup.Descendents().OfType<LayoutAnchorable>().ToArray() )
{
paneModel.Children.Insert( i, anchorableToImport );
i++;
}
anchorableActive.IsActive = true;
}
break;
#endregion
base.Drop(floatingWindow);
}
}
public override System.Windows.Media.Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel)
{
//var anchorablePaneDropTarget = target as AnchorablePaneDropTarget;
var anchorableFloatingWindowModel = floatingWindowModel as LayoutAnchorableFloatingWindow;
var layoutAnchorablePane = anchorableFloatingWindowModel.RootPanel as ILayoutPositionableElement;
var layoutAnchorablePaneWithActualSize = anchorableFloatingWindowModel.RootPanel as ILayoutPositionableElementWithActualSize;
anchorableActive.IsActive = true;
base.Drop( floatingWindow );
}
switch (Type)
public override System.Windows.Media.Geometry GetPreviewPath( OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel )
{
//var anchorablePaneDropTarget = target as AnchorablePaneDropTarget;
var anchorableFloatingWindowModel = floatingWindowModel as LayoutAnchorableFloatingWindow;
var layoutAnchorablePane = anchorableFloatingWindowModel.RootPanel as ILayoutPositionableElement;
var layoutAnchorablePaneWithActualSize = anchorableFloatingWindowModel.RootPanel as ILayoutPositionableElementWithActualSize;
switch( Type )
{
case DropTargetType.AnchorablePaneDockBottom:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Offset( 0.0, targetScreenRect.Height / 2.0 );
targetScreenRect.Height /= 2.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.AnchorablePaneDockTop:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Height /= 2.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.AnchorablePaneDockLeft:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Width /= 2.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.AnchorablePaneDockRight:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Offset( targetScreenRect.Width / 2.0, 0.0 );
targetScreenRect.Width /= 2.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.AnchorablePaneDockInside:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
if( _tabIndex == -1 )
{
return new RectangleGeometry( targetScreenRect );
}
else
{
case DropTargetType.AnchorablePaneDockBottom:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Offset(0.0, targetScreenRect.Height / 2.0);
targetScreenRect.Height /= 2.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.AnchorablePaneDockTop:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Height /= 2.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.AnchorablePaneDockLeft:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Width /= 2.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.AnchorablePaneDockRight:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Offset(targetScreenRect.Width / 2.0, 0.0);
targetScreenRect.Width /= 2.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.AnchorablePaneDockInside:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
if (_tabIndex == -1)
{
return new RectangleGeometry(targetScreenRect);
}
else
{
var translatedDetectionRect = new Rect(DetectionRects[0].TopLeft, DetectionRects[0].BottomRight);
translatedDetectionRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
var pathFigure = new PathFigure();
pathFigure.StartPoint = targetScreenRect.TopLeft;
pathFigure.Segments.Add(new LineSegment() { Point = new Point(targetScreenRect.Left, translatedDetectionRect.Top) });
pathFigure.Segments.Add(new LineSegment() { Point = translatedDetectionRect.TopLeft });
pathFigure.Segments.Add(new LineSegment() { Point = translatedDetectionRect.BottomLeft });
pathFigure.Segments.Add(new LineSegment() { Point = translatedDetectionRect.BottomRight });
pathFigure.Segments.Add(new LineSegment() { Point = translatedDetectionRect.TopRight });
pathFigure.Segments.Add(new LineSegment() { Point = new Point(targetScreenRect.Right, translatedDetectionRect.Top) });
pathFigure.Segments.Add(new LineSegment() { Point = targetScreenRect.TopRight });
pathFigure.IsClosed = true;
pathFigure.IsFilled = true;
pathFigure.Freeze();
return new PathGeometry(new PathFigure[] { pathFigure });
}
}
var translatedDetectionRect = new Rect( DetectionRects[ 0 ].TopLeft, DetectionRects[ 0 ].BottomRight );
translatedDetectionRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
var pathFigure = new PathFigure();
pathFigure.StartPoint = targetScreenRect.TopLeft;
pathFigure.Segments.Add( new LineSegment() { Point = new Point( targetScreenRect.Left, translatedDetectionRect.Top ) } );
pathFigure.Segments.Add( new LineSegment() { Point = translatedDetectionRect.TopLeft } );
pathFigure.Segments.Add( new LineSegment() { Point = translatedDetectionRect.BottomLeft } );
pathFigure.Segments.Add( new LineSegment() { Point = translatedDetectionRect.BottomRight } );
pathFigure.Segments.Add( new LineSegment() { Point = translatedDetectionRect.TopRight } );
pathFigure.Segments.Add( new LineSegment() { Point = new Point( targetScreenRect.Right, translatedDetectionRect.Top ) } );
pathFigure.Segments.Add( new LineSegment() { Point = targetScreenRect.TopRight } );
pathFigure.IsClosed = true;
pathFigure.IsFilled = true;
pathFigure.Freeze();
return new PathGeometry( new PathFigure[] { pathFigure } );
}
}
}
return null;
}
return null;
}
#endregion
}
}

143
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneTabPanel.cs

@ -15,93 +15,98 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class AnchorablePaneTabPanel : Panel
public class AnchorablePaneTabPanel : Panel
{
#region Constructors
public AnchorablePaneTabPanel()
{
this.FlowDirection = System.Windows.FlowDirection.LeftToRight;
}
#endregion
#region Overrides
protected override Size MeasureOverride( Size availableSize )
{
public AnchorablePaneTabPanel()
double totWidth = 0;
double maxHeight = 0;
var visibleChildren = Children.Cast<UIElement>().Where( ch => ch.Visibility != System.Windows.Visibility.Collapsed );
foreach( FrameworkElement child in visibleChildren )
{
child.Measure( new Size( double.PositiveInfinity, availableSize.Height ) );
totWidth += child.DesiredSize.Width;
maxHeight = Math.Max( maxHeight, child.DesiredSize.Height );
}
if( totWidth > availableSize.Width )
{
double childFinalDesideredWidth = availableSize.Width / visibleChildren.Count();
foreach( FrameworkElement child in visibleChildren )
{
FlowDirection = System.Windows.FlowDirection.LeftToRight;
child.Measure( new Size( childFinalDesideredWidth, availableSize.Height ) );
}
}
return new Size( Math.Min( availableSize.Width, totWidth ), maxHeight );
}
protected override Size ArrangeOverride( Size finalSize )
{
var visibleChildren = Children.Cast<UIElement>().Where( ch => ch.Visibility != System.Windows.Visibility.Collapsed );
protected override Size MeasureOverride(Size availableSize)
double finalWidth = finalSize.Width;
double desideredWidth = visibleChildren.Sum( ch => ch.DesiredSize.Width );
double offsetX = 0.0;
if( finalWidth > desideredWidth )
{
foreach( FrameworkElement child in visibleChildren )
{
double totWidth = 0;
double maxHeight = 0;
var visibleChildren = Children.Cast<UIElement>().Where(ch => ch.Visibility != System.Windows.Visibility.Collapsed);
foreach (FrameworkElement child in visibleChildren)
{
child.Measure(new Size(double.PositiveInfinity, availableSize.Height));
totWidth += child.DesiredSize.Width;
maxHeight = Math.Max(maxHeight, child.DesiredSize.Height);
}
if (totWidth > availableSize.Width)
{
double childFinalDesideredWidth = availableSize.Width / visibleChildren.Count();
foreach (FrameworkElement child in visibleChildren)
{
child.Measure(new Size(childFinalDesideredWidth, availableSize.Height));
}
}
return new Size(Math.Min(availableSize.Width, totWidth), maxHeight);
}
double childFinalWidth = child.DesiredSize.Width;
child.Arrange( new Rect( offsetX, 0, childFinalWidth, finalSize.Height ) );
protected override Size ArrangeOverride(Size finalSize)
offsetX += childFinalWidth;
}
}
else
{
double childFinalWidth = finalWidth / visibleChildren.Count();
foreach( FrameworkElement child in visibleChildren )
{
var visibleChildren = Children.Cast<UIElement>().Where(ch => ch.Visibility != System.Windows.Visibility.Collapsed);
double finalWidth = finalSize.Width;
double desideredWidth = visibleChildren.Sum(ch => ch.DesiredSize.Width);
double offsetX = 0.0;
if (finalWidth > desideredWidth)
{
foreach (FrameworkElement child in visibleChildren)
{
double childFinalWidth = child.DesiredSize.Width ;
child.Arrange(new Rect(offsetX, 0, childFinalWidth, finalSize.Height));
offsetX += childFinalWidth;
}
}
else
{
double childFinalWidth = finalWidth / visibleChildren.Count();
foreach (FrameworkElement child in visibleChildren)
{
child.Arrange(new Rect(offsetX, 0, childFinalWidth, finalSize.Height));
offsetX += childFinalWidth;
}
}
return finalSize;
child.Arrange( new Rect( offsetX, 0, childFinalWidth, finalSize.Height ) );
offsetX += childFinalWidth;
}
}
protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
{
if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed &&
LayoutAnchorableTabItem.IsDraggingItem())
{
var contentModel = LayoutAnchorableTabItem.GetDraggingItem().Model as LayoutAnchorable;
var manager = contentModel.Root.Manager;
LayoutAnchorableTabItem.ResetDraggingItem();
return finalSize;
}
manager.StartDraggingFloatingWindowForContent(contentModel);
}
protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e )
{
if( e.LeftButton == System.Windows.Input.MouseButtonState.Pressed &&
LayoutAnchorableTabItem.IsDraggingItem() )
{
var contentModel = LayoutAnchorableTabItem.GetDraggingItem().Model as LayoutAnchorable;
var manager = contentModel.Root.Manager;
LayoutAnchorableTabItem.ResetDraggingItem();
base.OnMouseLeave(e);
}
manager.StartDraggingFloatingWindowForContent( contentModel );
}
base.OnMouseLeave( e );
}
#endregion
}
}

281
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneTitle.cs

@ -14,10 +14,7 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Input;
@ -25,165 +22,191 @@ using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class AnchorablePaneTitle : Control
{
#region Members
public class AnchorablePaneTitle : Control
private bool _isMouseDown = false;
#endregion
#region Constructors
static AnchorablePaneTitle()
{
static AnchorablePaneTitle()
{
IsHitTestVisibleProperty.OverrideMetadata(typeof(AnchorablePaneTitle), new FrameworkPropertyMetadata(true));
FocusableProperty.OverrideMetadata(typeof(AnchorablePaneTitle), new FrameworkPropertyMetadata(false));
DefaultStyleKeyProperty.OverrideMetadata(typeof(AnchorablePaneTitle), new FrameworkPropertyMetadata(typeof(AnchorablePaneTitle)));
}
IsHitTestVisibleProperty.OverrideMetadata( typeof( AnchorablePaneTitle ), new FrameworkPropertyMetadata( true ) );
FocusableProperty.OverrideMetadata( typeof( AnchorablePaneTitle ), new FrameworkPropertyMetadata( false ) );
DefaultStyleKeyProperty.OverrideMetadata( typeof( AnchorablePaneTitle ), new FrameworkPropertyMetadata( typeof( AnchorablePaneTitle ) ) );
}
public AnchorablePaneTitle()
{
}
public AnchorablePaneTitle()
{
#endregion
}
#region Properties
#region Model
#region Model
/// <summary>
/// Model Dependency Property
/// </summary>
public static readonly DependencyProperty ModelProperty =
DependencyProperty.Register("Model", typeof(LayoutAnchorable), typeof(AnchorablePaneTitle),
new FrameworkPropertyMetadata((LayoutAnchorable)null, new PropertyChangedCallback(_OnModelChanged)));
/// <summary>
/// Model Dependency Property
/// </summary>
public static readonly DependencyProperty ModelProperty = DependencyProperty.Register( "Model", typeof( LayoutAnchorable ), typeof( AnchorablePaneTitle ),
new FrameworkPropertyMetadata( ( LayoutAnchorable )null, new PropertyChangedCallback( _OnModelChanged ) ) );
/// <summary>
/// Gets or sets the Model property. This dependency property
/// indicates model attached to this view.
/// </summary>
public LayoutAnchorable Model
{
get { return (LayoutAnchorable)GetValue(ModelProperty); }
set { SetValue(ModelProperty, value); }
}
/// <summary>
/// Gets or sets the Model property. This dependency property
/// indicates model attached to this view.
/// </summary>
public LayoutAnchorable Model
{
get
{
return ( LayoutAnchorable )GetValue( ModelProperty );
}
set
{
SetValue( ModelProperty, value );
}
}
static void _OnModelChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
((AnchorablePaneTitle)sender).OnModelChanged(e);
}
private static void _OnModelChanged( DependencyObject sender, DependencyPropertyChangedEventArgs e )
{
( ( AnchorablePaneTitle )sender ).OnModelChanged( e );
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the Model property.
/// </summary>
protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e)
{
if (Model != null)
SetLayoutItem(Model.Root.Manager.GetLayoutItemFromModel(Model));
else
SetLayoutItem(null);
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the Model property.
/// </summary>
protected virtual void OnModelChanged( DependencyPropertyChangedEventArgs e )
{
if( Model != null )
{
this.SetLayoutItem( Model.Root.Manager.GetLayoutItemFromModel( Model ) );
}
else
{
this.SetLayoutItem( null );
}
}
#endregion
#endregion
#region LayoutItem
#region LayoutItem
/// <summary>
/// LayoutItem Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey LayoutItemPropertyKey = DependencyProperty.RegisterReadOnly( "LayoutItem", typeof( LayoutItem ), typeof( AnchorablePaneTitle ),
new FrameworkPropertyMetadata( ( LayoutItem )null ) );
/// <summary>
/// LayoutItem Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey LayoutItemPropertyKey
= DependencyProperty.RegisterReadOnly("LayoutItem", typeof(LayoutItem), typeof(AnchorablePaneTitle),
new FrameworkPropertyMetadata((LayoutItem)null));
public static readonly DependencyProperty LayoutItemProperty = LayoutItemPropertyKey.DependencyProperty;
public static readonly DependencyProperty LayoutItemProperty
= LayoutItemPropertyKey.DependencyProperty;
/// <summary>
/// Gets the LayoutItem property. This dependency property
/// indicates the LayoutItem attached to this tag item.
/// </summary>
public LayoutItem LayoutItem
{
get
{
return ( LayoutItem )GetValue( LayoutItemProperty );
}
}
/// <summary>
/// Gets the LayoutItem property. This dependency property
/// indicates the LayoutItem attached to this tag item.
/// </summary>
public LayoutItem LayoutItem
{
get { return (LayoutItem)GetValue(LayoutItemProperty); }
}
/// <summary>
/// Provides a secure method for setting the LayoutItem property.
/// This dependency property indicates the LayoutItem attached to this tag item.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetLayoutItem( LayoutItem value )
{
this.SetValue( LayoutItemPropertyKey, value );
}
/// <summary>
/// Provides a secure method for setting the LayoutItem property.
/// This dependency property indicates the LayoutItem attached to this tag item.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetLayoutItem(LayoutItem value)
{
SetValue(LayoutItemPropertyKey, value);
}
#endregion
#endregion
#endregion
#region Overrides
private void OnHide()
{
Model.Hide();
}
protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e )
{
if( e.LeftButton != MouseButtonState.Pressed )
{
_isMouseDown = false;
}
private void OnToggleAutoHide()
{
Model.ToggleAutoHide();
}
base.OnMouseMove( e );
}
protected override void OnMouseMove(System.Windows.Input.MouseEventArgs e)
protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e )
{
base.OnMouseLeave( e );
if( _isMouseDown && e.LeftButton == MouseButtonState.Pressed )
{
var pane = this.FindVisualAncestor<LayoutAnchorablePaneControl>();
if( pane != null )
{
if (e.LeftButton != MouseButtonState.Pressed)
{
_isMouseDown = false;
}
var paneModel = pane.Model as LayoutAnchorablePane;
var manager = paneModel.Root.Manager;
base.OnMouseMove(e);
manager.StartDraggingFloatingWindowForPane( paneModel );
}
}
protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
{
base.OnMouseLeave(e);
if (_isMouseDown && e.LeftButton == MouseButtonState.Pressed)
{
var pane = this.FindVisualAncestor<LayoutAnchorablePaneControl>();
if (pane != null)
{
var paneModel = pane.Model as LayoutAnchorablePane;
var manager = paneModel.Root.Manager;
_isMouseDown = false;
}
manager.StartDraggingFloatingWindowForPane(paneModel);
}
}
protected override void OnMouseLeftButtonDown( System.Windows.Input.MouseButtonEventArgs e )
{
base.OnMouseLeftButtonDown( e );
_isMouseDown = false;
if( !e.Handled )
{
bool attachFloatingWindow = false;
var parentFloatingWindow = Model.FindParent<LayoutAnchorableFloatingWindow>();
if( parentFloatingWindow != null )
{
attachFloatingWindow = parentFloatingWindow.Descendents().OfType<LayoutAnchorablePane>().Count() == 1;
}
bool _isMouseDown = false;
protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
if( attachFloatingWindow )
{
base.OnMouseLeftButtonDown(e);
if (!e.Handled)
{
bool attachFloatingWindow = false;
var parentFloatingWindow = Model.FindParent<LayoutAnchorableFloatingWindow>();
if (parentFloatingWindow != null)
{
attachFloatingWindow = parentFloatingWindow.Descendents().OfType<LayoutAnchorablePane>().Count() == 1;
}
if (attachFloatingWindow)
{
//the pane is hosted inside a floating window that contains only an anchorable pane so drag the floating window itself
var floatingWndControl = Model.Root.Manager.FloatingWindows.Single(fwc => fwc.Model == parentFloatingWindow);
floatingWndControl.AttachDrag(false);
}
else
_isMouseDown = true;//normal drag
}
//the pane is hosted inside a floating window that contains only an anchorable pane so drag the floating window itself
var floatingWndControl = Model.Root.Manager.FloatingWindows.Single( fwc => fwc.Model == parentFloatingWindow );
floatingWndControl.AttachDrag( false );
}
else
_isMouseDown = true;//normal drag
}
}
protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e)
{
_isMouseDown = false;
base.OnMouseLeftButtonUp(e);
protected override void OnMouseLeftButtonUp( System.Windows.Input.MouseButtonEventArgs e )
{
_isMouseDown = false;
base.OnMouseLeftButtonUp( e );
if (Model != null)
Model.IsActive = true;//FocusElementManager.SetFocusOnLastElement(Model);
}
if( Model != null )
Model.IsActive = true;//FocusElementManager.SetFocusOnLastElement(Model);
}
#endregion
#region Private Methods
private void OnHide()
{
this.Model.Hide();
}
private void OnToggleAutoHide()
{
this.Model.ToggleAutoHide();
}
#endregion
}
}

136
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AutoHideWindowManager.cs

@ -15,76 +15,82 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Threading;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
class AutoHideWindowManager
internal class AutoHideWindowManager
{
#region Members
private DockingManager _manager;
private WeakReference _currentAutohiddenAnchor = null;
private DispatcherTimer _closeTimer = null;
#endregion
#region Constructors
internal AutoHideWindowManager( DockingManager manager )
{
_manager = manager;
this.SetupCloseTimer();
}
#endregion
#region Private Methods
public void ShowAutoHideWindow( LayoutAnchorControl anchor )
{
if( _currentAutohiddenAnchor.GetValueOrDefault<LayoutAnchorControl>() != anchor )
{
StopCloseTimer();
_currentAutohiddenAnchor = new WeakReference( anchor );
_manager.AutoHideWindow.Show( anchor );
StartCloseTimer();
}
}
public void HideAutoWindow( LayoutAnchorControl anchor = null )
{
if( anchor == null ||
anchor == _currentAutohiddenAnchor.GetValueOrDefault<LayoutAnchorControl>() )
{
StopCloseTimer();
}
else
System.Diagnostics.Debug.Assert( false );
}
private void SetupCloseTimer()
{
DockingManager _manager;
internal AutoHideWindowManager(DockingManager manager)
{
_manager = manager;
SetupCloseTimer();
}
WeakReference _currentAutohiddenAnchor = null;
public void ShowAutoHideWindow(LayoutAnchorControl anchor)
{
if( _currentAutohiddenAnchor.GetValueOrDefault<LayoutAnchorControl>() != anchor )
{
StopCloseTimer();
_currentAutohiddenAnchor = new WeakReference( anchor );
_manager.AutoHideWindow.Show( anchor );
StartCloseTimer();
}
}
public void HideAutoWindow(LayoutAnchorControl anchor = null)
{
if (anchor == null ||
anchor == _currentAutohiddenAnchor.GetValueOrDefault<LayoutAnchorControl>())
{
StopCloseTimer();
}
else
System.Diagnostics.Debug.Assert(false);
}
DispatcherTimer _closeTimer = null;
void SetupCloseTimer()
{
_closeTimer = new DispatcherTimer(DispatcherPriority.Background);
_closeTimer.Interval = TimeSpan.FromMilliseconds(1500);
_closeTimer.Tick += (s, e) =>
{
if (_manager.AutoHideWindow.IsWin32MouseOver ||
((LayoutAnchorable)_manager.AutoHideWindow.Model).IsActive ||
_manager.AutoHideWindow.IsResizing)
return;
StopCloseTimer();
};
}
void StartCloseTimer()
{
_closeTimer.Start();
}
void StopCloseTimer()
{
_closeTimer.Stop();
_manager.AutoHideWindow.Hide();
_currentAutohiddenAnchor = null;
}
_closeTimer = new DispatcherTimer( DispatcherPriority.Background );
_closeTimer.Interval = TimeSpan.FromMilliseconds( 1500 );
_closeTimer.Tick += ( s, e ) =>
{
if( _manager.AutoHideWindow.IsWin32MouseOver ||
( ( LayoutAnchorable )_manager.AutoHideWindow.Model ).IsActive ||
_manager.AutoHideWindow.IsResizing )
return;
StopCloseTimer();
};
}
private void StartCloseTimer()
{
_closeTimer.Start();
}
private void StopCloseTimer()
{
_closeTimer.Stop();
_manager.AutoHideWindow.Hide();
_currentAutohiddenAnchor = null;
}
#endregion
}
}

49
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/BindingHelper.cs

@ -15,9 +15,6 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.ComponentModel;
using System.Windows.Data;
@ -25,31 +22,35 @@ using System.Windows.Threading;
namespace Xceed.Wpf.AvalonDock.Controls
{
class BindingHelper
internal class BindingHelper
{
#region Methods
public static void RebindInactiveBindings( DependencyObject dependencyObject )
{
public static void RebindInactiveBindings(DependencyObject dependencyObject)
foreach( PropertyDescriptor property in TypeDescriptor.GetProperties( dependencyObject.GetType() ) )
{
var dpd = DependencyPropertyDescriptor.FromProperty( property );
if( dpd != null )
{
foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(dependencyObject.GetType()))
BindingExpressionBase binding = BindingOperations.GetBindingExpressionBase( dependencyObject, dpd.DependencyProperty );
if( binding != null )
{
//if (property.Name == "DataContext" || binding.HasError || binding.Status != BindingStatus.Active)
{
var dpd = DependencyPropertyDescriptor.FromProperty(property);
if (dpd != null)
{
BindingExpressionBase binding = BindingOperations.GetBindingExpressionBase(dependencyObject, dpd.DependencyProperty);
if (binding != null)
{
//if (property.Name == "DataContext" || binding.HasError || binding.Status != BindingStatus.Active)
{
// Ensure that no pending calls are in the dispatcher queue
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.SystemIdle, (Action)delegate
{
// Remove and add the binding to re-trigger the binding error
dependencyObject.ClearValue(dpd.DependencyProperty);
BindingOperations.SetBinding(dependencyObject, dpd.DependencyProperty, binding.ParentBindingBase);
});
}
}
}
// Ensure that no pending calls are in the dispatcher queue
Dispatcher.CurrentDispatcher.BeginInvoke( DispatcherPriority.SystemIdle, ( Action )delegate
{
// Remove and add the binding to re-trigger the binding error
dependencyObject.ClearValue( dpd.DependencyProperty );
BindingOperations.SetBinding( dependencyObject, dpd.DependencyProperty, binding.ParentBindingBase );
} );
}
}
}
}
}
#endregion
}
}

44
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/ContextMenuEx.cs

@ -14,39 +14,39 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class ContextMenuEx : ContextMenu
{
static ContextMenuEx()
{
}
public class ContextMenuEx : ContextMenu
{
#region Constructors
public ContextMenuEx()
{
static ContextMenuEx()
{
}
}
public ContextMenuEx()
{
}
protected override System.Windows.DependencyObject GetContainerForItemOverride()
{
return new MenuItemEx();
}
#endregion
protected override void OnOpened(System.Windows.RoutedEventArgs e)
{
BindingOperations.GetBindingExpression(this, ItemsSourceProperty).UpdateTarget();
#region Overrides
base.OnOpened(e);
}
protected override System.Windows.DependencyObject GetContainerForItemOverride()
{
return new MenuItemEx();
}
protected override void OnOpened( System.Windows.RoutedEventArgs e )
{
BindingOperations.GetBindingExpression( this, ItemsSourceProperty ).UpdateTarget();
base.OnOpened( e );
}
#endregion
}
}

427
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DockingManagerDropTarget.cs

@ -15,234 +15,245 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal class DockingManagerDropTarget : DropTarget<DockingManager>
internal class DockingManagerDropTarget : DropTarget<DockingManager>
{
#region Members
private DockingManager _manager;
#endregion
#region Constructors
internal DockingManagerDropTarget( DockingManager manager, Rect detectionRect, DropTargetType type )
: base( manager, detectionRect, type )
{
internal DockingManagerDropTarget(DockingManager manager, Rect detectionRect, DropTargetType type)
: base(manager, detectionRect, type)
{
_manager = manager;
}
_manager = manager;
}
#endregion
DockingManager _manager;
#region Overrides
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{
switch (Type)
protected override void Drop( LayoutAnchorableFloatingWindow floatingWindow )
{
switch( Type )
{
case DropTargetType.DockingManagerDockLeft:
#region DropTargetType.DockingManagerDockLeft
{
if( _manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Horizontal &&
_manager.Layout.RootPanel.Children.Count == 1 )
_manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
if( _manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
case DropTargetType.DockingManagerDockLeft:
#region DropTargetType.DockingManagerDockLeft
{
if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Horizontal &&
_manager.Layout.RootPanel.Children.Count == 1)
_manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if (layoutAnchorablePaneGroup != null &&
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray();
for (int i = 0; i < childrenToTransfer.Length; i++)
_manager.Layout.RootPanel.Children.Insert(i, childrenToTransfer[i]);
}
else
_manager.Layout.RootPanel.Children.Insert(0, floatingWindow.RootPanel);
}
else
{
var newOrientedPanel = new LayoutPanel()
{
Orientation = System.Windows.Controls.Orientation.Horizontal
};
newOrientedPanel.Children.Add(floatingWindow.RootPanel);
newOrientedPanel.Children.Add(_manager.Layout.RootPanel);
_manager.Layout.RootPanel = newOrientedPanel;
}
}
break;
#endregion
case DropTargetType.DockingManagerDockRight:
#region DropTargetType.DockingManagerDockRight
{
if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Horizontal &&
_manager.Layout.RootPanel.Children.Count == 1)
_manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if (layoutAnchorablePaneGroup != null &&
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray();
for (int i = 0; i < childrenToTransfer.Length; i++)
_manager.Layout.RootPanel.Children.Add(childrenToTransfer[i]);
}
else
_manager.Layout.RootPanel.Children.Add(floatingWindow.RootPanel);
}
else
{
var newOrientedPanel = new LayoutPanel()
{
Orientation = System.Windows.Controls.Orientation.Horizontal
};
newOrientedPanel.Children.Add(_manager.Layout.RootPanel);
newOrientedPanel.Children.Add(floatingWindow.RootPanel);
_manager.Layout.RootPanel = newOrientedPanel;
}
}
break;
#endregion
case DropTargetType.DockingManagerDockTop:
#region DropTargetType.DockingManagerDockTop
{
if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Vertical &&
_manager.Layout.RootPanel.Children.Count == 1)
_manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Vertical)
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if (layoutAnchorablePaneGroup != null &&
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical)
{
var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray();
for (int i = 0; i < childrenToTransfer.Length; i++)
_manager.Layout.RootPanel.Children.Insert(i, childrenToTransfer[i]);
}
else
_manager.Layout.RootPanel.Children.Insert(0, floatingWindow.RootPanel);
}
else
{
var newOrientedPanel = new LayoutPanel()
{
Orientation = System.Windows.Controls.Orientation.Vertical
};
newOrientedPanel.Children.Add(floatingWindow.RootPanel);
newOrientedPanel.Children.Add(_manager.Layout.RootPanel);
_manager.Layout.RootPanel = newOrientedPanel;
}
}
break;
#endregion
case DropTargetType.DockingManagerDockBottom:
#region DropTargetType.DockingManagerDockBottom
{
if (_manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Vertical &&
_manager.Layout.RootPanel.Children.Count == 1)
_manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
if (_manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Vertical)
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if (layoutAnchorablePaneGroup != null &&
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical)
{
var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray();
for (int i = 0; i < childrenToTransfer.Length; i++)
_manager.Layout.RootPanel.Children.Add(childrenToTransfer[i]);
}
else
_manager.Layout.RootPanel.Children.Add(floatingWindow.RootPanel);
}
else
{
var newOrientedPanel = new LayoutPanel()
{
Orientation = System.Windows.Controls.Orientation.Vertical
};
newOrientedPanel.Children.Add(_manager.Layout.RootPanel);
newOrientedPanel.Children.Add(floatingWindow.RootPanel);
_manager.Layout.RootPanel = newOrientedPanel;
}
}
break;
#endregion
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if( layoutAnchorablePaneGroup != null &&
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray();
for( int i = 0; i < childrenToTransfer.Length; i++ )
_manager.Layout.RootPanel.Children.Insert( i, childrenToTransfer[ i ] );
}
else
_manager.Layout.RootPanel.Children.Insert( 0, floatingWindow.RootPanel );
}
else
{
var newOrientedPanel = new LayoutPanel()
{
Orientation = System.Windows.Controls.Orientation.Horizontal
};
newOrientedPanel.Children.Add( floatingWindow.RootPanel );
newOrientedPanel.Children.Add( _manager.Layout.RootPanel );
base.Drop(floatingWindow);
}
_manager.Layout.RootPanel = newOrientedPanel;
}
}
break;
#endregion
case DropTargetType.DockingManagerDockRight:
#region DropTargetType.DockingManagerDockRight
{
if( _manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Horizontal &&
_manager.Layout.RootPanel.Children.Count == 1 )
_manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
if( _manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if( layoutAnchorablePaneGroup != null &&
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray();
for( int i = 0; i < childrenToTransfer.Length; i++ )
_manager.Layout.RootPanel.Children.Add( childrenToTransfer[ i ] );
}
else
_manager.Layout.RootPanel.Children.Add( floatingWindow.RootPanel );
}
else
{
var newOrientedPanel = new LayoutPanel()
{
Orientation = System.Windows.Controls.Orientation.Horizontal
};
public override System.Windows.Media.Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel)
{
var anchorableFloatingWindowModel = floatingWindowModel as LayoutAnchorableFloatingWindow;
var layoutAnchorablePane = anchorableFloatingWindowModel.RootPanel as ILayoutPositionableElement;
var layoutAnchorablePaneWithActualSize = anchorableFloatingWindowModel.RootPanel as ILayoutPositionableElementWithActualSize;
newOrientedPanel.Children.Add( floatingWindow.RootPanel );
newOrientedPanel.Children.Insert( 0, _manager.Layout.RootPanel );
var targetScreenRect = TargetElement.GetScreenArea();
switch (Type)
_manager.Layout.RootPanel = newOrientedPanel;
}
}
break;
#endregion
case DropTargetType.DockingManagerDockTop:
#region DropTargetType.DockingManagerDockTop
{
if( _manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Vertical &&
_manager.Layout.RootPanel.Children.Count == 1 )
_manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
if( _manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Vertical )
{
case DropTargetType.DockingManagerDockLeft:
{
var desideredWidth = layoutAnchorablePane.DockWidth.IsAbsolute ? layoutAnchorablePane.DockWidth.Value : layoutAnchorablePaneWithActualSize.ActualWidth;
var previewBoxRect = new Rect(
targetScreenRect.Left - overlayWindow.Left,
targetScreenRect.Top - overlayWindow.Top,
Math.Min(desideredWidth, targetScreenRect.Width / 2.0),
targetScreenRect.Height);
return new RectangleGeometry(previewBoxRect);
}
case DropTargetType.DockingManagerDockTop:
{
var desideredHeight = layoutAnchorablePane.DockHeight.IsAbsolute ? layoutAnchorablePane.DockHeight.Value : layoutAnchorablePaneWithActualSize.ActualHeight;
var previewBoxRect = new Rect(
targetScreenRect.Left - overlayWindow.Left,
targetScreenRect.Top - overlayWindow.Top,
targetScreenRect.Width,
Math.Min(desideredHeight, targetScreenRect.Height / 2.0));
return new RectangleGeometry(previewBoxRect);
}
case DropTargetType.DockingManagerDockRight:
{
var desideredWidth = layoutAnchorablePane.DockWidth.IsAbsolute ? layoutAnchorablePane.DockWidth.Value : layoutAnchorablePaneWithActualSize.ActualWidth;
var previewBoxRect = new Rect(
targetScreenRect.Right - overlayWindow.Left - Math.Min(desideredWidth, targetScreenRect.Width / 2.0),
targetScreenRect.Top - overlayWindow.Top,
Math.Min(desideredWidth, targetScreenRect.Width / 2.0),
targetScreenRect.Height);
return new RectangleGeometry(previewBoxRect);
}
case DropTargetType.DockingManagerDockBottom:
{
var desideredHeight = layoutAnchorablePane.DockHeight.IsAbsolute ? layoutAnchorablePane.DockHeight.Value : layoutAnchorablePaneWithActualSize.ActualHeight;
var previewBoxRect = new Rect(
targetScreenRect.Left - overlayWindow.Left,
targetScreenRect.Bottom - overlayWindow.Top - Math.Min(desideredHeight, targetScreenRect.Height / 2.0),
targetScreenRect.Width,
Math.Min(desideredHeight, targetScreenRect.Height / 2.0));
return new RectangleGeometry(previewBoxRect);
}
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if( layoutAnchorablePaneGroup != null &&
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical )
{
var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray();
for( int i = 0; i < childrenToTransfer.Length; i++ )
_manager.Layout.RootPanel.Children.Insert( i, childrenToTransfer[ i ] );
}
else
_manager.Layout.RootPanel.Children.Insert( 0, floatingWindow.RootPanel );
}
else
{
var newOrientedPanel = new LayoutPanel()
{
Orientation = System.Windows.Controls.Orientation.Vertical
};
newOrientedPanel.Children.Add( floatingWindow.RootPanel );
newOrientedPanel.Children.Add( _manager.Layout.RootPanel );
throw new InvalidOperationException();
}
_manager.Layout.RootPanel = newOrientedPanel;
}
}
break;
#endregion
case DropTargetType.DockingManagerDockBottom:
#region DropTargetType.DockingManagerDockBottom
{
if( _manager.Layout.RootPanel.Orientation != System.Windows.Controls.Orientation.Vertical &&
_manager.Layout.RootPanel.Children.Count == 1 )
_manager.Layout.RootPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
if( _manager.Layout.RootPanel.Orientation == System.Windows.Controls.Orientation.Vertical )
{
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
if( layoutAnchorablePaneGroup != null &&
layoutAnchorablePaneGroup.Orientation == System.Windows.Controls.Orientation.Vertical )
{
var childrenToTransfer = layoutAnchorablePaneGroup.Children.ToArray();
for( int i = 0; i < childrenToTransfer.Length; i++ )
_manager.Layout.RootPanel.Children.Add( childrenToTransfer[ i ] );
}
else
_manager.Layout.RootPanel.Children.Add( floatingWindow.RootPanel );
}
else
{
var newOrientedPanel = new LayoutPanel()
{
Orientation = System.Windows.Controls.Orientation.Vertical
};
newOrientedPanel.Children.Add( floatingWindow.RootPanel );
newOrientedPanel.Children.Insert( 0, _manager.Layout.RootPanel );
_manager.Layout.RootPanel = newOrientedPanel;
}
}
break;
#endregion
}
base.Drop( floatingWindow );
}
public override System.Windows.Media.Geometry GetPreviewPath( OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel )
{
var anchorableFloatingWindowModel = floatingWindowModel as LayoutAnchorableFloatingWindow;
var layoutAnchorablePane = anchorableFloatingWindowModel.RootPanel as ILayoutPositionableElement;
var layoutAnchorablePaneWithActualSize = anchorableFloatingWindowModel.RootPanel as ILayoutPositionableElementWithActualSize;
var targetScreenRect = TargetElement.GetScreenArea();
switch( Type )
{
case DropTargetType.DockingManagerDockLeft:
{
var desideredWidth = layoutAnchorablePane.DockWidth.IsAbsolute ? layoutAnchorablePane.DockWidth.Value : layoutAnchorablePaneWithActualSize.ActualWidth;
var previewBoxRect = new Rect(
targetScreenRect.Left - overlayWindow.Left,
targetScreenRect.Top - overlayWindow.Top,
Math.Min( desideredWidth, targetScreenRect.Width / 2.0 ),
targetScreenRect.Height );
return new RectangleGeometry( previewBoxRect );
}
case DropTargetType.DockingManagerDockTop:
{
var desideredHeight = layoutAnchorablePane.DockHeight.IsAbsolute ? layoutAnchorablePane.DockHeight.Value : layoutAnchorablePaneWithActualSize.ActualHeight;
var previewBoxRect = new Rect(
targetScreenRect.Left - overlayWindow.Left,
targetScreenRect.Top - overlayWindow.Top,
targetScreenRect.Width,
Math.Min( desideredHeight, targetScreenRect.Height / 2.0 ) );
return new RectangleGeometry( previewBoxRect );
}
case DropTargetType.DockingManagerDockRight:
{
var desideredWidth = layoutAnchorablePane.DockWidth.IsAbsolute ? layoutAnchorablePane.DockWidth.Value : layoutAnchorablePaneWithActualSize.ActualWidth;
var previewBoxRect = new Rect(
targetScreenRect.Right - overlayWindow.Left - Math.Min( desideredWidth, targetScreenRect.Width / 2.0 ),
targetScreenRect.Top - overlayWindow.Top,
Math.Min( desideredWidth, targetScreenRect.Width / 2.0 ),
targetScreenRect.Height );
return new RectangleGeometry( previewBoxRect );
}
case DropTargetType.DockingManagerDockBottom:
{
var desideredHeight = layoutAnchorablePane.DockHeight.IsAbsolute ? layoutAnchorablePane.DockHeight.Value : layoutAnchorablePaneWithActualSize.ActualHeight;
var previewBoxRect = new Rect(
targetScreenRect.Left - overlayWindow.Left,
targetScreenRect.Bottom - overlayWindow.Top - Math.Min( desideredHeight, targetScreenRect.Height / 2.0 ),
targetScreenRect.Width,
Math.Min( desideredHeight, targetScreenRect.Height / 2.0 ) );
return new RectangleGeometry( previewBoxRect );
}
}
throw new InvalidOperationException();
}
#endregion
}
}

33
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DockingManagerOverlayArea.cs

@ -14,27 +14,30 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class DockingManagerOverlayArea : OverlayArea
{
internal DockingManagerOverlayArea(IOverlayWindow overlayWindow, DockingManager manager)
: base(overlayWindow)
{
_manager = manager;
public class DockingManagerOverlayArea : OverlayArea
{
#region Members
private DockingManager _manager;
base.SetScreenDetectionArea(new Rect(
_manager.PointToScreenDPI(new Point()),
_manager.TransformActualSizeToAncestor()));
}
#endregion
DockingManager _manager;
#region Constructors
internal DockingManagerOverlayArea( IOverlayWindow overlayWindow, DockingManager manager )
: base( overlayWindow )
{
_manager = manager;
base.SetScreenDetectionArea( new Rect(
_manager.PointToScreenDPI( new Point() ),
_manager.TransformActualSizeToAncestor() ) );
}
#endregion
}
}

34
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneControlOverlayArea.cs

@ -14,31 +14,29 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class DocumentPaneControlOverlayArea : OverlayArea
{
public class DocumentPaneControlOverlayArea : OverlayArea
{
#region Members
internal DocumentPaneControlOverlayArea(
IOverlayWindow overlayWindow,
LayoutDocumentPaneControl documentPaneControl)
: base(overlayWindow)
{
_documentPaneControl = documentPaneControl;
base.SetScreenDetectionArea(new Rect(
_documentPaneControl.PointToScreenDPI(new Point()),
_documentPaneControl.TransformActualSizeToAncestor()));
}
private LayoutDocumentPaneControl _documentPaneControl;
LayoutDocumentPaneControl _documentPaneControl;
#endregion
#region Constructors
internal DocumentPaneControlOverlayArea(
IOverlayWindow overlayWindow,
LayoutDocumentPaneControl documentPaneControl )
: base( overlayWindow )
{
_documentPaneControl = documentPaneControl;
base.SetScreenDetectionArea( new Rect( _documentPaneControl.PointToScreenDPI( new Point() ), _documentPaneControl.TransformActualSizeToAncestor() ) );
}
#endregion
}
}

460
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneDropAsAnchorableTarget.cs

@ -15,263 +15,271 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Diagnostics;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal class DocumentPaneDropAsAnchorableTarget : DropTarget<LayoutDocumentPaneControl>
{
internal DocumentPaneDropAsAnchorableTarget(LayoutDocumentPaneControl paneControl, Rect detectionRect, DropTargetType type)
: base(paneControl, detectionRect, type)
{
_targetPane = paneControl;
}
internal class DocumentPaneDropAsAnchorableTarget : DropTarget<LayoutDocumentPaneControl>
{
#region Members
internal DocumentPaneDropAsAnchorableTarget(LayoutDocumentPaneControl paneControl, Rect detectionRect, DropTargetType type, int tabIndex)
: base(paneControl, detectionRect, type)
{
_targetPane = paneControl;
_tabIndex = tabIndex;
}
private LayoutDocumentPaneControl _targetPane;
int _tabIndex = -1;
#endregion
LayoutDocumentPaneControl _targetPane;
#region Constructors
int _tabIndex = -1;
internal DocumentPaneDropAsAnchorableTarget( LayoutDocumentPaneControl paneControl, Rect detectionRect, DropTargetType type )
: base( paneControl, detectionRect, type )
{
_targetPane = paneControl;
}
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{
ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
LayoutDocumentPaneGroup parentGroup;
LayoutPanel parentGroupPanel;
FindParentLayoutDocumentPane(targetModel, out parentGroup, out parentGroupPanel);
internal DocumentPaneDropAsAnchorableTarget( LayoutDocumentPaneControl paneControl, Rect detectionRect, DropTargetType type, int tabIndex )
: base( paneControl, detectionRect, type )
{
_targetPane = paneControl;
_tabIndex = tabIndex;
}
switch (Type)
{
case DropTargetType.DocumentPaneDockAsAnchorableBottom:
#region DropTargetType.DocumentPaneDockAsAnchorableBottom
{
if (parentGroupPanel != null &&
parentGroupPanel.ChildrenCount == 1)
parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
if (parentGroupPanel != null &&
parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Vertical)
{
parentGroupPanel.Children.Insert(
parentGroupPanel.IndexOfChild(parentGroup != null ? parentGroup : targetModel) + 1,
floatingWindow.RootPanel);
}
else if (parentGroupPanel != null)
{
var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentGroupPanel.ReplaceChild(parentGroup != null ? parentGroup : targetModel, newParentPanel);
newParentPanel.Children.Add(parentGroup != null ? parentGroup : targetModel);
newParentPanel.Children.Add(floatingWindow.RootPanel);
}
else
{
throw new NotImplementedException();
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockAsAnchorableTop:
#region DropTargetType.DocumentPaneDockAsAnchorableTop
{
if (parentGroupPanel != null &&
parentGroupPanel.ChildrenCount == 1)
parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
if (parentGroupPanel != null &&
parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Vertical)
{
parentGroupPanel.Children.Insert(
parentGroupPanel.IndexOfChild(parentGroup != null ? parentGroup : targetModel),
floatingWindow.RootPanel);
}
else if (parentGroupPanel != null)
{
var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentGroupPanel.ReplaceChild(parentGroup != null ? parentGroup : targetModel, newParentPanel);
newParentPanel.Children.Add(parentGroup != null ? parentGroup : targetModel);
newParentPanel.Children.Insert(0, floatingWindow.RootPanel);
}
else
{
throw new NotImplementedException();
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockAsAnchorableLeft:
#region DropTargetType.DocumentPaneDockAsAnchorableLeft
{
if (parentGroupPanel != null &&
parentGroupPanel.ChildrenCount == 1)
parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
if (parentGroupPanel != null &&
parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
parentGroupPanel.Children.Insert(
parentGroupPanel.IndexOfChild(parentGroup != null ? parentGroup : targetModel),
floatingWindow.RootPanel);
}
else if (parentGroupPanel != null)
{
var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentGroupPanel.ReplaceChild(parentGroup != null ? parentGroup : targetModel, newParentPanel);
newParentPanel.Children.Add(parentGroup != null ? parentGroup : targetModel);
newParentPanel.Children.Insert(0, floatingWindow.RootPanel);
}
else
{
throw new NotImplementedException();
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockAsAnchorableRight:
#region DropTargetType.DocumentPaneDockAsAnchorableRight
{
if (parentGroupPanel != null &&
parentGroupPanel.ChildrenCount == 1)
parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
if (parentGroupPanel != null &&
parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
parentGroupPanel.Children.Insert(
parentGroupPanel.IndexOfChild(parentGroup != null ? parentGroup : targetModel) + 1,
floatingWindow.RootPanel);
}
else if (parentGroupPanel != null)
{
var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentGroupPanel.ReplaceChild(parentGroup != null ? parentGroup : targetModel, newParentPanel);
newParentPanel.Children.Add(parentGroup != null ? parentGroup : targetModel);
newParentPanel.Children.Add(floatingWindow.RootPanel);
}
else
{
throw new NotImplementedException();
}
}
break;
#endregion
}
#endregion
base.Drop(floatingWindow);
}
#region Overrides
public override System.Windows.Media.Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel)
{
Rect targetScreenRect;
ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
var manager = targetModel.Root.Manager;
//ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
LayoutDocumentPaneGroup parentGroup;
LayoutPanel parentGroupPanel;
if (!FindParentLayoutDocumentPane(targetModel, out parentGroup, out parentGroupPanel))
return null;
//if (targetModel.Parent is LayoutDocumentPaneGroup)
//{
// var parentGroup = targetModel.Parent as LayoutDocumentPaneGroup;
// var documentPaneGroupControl = manager.FindLogicalChildren<LayoutDocumentPaneGroupControl>().First(d => d.Model == parentGroup);
// targetScreenRect = documentPaneGroupControl.GetScreenArea();
//}
//else
//{
// var documentPaneControl = manager.FindLogicalChildren<LayoutDocumentPaneControl>().First(d => d.Model == targetModel);
// targetScreenRect = documentPaneControl.GetScreenArea();
//}
//var parentPanel = targetModel.FindParent<LayoutPanel>();
var documentPaneControl = manager.FindLogicalChildren<FrameworkElement>().OfType<ILayoutControl>().First(d => parentGroup != null ? d.Model == parentGroup : d.Model == parentGroupPanel) as FrameworkElement;
targetScreenRect = documentPaneControl.GetScreenArea();
switch (Type)
protected override void Drop( LayoutAnchorableFloatingWindow floatingWindow )
{
ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
LayoutDocumentPaneGroup parentGroup;
LayoutPanel parentGroupPanel;
FindParentLayoutDocumentPane( targetModel, out parentGroup, out parentGroupPanel );
switch( Type )
{
case DropTargetType.DocumentPaneDockAsAnchorableBottom:
#region DropTargetType.DocumentPaneDockAsAnchorableBottom
{
if( parentGroupPanel != null &&
parentGroupPanel.ChildrenCount == 1 )
parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
if( parentGroupPanel != null &&
parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Vertical )
{
case DropTargetType.DocumentPaneDockAsAnchorableBottom:
{
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Offset(0.0, targetScreenRect.Height - targetScreenRect.Height / 3.0);
targetScreenRect.Height /= 3.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.DocumentPaneDockAsAnchorableTop:
{
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Height /= 3.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.DocumentPaneDockAsAnchorableRight:
{
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Offset(targetScreenRect.Width - targetScreenRect.Width / 3.0, 0.0);
targetScreenRect.Width /= 3.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.DocumentPaneDockAsAnchorableLeft:
{
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Width /= 3.0;
return new RectangleGeometry(targetScreenRect);
}
parentGroupPanel.Children.Insert(
parentGroupPanel.IndexOfChild( parentGroup != null ? parentGroup : targetModel ) + 1,
floatingWindow.RootPanel );
}
else if( parentGroupPanel != null )
{
var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentGroupPanel.ReplaceChild( parentGroup != null ? parentGroup : targetModel, newParentPanel );
newParentPanel.Children.Add( parentGroup != null ? parentGroup : targetModel );
newParentPanel.Children.Add( floatingWindow.RootPanel );
}
else
{
throw new NotImplementedException();
}
return null;
}
bool FindParentLayoutDocumentPane(ILayoutDocumentPane documentPane, out LayoutDocumentPaneGroup containerPaneGroup, out LayoutPanel containerPanel)
{
containerPaneGroup = null;
containerPanel = null;
}
break;
#endregion
case DropTargetType.DocumentPaneDockAsAnchorableTop:
#region DropTargetType.DocumentPaneDockAsAnchorableTop
{
if( parentGroupPanel != null &&
parentGroupPanel.ChildrenCount == 1 )
parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
if (documentPane.Parent is LayoutPanel)
if( parentGroupPanel != null &&
parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Vertical )
{
parentGroupPanel.Children.Insert(
parentGroupPanel.IndexOfChild( parentGroup != null ? parentGroup : targetModel ),
floatingWindow.RootPanel );
}
else if( parentGroupPanel != null )
{
containerPaneGroup = null;
containerPanel = documentPane.Parent as LayoutPanel;
return true;
var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentGroupPanel.ReplaceChild( parentGroup != null ? parentGroup : targetModel, newParentPanel );
newParentPanel.Children.Add( parentGroup != null ? parentGroup : targetModel );
newParentPanel.Children.Insert( 0, floatingWindow.RootPanel );
}
else if (documentPane.Parent is LayoutDocumentPaneGroup)
else
{
var currentDocumentPaneGroup = documentPane.Parent as LayoutDocumentPaneGroup;
while (!(currentDocumentPaneGroup.Parent is LayoutPanel))
{
currentDocumentPaneGroup = currentDocumentPaneGroup.Parent as LayoutDocumentPaneGroup;
throw new NotImplementedException();
}
if (currentDocumentPaneGroup == null)
break;
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockAsAnchorableLeft:
#region DropTargetType.DocumentPaneDockAsAnchorableLeft
{
if( parentGroupPanel != null &&
parentGroupPanel.ChildrenCount == 1 )
parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
if( parentGroupPanel != null &&
parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
parentGroupPanel.Children.Insert(
parentGroupPanel.IndexOfChild( parentGroup != null ? parentGroup : targetModel ),
floatingWindow.RootPanel );
}
else if( parentGroupPanel != null )
{
var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentGroupPanel.ReplaceChild( parentGroup != null ? parentGroup : targetModel, newParentPanel );
newParentPanel.Children.Add( parentGroup != null ? parentGroup : targetModel );
newParentPanel.Children.Insert( 0, floatingWindow.RootPanel );
}
else
{
throw new NotImplementedException();
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockAsAnchorableRight:
#region DropTargetType.DocumentPaneDockAsAnchorableRight
{
if( parentGroupPanel != null &&
parentGroupPanel.ChildrenCount == 1 )
parentGroupPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
if( parentGroupPanel != null &&
parentGroupPanel.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
parentGroupPanel.Children.Insert(
parentGroupPanel.IndexOfChild( parentGroup != null ? parentGroup : targetModel ) + 1,
floatingWindow.RootPanel );
}
else if( parentGroupPanel != null )
{
var newParentPanel = new LayoutPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentGroupPanel.ReplaceChild( parentGroup != null ? parentGroup : targetModel, newParentPanel );
newParentPanel.Children.Add( parentGroup != null ? parentGroup : targetModel );
newParentPanel.Children.Add( floatingWindow.RootPanel );
}
else
{
throw new NotImplementedException();
}
}
break;
#endregion
}
if (currentDocumentPaneGroup == null)
return false;
base.Drop( floatingWindow );
}
containerPaneGroup = currentDocumentPaneGroup;
containerPanel = currentDocumentPaneGroup.Parent as LayoutPanel;
return true;
}
public override System.Windows.Media.Geometry GetPreviewPath( OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel )
{
Rect targetScreenRect;
ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
var manager = targetModel.Root.Manager;
//ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
LayoutDocumentPaneGroup parentGroup;
LayoutPanel parentGroupPanel;
if( !FindParentLayoutDocumentPane( targetModel, out parentGroup, out parentGroupPanel ) )
return null;
//if (targetModel.Parent is LayoutDocumentPaneGroup)
//{
// var parentGroup = targetModel.Parent as LayoutDocumentPaneGroup;
// var documentPaneGroupControl = manager.FindLogicalChildren<LayoutDocumentPaneGroupControl>().First(d => d.Model == parentGroup);
// targetScreenRect = documentPaneGroupControl.GetScreenArea();
//}
//else
//{
// var documentPaneControl = manager.FindLogicalChildren<LayoutDocumentPaneControl>().First(d => d.Model == targetModel);
// targetScreenRect = documentPaneControl.GetScreenArea();
//}
//var parentPanel = targetModel.FindParent<LayoutPanel>();
var documentPaneControl = manager.FindLogicalChildren<FrameworkElement>().OfType<ILayoutControl>().First( d => parentGroup != null ? d.Model == parentGroup : d.Model == parentGroupPanel ) as FrameworkElement;
targetScreenRect = documentPaneControl.GetScreenArea();
switch( Type )
{
case DropTargetType.DocumentPaneDockAsAnchorableBottom:
{
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Offset( 0.0, targetScreenRect.Height - targetScreenRect.Height / 3.0 );
targetScreenRect.Height /= 3.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.DocumentPaneDockAsAnchorableTop:
{
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Height /= 3.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.DocumentPaneDockAsAnchorableRight:
{
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Offset( targetScreenRect.Width - targetScreenRect.Width / 3.0, 0.0 );
targetScreenRect.Width /= 3.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.DocumentPaneDockAsAnchorableLeft:
{
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Width /= 3.0;
return new RectangleGeometry( targetScreenRect );
}
}
return null;
}
return false;
#endregion
#region Private Methods
private bool FindParentLayoutDocumentPane( ILayoutDocumentPane documentPane, out LayoutDocumentPaneGroup containerPaneGroup, out LayoutPanel containerPanel )
{
containerPaneGroup = null;
containerPanel = null;
if( documentPane.Parent is LayoutPanel )
{
containerPaneGroup = null;
containerPanel = documentPane.Parent as LayoutPanel;
return true;
}
else if( documentPane.Parent is LayoutDocumentPaneGroup )
{
var currentDocumentPaneGroup = documentPane.Parent as LayoutDocumentPaneGroup;
while( !( currentDocumentPaneGroup.Parent is LayoutPanel ) )
{
currentDocumentPaneGroup = currentDocumentPaneGroup.Parent as LayoutDocumentPaneGroup;
if( currentDocumentPaneGroup == null )
break;
}
if( currentDocumentPaneGroup == null )
return false;
containerPaneGroup = currentDocumentPaneGroup;
containerPanel = currentDocumentPaneGroup.Parent as LayoutPanel;
return true;
}
return false;
}
#endregion
}
}

922
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneDropTarget.cs

@ -14,490 +14,500 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Diagnostics;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal class DocumentPaneDropTarget : DropTarget<LayoutDocumentPaneControl>
internal class DocumentPaneDropTarget : DropTarget<LayoutDocumentPaneControl>
{
#region Members
private LayoutDocumentPaneControl _targetPane;
private int _tabIndex = -1;
#endregion
#region Constructors
internal DocumentPaneDropTarget( LayoutDocumentPaneControl paneControl, Rect detectionRect, DropTargetType type )
: base( paneControl, detectionRect, type )
{
internal DocumentPaneDropTarget(LayoutDocumentPaneControl paneControl, Rect detectionRect, DropTargetType type)
: base(paneControl, detectionRect, type)
{
_targetPane = paneControl;
}
_targetPane = paneControl;
}
internal DocumentPaneDropTarget( LayoutDocumentPaneControl paneControl, Rect detectionRect, DropTargetType type, int tabIndex )
: base( paneControl, detectionRect, type )
{
_targetPane = paneControl;
_tabIndex = tabIndex;
}
#endregion
#region Overrides
protected override void Drop( LayoutDocumentFloatingWindow floatingWindow )
{
ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
switch( Type )
{
case DropTargetType.DocumentPaneDockBottom:
#region DropTargetType.DocumentPaneDockBottom
{
var newLayoutDocumentPane = new LayoutDocumentPane( floatingWindow.RootDocument );
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
if( parentModel == null )
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentContainer.ReplaceChild( targetModel, newParentModel );
newParentModel.Children.Add( targetModel as LayoutDocumentPane );
newParentModel.Children.Add( newLayoutDocumentPane );
}
else
{
var manager = parentModel.Root.Manager;
if( !manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical )
{
parentModel.Orientation = System.Windows.Controls.Orientation.Vertical;
int targetPaneIndex = parentModel.IndexOfChild( targetModel );
parentModel.Children.Insert( targetPaneIndex + 1, newLayoutDocumentPane );
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical;
parentModel.ReplaceChild( targetModel, newChildGroup );
newChildGroup.Children.Add( targetModel );
newChildGroup.Children.Add( newLayoutDocumentPane );
}
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockTop:
#region DropTargetType.DocumentPaneDockTop
{
var newLayoutDocumentPane = new LayoutDocumentPane( floatingWindow.RootDocument );
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
if( parentModel == null )
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentContainer.ReplaceChild( targetModel, newParentModel );
newParentModel.Children.Add( targetModel as LayoutDocumentPane );
newParentModel.Children.Insert( 0, newLayoutDocumentPane );
}
else
{
var manager = parentModel.Root.Manager;
if( !manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical )
{
parentModel.Orientation = System.Windows.Controls.Orientation.Vertical;
int targetPaneIndex = parentModel.IndexOfChild( targetModel );
parentModel.Children.Insert( targetPaneIndex, newLayoutDocumentPane );
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical;
parentModel.ReplaceChild( targetModel, newChildGroup );
newChildGroup.Children.Add( newLayoutDocumentPane );
newChildGroup.Children.Add( targetModel );
}
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockLeft:
#region DropTargetType.DocumentPaneDockLeft
{
var newLayoutDocumentPane = new LayoutDocumentPane( floatingWindow.RootDocument );
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
if( parentModel == null )
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentContainer.ReplaceChild( targetModel, newParentModel );
newParentModel.Children.Add( targetModel );
newParentModel.Children.Insert( 0, newLayoutDocumentPane );
}
else
{
var manager = parentModel.Root.Manager;
if( !manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal;
int targetPaneIndex = parentModel.IndexOfChild( targetModel );
parentModel.Children.Insert( targetPaneIndex, newLayoutDocumentPane );
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal;
parentModel.ReplaceChild( targetModel, newChildGroup );
newChildGroup.Children.Add( newLayoutDocumentPane );
newChildGroup.Children.Add( targetModel );
}
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockRight:
#region DropTargetType.DocumentPaneDockRight
{
var newLayoutDocumentPane = new LayoutDocumentPane( floatingWindow.RootDocument );
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
if( parentModel == null )
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentContainer.ReplaceChild( targetModel, newParentModel );
newParentModel.Children.Add( targetModel as LayoutDocumentPane );
newParentModel.Children.Add( newLayoutDocumentPane );
}
else
{
var manager = parentModel.Root.Manager;
if( !manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal;
int targetPaneIndex = parentModel.IndexOfChild( targetModel );
parentModel.Children.Insert( targetPaneIndex + 1, newLayoutDocumentPane );
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal;
parentModel.ReplaceChild( targetModel, newChildGroup );
newChildGroup.Children.Add( targetModel );
newChildGroup.Children.Add( newLayoutDocumentPane );
}
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockInside:
#region DropTargetType.DocumentPaneDockInside
{
var paneModel = targetModel as LayoutDocumentPane;
var sourceModel = floatingWindow.RootDocument;
int i = 0;
if( _tabIndex != -1 )
{
i = _tabIndex;
}
else
{
var previousIndex = 0;
var previousContainer = ( ( ILayoutPreviousContainer )sourceModel ).PreviousContainer;
if( object.ReferenceEquals( previousContainer, targetModel ) && ( sourceModel.PreviousContainerIndex != -1 ) )
{
previousIndex = sourceModel.PreviousContainerIndex;
}
i = previousIndex;
}
sourceModel.IsActive = false;
paneModel.Children.Insert( i, sourceModel );
sourceModel.IsActive = true;
}
break;
#endregion
internal DocumentPaneDropTarget(LayoutDocumentPaneControl paneControl, Rect detectionRect, DropTargetType type, int tabIndex)
: base(paneControl, detectionRect, type)
{
_targetPane = paneControl;
_tabIndex = tabIndex;
}
}
LayoutDocumentPaneControl _targetPane;
base.Drop( floatingWindow );
}
int _tabIndex = -1;
protected override void Drop( LayoutAnchorableFloatingWindow floatingWindow )
{
ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
protected override void Drop(LayoutDocumentFloatingWindow floatingWindow)
{
ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
switch( Type )
{
case DropTargetType.DocumentPaneDockBottom:
#region DropTargetType.DocumentPaneDockBottom
{
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
var newLayoutDocumentPane = new LayoutDocumentPane();
switch (Type)
if( parentModel == null )
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentContainer.ReplaceChild( targetModel, newParentModel );
newParentModel.Children.Add( targetModel as LayoutDocumentPane );
newParentModel.Children.Add( newLayoutDocumentPane );
}
else
{
case DropTargetType.DocumentPaneDockBottom:
#region DropTargetType.DocumentPaneDockBottom
{
var newLayoutDocumentPane = new LayoutDocumentPane(floatingWindow.RootDocument);
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
if (parentModel == null)
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical};
parentContainer.ReplaceChild(targetModel, newParentModel);
newParentModel.Children.Add(targetModel as LayoutDocumentPane);
newParentModel.Children.Add(newLayoutDocumentPane);
}
else
{
var manager = parentModel.Root.Manager;
if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical)
{
parentModel.Orientation = System.Windows.Controls.Orientation.Vertical;
int targetPaneIndex = parentModel.IndexOfChild(targetModel);
parentModel.Children.Insert(targetPaneIndex + 1, newLayoutDocumentPane);
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical;
parentModel.ReplaceChild(targetModel, newChildGroup);
newChildGroup.Children.Add(targetModel);
newChildGroup.Children.Add(newLayoutDocumentPane);
}
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockTop:
#region DropTargetType.DocumentPaneDockTop
{
var newLayoutDocumentPane = new LayoutDocumentPane(floatingWindow.RootDocument);
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
if (parentModel == null)
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentContainer.ReplaceChild(targetModel, newParentModel);
newParentModel.Children.Add(targetModel as LayoutDocumentPane);
newParentModel.Children.Insert(0, newLayoutDocumentPane);
}
else
{
var manager = parentModel.Root.Manager;
if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical)
{
parentModel.Orientation = System.Windows.Controls.Orientation.Vertical;
int targetPaneIndex = parentModel.IndexOfChild(targetModel);
parentModel.Children.Insert(targetPaneIndex, newLayoutDocumentPane);
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical;
parentModel.ReplaceChild(targetModel, newChildGroup);
newChildGroup.Children.Add(newLayoutDocumentPane);
newChildGroup.Children.Add(targetModel);
}
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockLeft:
#region DropTargetType.DocumentPaneDockLeft
{
var newLayoutDocumentPane = new LayoutDocumentPane(floatingWindow.RootDocument);
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
if (parentModel == null)
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentContainer.ReplaceChild(targetModel, newParentModel);
newParentModel.Children.Add(targetModel);
newParentModel.Children.Insert(0, newLayoutDocumentPane);
}
else
{
var manager = parentModel.Root.Manager;
if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal;
int targetPaneIndex = parentModel.IndexOfChild(targetModel);
parentModel.Children.Insert(targetPaneIndex, newLayoutDocumentPane);
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal;
parentModel.ReplaceChild(targetModel, newChildGroup);
newChildGroup.Children.Add(newLayoutDocumentPane);
newChildGroup.Children.Add(targetModel);
}
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockRight:
#region DropTargetType.DocumentPaneDockRight
{
var newLayoutDocumentPane = new LayoutDocumentPane(floatingWindow.RootDocument);
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
if (parentModel == null)
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentContainer.ReplaceChild(targetModel, newParentModel);
newParentModel.Children.Add(targetModel as LayoutDocumentPane);
newParentModel.Children.Add(newLayoutDocumentPane);
}
else
{
var manager = parentModel.Root.Manager;
if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal;
int targetPaneIndex = parentModel.IndexOfChild(targetModel);
parentModel.Children.Insert(targetPaneIndex + 1, newLayoutDocumentPane);
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal;
parentModel.ReplaceChild(targetModel, newChildGroup);
newChildGroup.Children.Add(targetModel);
newChildGroup.Children.Add(newLayoutDocumentPane);
}
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockInside:
#region DropTargetType.DocumentPaneDockInside
{
var paneModel = targetModel as LayoutDocumentPane;
var sourceModel = floatingWindow.RootDocument;
int i = 0;
if( _tabIndex != -1 )
{
i = _tabIndex;
}
else
{
var previousContainer = ((ILayoutPreviousContainer)sourceModel).PreviousContainer;
if( object.ReferenceEquals( previousContainer, targetModel ) && (sourceModel.PreviousContainerIndex != -1) )
{
i = sourceModel.PreviousContainerIndex;
}
}
sourceModel.IsActive = false;
paneModel.Children.Insert(i, sourceModel);
sourceModel.IsActive = true;
}
break;
#endregion
var manager = parentModel.Root.Manager;
if( !manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical )
{
parentModel.Orientation = System.Windows.Controls.Orientation.Vertical;
int targetPaneIndex = parentModel.IndexOfChild( targetModel );
parentModel.Children.Insert( targetPaneIndex + 1, newLayoutDocumentPane );
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical;
parentModel.ReplaceChild( targetModel, newChildGroup );
newChildGroup.Children.Add( targetModel );
newChildGroup.Children.Add( newLayoutDocumentPane );
}
}
foreach( var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType<LayoutAnchorable>().ToArray() )
newLayoutDocumentPane.Children.Add( cntToTransfer );
}
break;
#endregion
case DropTargetType.DocumentPaneDockTop:
#region DropTargetType.DocumentPaneDockTop
{
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
var newLayoutDocumentPane = new LayoutDocumentPane();
if( parentModel == null )
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentContainer.ReplaceChild( targetModel, newParentModel );
newParentModel.Children.Add( newLayoutDocumentPane );
newParentModel.Children.Add( targetModel as LayoutDocumentPane );
}
else
{
var manager = parentModel.Root.Manager;
if( !manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical )
{
parentModel.Orientation = System.Windows.Controls.Orientation.Vertical;
int targetPaneIndex = parentModel.IndexOfChild( targetModel );
parentModel.Children.Insert( targetPaneIndex, newLayoutDocumentPane );
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical;
parentModel.ReplaceChild( targetModel, newChildGroup );
newChildGroup.Children.Add( newLayoutDocumentPane );
newChildGroup.Children.Add( targetModel );
}
}
base.Drop(floatingWindow);
}
foreach( var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType<LayoutAnchorable>().ToArray() )
newLayoutDocumentPane.Children.Add( cntToTransfer );
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{
ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane;
}
break;
#endregion
case DropTargetType.DocumentPaneDockLeft:
#region DropTargetType.DocumentPaneDockLeft
{
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
var newLayoutDocumentPane = new LayoutDocumentPane();
switch (Type)
if( parentModel == null )
{
case DropTargetType.DocumentPaneDockBottom:
#region DropTargetType.DocumentPaneDockBottom
{
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
var newLayoutDocumentPane = new LayoutDocumentPane();
if (parentModel == null)
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentContainer.ReplaceChild(targetModel, newParentModel);
newParentModel.Children.Add(targetModel as LayoutDocumentPane);
newParentModel.Children.Add(newLayoutDocumentPane);
}
else
{
var manager = parentModel.Root.Manager;
if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical)
{
parentModel.Orientation = System.Windows.Controls.Orientation.Vertical;
int targetPaneIndex = parentModel.IndexOfChild(targetModel);
parentModel.Children.Insert(targetPaneIndex + 1, newLayoutDocumentPane);
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical;
parentModel.ReplaceChild(targetModel, newChildGroup);
newChildGroup.Children.Add(targetModel);
newChildGroup.Children.Add(newLayoutDocumentPane);
}
}
foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType<LayoutAnchorable>().ToArray())
newLayoutDocumentPane.Children.Add(cntToTransfer);
}
break;
#endregion
case DropTargetType.DocumentPaneDockTop:
#region DropTargetType.DocumentPaneDockTop
{
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
var newLayoutDocumentPane = new LayoutDocumentPane();
if (parentModel == null)
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical };
parentContainer.ReplaceChild(targetModel, newParentModel);
newParentModel.Children.Add(newLayoutDocumentPane);
newParentModel.Children.Add(targetModel as LayoutDocumentPane);
}
else
{
var manager = parentModel.Root.Manager;
if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Vertical)
{
parentModel.Orientation = System.Windows.Controls.Orientation.Vertical;
int targetPaneIndex = parentModel.IndexOfChild(targetModel);
parentModel.Children.Insert(targetPaneIndex, newLayoutDocumentPane);
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Vertical;
parentModel.ReplaceChild(targetModel, newChildGroup);
newChildGroup.Children.Add(newLayoutDocumentPane);
newChildGroup.Children.Add(targetModel);
}
}
foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType<LayoutAnchorable>().ToArray())
newLayoutDocumentPane.Children.Add(cntToTransfer);
}
break;
#endregion
case DropTargetType.DocumentPaneDockLeft:
#region DropTargetType.DocumentPaneDockLeft
{
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
var newLayoutDocumentPane = new LayoutDocumentPane();
if (parentModel == null)
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentContainer.ReplaceChild(targetModel, newParentModel);
newParentModel.Children.Add(newLayoutDocumentPane);
newParentModel.Children.Add(targetModel as LayoutDocumentPane);
}
else
{
var manager = parentModel.Root.Manager;
if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal;
int targetPaneIndex = parentModel.IndexOfChild(targetModel);
parentModel.Children.Insert(targetPaneIndex, newLayoutDocumentPane);
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal;
parentModel.ReplaceChild(targetModel, newChildGroup);
newChildGroup.Children.Add(newLayoutDocumentPane);
newChildGroup.Children.Add(targetModel);
}
}
foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType<LayoutAnchorable>().ToArray())
newLayoutDocumentPane.Children.Add(cntToTransfer);
}
break;
#endregion
case DropTargetType.DocumentPaneDockRight:
#region DropTargetType.DocumentPaneDockRight
{
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
var newLayoutDocumentPane = new LayoutDocumentPane();
if (parentModel == null)
{
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentContainer.ReplaceChild(targetModel, newParentModel);
newParentModel.Children.Add(targetModel as LayoutDocumentPane);
newParentModel.Children.Add(newLayoutDocumentPane);
}
else
{
var manager = parentModel.Root.Manager;
if (!manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal)
{
parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal;
int targetPaneIndex = parentModel.IndexOfChild(targetModel);
parentModel.Children.Insert(targetPaneIndex + 1, newLayoutDocumentPane);
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal;
parentModel.ReplaceChild(targetModel, newChildGroup);
newChildGroup.Children.Add(targetModel);
newChildGroup.Children.Add(newLayoutDocumentPane);
}
}
foreach (var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType<LayoutAnchorable>().ToArray())
newLayoutDocumentPane.Children.Add(cntToTransfer);
}
break;
#endregion
case DropTargetType.DocumentPaneDockInside:
#region DropTargetType.DocumentPaneDockInside
{
var paneModel = targetModel as LayoutDocumentPane;
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
bool checkPreviousContainer = true;
int i = 0;
if( _tabIndex != -1 )
{
i = _tabIndex;
checkPreviousContainer = false;
}
LayoutAnchorable anchorableToActivate = null;
foreach (var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType<LayoutAnchorable>().ToArray())
{
if( checkPreviousContainer )
{
var previousContainer = ((ILayoutPreviousContainer)anchorableToImport).PreviousContainer;
if( object.ReferenceEquals( previousContainer, targetModel ) && (anchorableToImport.PreviousContainerIndex != -1) )
{
i = anchorableToImport.PreviousContainerIndex;
}
checkPreviousContainer = false;
}
paneModel.Children.Insert(i, anchorableToImport);
i++;
anchorableToActivate = anchorableToImport;
}
anchorableToActivate.IsActive = true;
}
break;
#endregion
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentContainer.ReplaceChild( targetModel, newParentModel );
newParentModel.Children.Add( newLayoutDocumentPane );
newParentModel.Children.Add( targetModel as LayoutDocumentPane );
}
else
{
var manager = parentModel.Root.Manager;
if( !manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal;
int targetPaneIndex = parentModel.IndexOfChild( targetModel );
parentModel.Children.Insert( targetPaneIndex, newLayoutDocumentPane );
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal;
parentModel.ReplaceChild( targetModel, newChildGroup );
newChildGroup.Children.Add( newLayoutDocumentPane );
newChildGroup.Children.Add( targetModel );
}
}
foreach( var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType<LayoutAnchorable>().ToArray() )
newLayoutDocumentPane.Children.Add( cntToTransfer );
base.Drop(floatingWindow);
}
}
break;
#endregion
case DropTargetType.DocumentPaneDockRight:
#region DropTargetType.DocumentPaneDockRight
{
var parentModel = targetModel.Parent as LayoutDocumentPaneGroup;
var newLayoutDocumentPane = new LayoutDocumentPane();
public override System.Windows.Media.Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel)
{
switch (Type)
if( parentModel == null )
{
case DropTargetType.DocumentPaneDockInside:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
if (_tabIndex == -1)
{
return new RectangleGeometry(targetScreenRect);
}
else
{
var translatedDetectionRect = new Rect(DetectionRects[0].TopLeft, DetectionRects[0].BottomRight);
translatedDetectionRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
var pathFigure = new PathFigure();
pathFigure.StartPoint = targetScreenRect.BottomRight;
pathFigure.Segments.Add(new LineSegment() { Point = new Point(targetScreenRect.Right, translatedDetectionRect.Bottom) });
pathFigure.Segments.Add(new LineSegment() { Point = translatedDetectionRect.BottomRight });
pathFigure.Segments.Add(new LineSegment() { Point = translatedDetectionRect.TopRight });
pathFigure.Segments.Add(new LineSegment() { Point = translatedDetectionRect.TopLeft });
pathFigure.Segments.Add(new LineSegment() { Point = translatedDetectionRect.BottomLeft });
pathFigure.Segments.Add(new LineSegment() { Point = new Point(targetScreenRect.Left, translatedDetectionRect.Bottom) });
pathFigure.Segments.Add(new LineSegment() { Point = targetScreenRect.BottomLeft });
pathFigure.IsClosed = true;
pathFigure.IsFilled = true;
pathFigure.Freeze();
return new PathGeometry(new PathFigure[] { pathFigure });
}
}
case DropTargetType.DocumentPaneDockBottom:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Offset(0.0, targetScreenRect.Height / 2.0);
targetScreenRect.Height /= 2.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.DocumentPaneDockTop:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Height /= 2.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.DocumentPaneDockLeft:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Width /= 2.0;
return new RectangleGeometry(targetScreenRect);
}
case DropTargetType.DocumentPaneDockRight:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
targetScreenRect.Offset(targetScreenRect.Width / 2.0, 0.0);
targetScreenRect.Width /= 2.0;
return new RectangleGeometry(targetScreenRect);
}
var parentContainer = targetModel.Parent as ILayoutContainer;
var newParentModel = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Horizontal };
parentContainer.ReplaceChild( targetModel, newParentModel );
newParentModel.Children.Add( targetModel as LayoutDocumentPane );
newParentModel.Children.Add( newLayoutDocumentPane );
}
else
{
var manager = parentModel.Root.Manager;
if( !manager.AllowMixedOrientation || parentModel.Orientation == System.Windows.Controls.Orientation.Horizontal )
{
parentModel.Orientation = System.Windows.Controls.Orientation.Horizontal;
int targetPaneIndex = parentModel.IndexOfChild( targetModel );
parentModel.Children.Insert( targetPaneIndex + 1, newLayoutDocumentPane );
}
else
{
LayoutDocumentPaneGroup newChildGroup = new LayoutDocumentPaneGroup();
newChildGroup.Orientation = System.Windows.Controls.Orientation.Horizontal;
parentModel.ReplaceChild( targetModel, newChildGroup );
newChildGroup.Children.Add( targetModel );
newChildGroup.Children.Add( newLayoutDocumentPane );
}
}
foreach( var cntToTransfer in floatingWindow.RootPanel.Descendents().OfType<LayoutAnchorable>().ToArray() )
newLayoutDocumentPane.Children.Add( cntToTransfer );
}
break;
#endregion
case DropTargetType.DocumentPaneDockInside:
#region DropTargetType.DocumentPaneDockInside
{
var paneModel = targetModel as LayoutDocumentPane;
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
bool checkPreviousContainer = true;
int i = 0;
if( _tabIndex != -1 )
{
i = _tabIndex;
checkPreviousContainer = false;
}
LayoutAnchorable anchorableToActivate = null;
foreach( var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType<LayoutAnchorable>().ToArray() )
{
if( checkPreviousContainer )
{
var previousContainer = ( ( ILayoutPreviousContainer )anchorableToImport ).PreviousContainer;
if( object.ReferenceEquals( previousContainer, targetModel ) && ( anchorableToImport.PreviousContainerIndex != -1 ) )
{
i = anchorableToImport.PreviousContainerIndex;
}
checkPreviousContainer = false;
}
anchorableToImport.SetCanCloseInternal( true );
paneModel.Children.Insert( i, anchorableToImport );
i++;
anchorableToActivate = anchorableToImport;
}
return null;
}
anchorableToActivate.IsActive = true;
}
break;
#endregion
}
base.Drop( floatingWindow );
}
public override System.Windows.Media.Geometry GetPreviewPath( OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel )
{
switch( Type )
{
case DropTargetType.DocumentPaneDockInside:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
if( _tabIndex == -1 )
{
return new RectangleGeometry( targetScreenRect );
}
else
{
var translatedDetectionRect = new Rect( DetectionRects[ 0 ].TopLeft, DetectionRects[ 0 ].BottomRight );
translatedDetectionRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
var pathFigure = new PathFigure();
pathFigure.StartPoint = targetScreenRect.BottomRight;
pathFigure.Segments.Add( new LineSegment() { Point = new Point( targetScreenRect.Right, translatedDetectionRect.Bottom ) } );
pathFigure.Segments.Add( new LineSegment() { Point = translatedDetectionRect.BottomRight } );
pathFigure.Segments.Add( new LineSegment() { Point = translatedDetectionRect.TopRight } );
pathFigure.Segments.Add( new LineSegment() { Point = translatedDetectionRect.TopLeft } );
pathFigure.Segments.Add( new LineSegment() { Point = translatedDetectionRect.BottomLeft } );
pathFigure.Segments.Add( new LineSegment() { Point = new Point( targetScreenRect.Left, translatedDetectionRect.Bottom ) } );
pathFigure.Segments.Add( new LineSegment() { Point = targetScreenRect.BottomLeft } );
pathFigure.IsClosed = true;
pathFigure.IsFilled = true;
pathFigure.Freeze();
return new PathGeometry( new PathFigure[] { pathFigure } );
}
}
case DropTargetType.DocumentPaneDockBottom:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Offset( 0.0, targetScreenRect.Height / 2.0 );
targetScreenRect.Height /= 2.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.DocumentPaneDockTop:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Height /= 2.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.DocumentPaneDockLeft:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Width /= 2.0;
return new RectangleGeometry( targetScreenRect );
}
case DropTargetType.DocumentPaneDockRight:
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
targetScreenRect.Offset( targetScreenRect.Width / 2.0, 0.0 );
targetScreenRect.Width /= 2.0;
return new RectangleGeometry( targetScreenRect );
}
}
return null;
}
#endregion
}
}

145
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneGroupDropTarget.cs

@ -14,92 +14,101 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Diagnostics;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal class DocumentPaneGroupDropTarget : DropTarget<LayoutDocumentPaneGroupControl>
internal class DocumentPaneGroupDropTarget : DropTarget<LayoutDocumentPaneGroupControl>
{
#region Constructors
internal DocumentPaneGroupDropTarget( LayoutDocumentPaneGroupControl paneControl, Rect detectionRect, DropTargetType type )
: base( paneControl, detectionRect, type )
{
internal DocumentPaneGroupDropTarget(LayoutDocumentPaneGroupControl paneControl, Rect detectionRect, DropTargetType type)
: base(paneControl, detectionRect, type)
{
_targetPane = paneControl;
}
_targetPane = paneControl;
}
LayoutDocumentPaneGroupControl _targetPane;
#endregion
protected override void Drop(LayoutDocumentFloatingWindow floatingWindow)
{
ILayoutPane targetModel = _targetPane.Model as ILayoutPane;
#region Members
switch (Type)
{
case DropTargetType.DocumentPaneGroupDockInside:
#region DropTargetType.DocumentPaneGroupDockInside
{
var paneGroupModel = targetModel as LayoutDocumentPaneGroup;
var paneModel = paneGroupModel.Children[0] as LayoutDocumentPane;
var sourceModel = floatingWindow.RootDocument;
paneModel.Children.Insert(0, sourceModel);
}
break;
#endregion
}
base.Drop(floatingWindow);
}
private LayoutDocumentPaneGroupControl _targetPane;
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{
ILayoutPane targetModel = _targetPane.Model as ILayoutPane;
#endregion
switch (Type)
{
case DropTargetType.DocumentPaneGroupDockInside:
#region DropTargetType.DocumentPaneGroupDockInside
{
var paneGroupModel = targetModel as LayoutDocumentPaneGroup;
var paneModel = paneGroupModel.Children[0] as LayoutDocumentPane;
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
int i = 0;
foreach (var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType<LayoutAnchorable>().ToArray())
{
paneModel.Children.Insert(i, anchorableToImport);
i++;
}
}
break;
#endregion
}
#region Overrides
base.Drop(floatingWindow);
}
protected override void Drop( LayoutDocumentFloatingWindow floatingWindow )
{
ILayoutPane targetModel = _targetPane.Model as ILayoutPane;
switch( Type )
{
case DropTargetType.DocumentPaneGroupDockInside:
#region DropTargetType.DocumentPaneGroupDockInside
{
var paneGroupModel = targetModel as LayoutDocumentPaneGroup;
var paneModel = paneGroupModel.Children[ 0 ] as LayoutDocumentPane;
var sourceModel = floatingWindow.RootDocument;
paneModel.Children.Insert( 0, sourceModel );
}
break;
#endregion
}
base.Drop( floatingWindow );
}
public override System.Windows.Media.Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel)
{
switch (Type)
protected override void Drop( LayoutAnchorableFloatingWindow floatingWindow )
{
ILayoutPane targetModel = _targetPane.Model as ILayoutPane;
switch( Type )
{
case DropTargetType.DocumentPaneGroupDockInside:
#region DropTargetType.DocumentPaneGroupDockInside
{
var paneGroupModel = targetModel as LayoutDocumentPaneGroup;
var paneModel = paneGroupModel.Children[ 0 ] as LayoutDocumentPane;
var layoutAnchorablePaneGroup = floatingWindow.RootPanel as LayoutAnchorablePaneGroup;
int i = 0;
foreach( var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType<LayoutAnchorable>().ToArray() )
{
case DropTargetType.DocumentPaneGroupDockInside:
#region DropTargetType.DocumentPaneGroupDockInside
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top);
return new RectangleGeometry(targetScreenRect);
}
#endregion
anchorableToImport.SetCanCloseInternal( true );
paneModel.Children.Insert( i, anchorableToImport );
i++;
}
}
break;
#endregion
}
return null;
}
base.Drop( floatingWindow );
}
public override System.Windows.Media.Geometry GetPreviewPath( OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel )
{
switch( Type )
{
case DropTargetType.DocumentPaneGroupDockInside:
#region DropTargetType.DocumentPaneGroupDockInside
{
var targetScreenRect = TargetElement.GetScreenArea();
targetScreenRect.Offset( -overlayWindow.Left, -overlayWindow.Top );
return new RectangleGeometry( targetScreenRect );
}
#endregion
}
return null;
}
#endregion
}
}

131
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DocumentPaneTabPanel.cs

@ -15,92 +15,97 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class DocumentPaneTabPanel : Panel
public class DocumentPaneTabPanel : Panel
{
#region Constructors
public DocumentPaneTabPanel()
{
public DocumentPaneTabPanel()
{
FlowDirection = System.Windows.FlowDirection.LeftToRight;
}
this.FlowDirection = System.Windows.FlowDirection.LeftToRight;
}
protected override Size MeasureOverride(Size availableSize)
{
var visibleChildren = Children.Cast<UIElement>().Where(ch => ch.Visibility != System.Windows.Visibility.Collapsed);
#endregion
Size desideredSize = new Size();
foreach (FrameworkElement child in Children)
{
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
desideredSize.Width += child.DesiredSize.Width;
#region Overrides
desideredSize.Height = Math.Max(desideredSize.Height, child.DesiredSize.Height);
}
protected override Size MeasureOverride( Size availableSize )
{
var visibleChildren = Children.Cast<UIElement>().Where( ch => ch.Visibility != System.Windows.Visibility.Collapsed );
return new Size(Math.Min(desideredSize.Width, availableSize.Width), desideredSize.Height);
}
Size desideredSize = new Size();
foreach( FrameworkElement child in Children )
{
child.Measure( new Size( double.PositiveInfinity, double.PositiveInfinity ) );
desideredSize.Width += child.DesiredSize.Width;
desideredSize.Height = Math.Max( desideredSize.Height, child.DesiredSize.Height );
}
return new Size( Math.Min( desideredSize.Width, availableSize.Width ), desideredSize.Height );
}
protected override Size ArrangeOverride(Size finalSize)
protected override Size ArrangeOverride( Size finalSize )
{
var visibleChildren = Children.Cast<UIElement>().Where( ch => ch.Visibility != System.Windows.Visibility.Collapsed );
var offset = 0.0;
var skipAllOthers = false;
foreach( TabItem doc in visibleChildren )
{
var layoutContent = doc.Content as LayoutContent;
if( skipAllOthers || offset + doc.DesiredSize.Width > finalSize.Width )
{
var visibleChildren = Children.Cast<UIElement>().Where( ch => ch.Visibility != System.Windows.Visibility.Collapsed );
var offset = 0.0;
var skipAllOthers = false;
foreach( TabItem doc in visibleChildren )
if( layoutContent.IsSelected && !doc.IsVisible )
{
var layoutContent = doc.Content as LayoutContent;
if( skipAllOthers || offset + doc.DesiredSize.Width > finalSize.Width )
{
if( layoutContent.IsSelected && !doc.IsVisible )
{
var parentContainer = layoutContent.Parent as ILayoutContainer;
var parentSelector = layoutContent.Parent as ILayoutContentSelector;
var parentPane = layoutContent.Parent as ILayoutPane;
int contentIndex = parentSelector.IndexOf( layoutContent );
if( contentIndex > 0 &&
parentContainer.ChildrenCount > 1 )
{
parentPane.MoveChild( contentIndex, 0 );
parentSelector.SelectedContentIndex = 0;
return ArrangeOverride( finalSize );
}
}
doc.Visibility = System.Windows.Visibility.Hidden;
skipAllOthers = true;
}
else
var parentContainer = layoutContent.Parent as ILayoutContainer;
var parentSelector = layoutContent.Parent as ILayoutContentSelector;
var parentPane = layoutContent.Parent as ILayoutPane;
int contentIndex = parentSelector.IndexOf( layoutContent );
if( contentIndex > 0 &&
parentContainer.ChildrenCount > 1 )
{
doc.Visibility = System.Windows.Visibility.Visible;
doc.Arrange( new Rect( offset, 0.0, doc.DesiredSize.Width, finalSize.Height ) );
offset += doc.ActualWidth + doc.Margin.Left + doc.Margin.Right;
parentPane.MoveChild( contentIndex, 0 );
parentSelector.SelectedContentIndex = 0;
return ArrangeOverride( finalSize );
}
}
return finalSize;
doc.Visibility = System.Windows.Visibility.Hidden;
skipAllOthers = true;
}
else
{
doc.Visibility = System.Windows.Visibility.Visible;
doc.Arrange( new Rect( offset, 0.0, doc.DesiredSize.Width, finalSize.Height ) );
offset += doc.ActualWidth + doc.Margin.Left + doc.Margin.Right;
}
}
return finalSize;
}
protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
{
//if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed &&
// LayoutDocumentTabItem.IsDraggingItem())
//{
// var contentModel = LayoutDocumentTabItem.GetDraggingItem().Model;
// var manager = contentModel.Root.Manager;
// LayoutDocumentTabItem.ResetDraggingItem();
// System.Diagnostics.Trace.WriteLine("OnMouseLeave()");
protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e )
{
//if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed &&
// LayoutDocumentTabItem.IsDraggingItem())
//{
// var contentModel = LayoutDocumentTabItem.GetDraggingItem().Model;
// var manager = contentModel.Root.Manager;
// LayoutDocumentTabItem.ResetDraggingItem();
// System.Diagnostics.Trace.WriteLine("OnMouseLeave()");
// manager.StartDraggingFloatingWindowForContent(contentModel);
//}
// manager.StartDraggingFloatingWindowForContent(contentModel);
//}
base.OnMouseLeave(e);
}
base.OnMouseLeave( e );
}
#endregion
}
}

297
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DragService.cs

@ -14,177 +14,188 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows;
using System.Diagnostics;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
class DragService
internal class DragService
{
#region Members
private DockingManager _manager;
private LayoutFloatingWindowControl _floatingWindow;
private List<IOverlayWindowHost> _overlayWindowHosts = new List<IOverlayWindowHost>();
private IOverlayWindowHost _currentHost;
private IOverlayWindow _currentWindow;
private List<IDropArea> _currentWindowAreas = new List<IDropArea>();
private IDropTarget _currentDropTarget;
#endregion
#region Public Methods
public DragService( LayoutFloatingWindowControl floatingWindow )
{
DockingManager _manager;
LayoutFloatingWindowControl _floatingWindow;
_floatingWindow = floatingWindow;
_manager = floatingWindow.Model.Root.Manager;
public DragService(LayoutFloatingWindowControl floatingWindow)
{
_floatingWindow = floatingWindow;
_manager = floatingWindow.Model.Root.Manager;
GetOverlayWindowHosts();
}
public void UpdateMouseLocation( Point dragPosition )
{
var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;
var newHost = _overlayWindowHosts.FirstOrDefault( oh => oh.HitTest( dragPosition ) );
GetOverlayWindowHosts();
if( _currentHost != null || _currentHost != newHost )
{
//is mouse still inside current overlay window host?
if( ( _currentHost != null && !_currentHost.HitTest( dragPosition ) ) ||
_currentHost != newHost )
{
//esit drop target
if( _currentDropTarget != null )
_currentWindow.DragLeave( _currentDropTarget );
_currentDropTarget = null;
//exit area
_currentWindowAreas.ForEach( a =>
_currentWindow.DragLeave( a ) );
_currentWindowAreas.Clear();
//hide current overlay window
if( _currentWindow != null )
_currentWindow.DragLeave( _floatingWindow );
if( _currentHost != null )
_currentHost.HideOverlayWindow();
_currentHost = null;
}
List<IOverlayWindowHost> _overlayWindowHosts = new List<IOverlayWindowHost>();
void GetOverlayWindowHosts()
if( _currentHost != newHost )
{
_currentHost = newHost;
_currentWindow = _currentHost.ShowOverlayWindow( _floatingWindow );
_currentWindow.DragEnter( _floatingWindow );
}
}
if( _currentHost == null )
return;
if( _currentDropTarget != null &&
!_currentDropTarget.HitTest( dragPosition ) )
{
_currentWindow.DragLeave( _currentDropTarget );
_currentDropTarget = null;
}
List<IDropArea> areasToRemove = new List<IDropArea>();
_currentWindowAreas.ForEach( a =>
{
//is mouse still inside this area?
if( !a.DetectionRect.Contains( dragPosition ) )
{
_overlayWindowHosts.AddRange(_manager.GetFloatingWindowsByZOrder().OfType<LayoutAnchorableFloatingWindowControl>().Where(fw => fw != _floatingWindow && fw.IsVisible));
_overlayWindowHosts.Add(_manager);
_currentWindow.DragLeave( a );
areasToRemove.Add( a );
}
} );
areasToRemove.ForEach( a =>
_currentWindowAreas.Remove( a ) );
var areasToAdd =
_currentHost.GetDropAreas( _floatingWindow ).Where( cw => !_currentWindowAreas.Contains( cw ) && cw.DetectionRect.Contains( dragPosition ) ).ToList();
_currentWindowAreas.AddRange( areasToAdd );
IOverlayWindowHost _currentHost;
IOverlayWindow _currentWindow;
List<IDropArea> _currentWindowAreas = new List<IDropArea>();
IDropTarget _currentDropTarget;
areasToAdd.ForEach( a =>
_currentWindow.DragEnter( a ) );
public void UpdateMouseLocation(Point dragPosition)
if( _currentDropTarget == null )
{
_currentWindowAreas.ForEach( wa =>
{
var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;
var newHost = _overlayWindowHosts.FirstOrDefault(oh => oh.HitTest(dragPosition));
if (_currentHost != null || _currentHost != newHost)
{
//is mouse still inside current overlay window host?
if ((_currentHost != null && !_currentHost.HitTest(dragPosition)) ||
_currentHost != newHost)
{
//esit drop target
if (_currentDropTarget != null)
_currentWindow.DragLeave(_currentDropTarget);
_currentDropTarget = null;
//exit area
_currentWindowAreas.ForEach(a =>
_currentWindow.DragLeave(a));
_currentWindowAreas.Clear();
//hide current overlay window
if (_currentWindow != null)
_currentWindow.DragLeave(_floatingWindow);
if (_currentHost != null)
_currentHost.HideOverlayWindow();
_currentHost = null;
}
if (_currentHost != newHost)
{
_currentHost = newHost;
_currentWindow = _currentHost.ShowOverlayWindow(_floatingWindow);
_currentWindow.DragEnter(_floatingWindow);
}
}
if (_currentHost == null)
return;
if (_currentDropTarget != null &&
!_currentDropTarget.HitTest(dragPosition))
{
_currentWindow.DragLeave(_currentDropTarget);
_currentDropTarget = null;
}
List<IDropArea> areasToRemove = new List<IDropArea>();
_currentWindowAreas.ForEach(a =>
{
//is mouse still inside this area?
if (!a.DetectionRect.Contains(dragPosition))
{
_currentWindow.DragLeave(a);
areasToRemove.Add(a);
}
});
areasToRemove.ForEach(a =>
_currentWindowAreas.Remove(a));
var areasToAdd =
_currentHost.GetDropAreas(_floatingWindow).Where(cw => !_currentWindowAreas.Contains(cw) && cw.DetectionRect.Contains(dragPosition)).ToList();
_currentWindowAreas.AddRange(areasToAdd);
areasToAdd.ForEach(a =>
_currentWindow.DragEnter(a));
if (_currentDropTarget == null)
{
_currentWindowAreas.ForEach(wa =>
{
if (_currentDropTarget != null)
return;
_currentDropTarget = _currentWindow.GetTargets().FirstOrDefault(dt => dt.HitTest(dragPosition));
if (_currentDropTarget != null)
{
_currentWindow.DragEnter(_currentDropTarget);
return;
}
});
}
if( _currentDropTarget != null )
return;
_currentDropTarget = _currentWindow.GetTargets().FirstOrDefault( dt => dt.HitTest( dragPosition ) );
if( _currentDropTarget != null )
{
_currentWindow.DragEnter( _currentDropTarget );
return;
}
} );
}
}
}
public void Drop(Point dropLocation, out bool dropHandled)
{
dropHandled = false;
public void Drop( Point dropLocation, out bool dropHandled )
{
dropHandled = false;
UpdateMouseLocation(dropLocation);
UpdateMouseLocation( dropLocation );
var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;
var root = floatingWindowModel.Root;
var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;
var root = floatingWindowModel.Root;
if (_currentHost != null)
_currentHost.HideOverlayWindow();
if( _currentHost != null )
_currentHost.HideOverlayWindow();
if (_currentDropTarget != null)
{
_currentWindow.DragDrop(_currentDropTarget);
root.CollectGarbage();
dropHandled = true;
}
if( _currentDropTarget != null )
{
_currentWindow.DragDrop( _currentDropTarget );
root.CollectGarbage();
dropHandled = true;
}
_currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));
_currentWindowAreas.ForEach( a => _currentWindow.DragLeave( a ) );
if (_currentDropTarget != null)
_currentWindow.DragLeave(_currentDropTarget);
if (_currentWindow != null)
_currentWindow.DragLeave(_floatingWindow);
_currentWindow = null;
if( _currentDropTarget != null )
_currentWindow.DragLeave( _currentDropTarget );
if( _currentWindow != null )
_currentWindow.DragLeave( _floatingWindow );
_currentWindow = null;
_currentHost = null;
}
_currentHost = null;
}
internal void Abort()
{
var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;
_currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));
if (_currentDropTarget != null)
_currentWindow.DragLeave(_currentDropTarget);
if (_currentWindow != null)
_currentWindow.DragLeave(_floatingWindow);
_currentWindow = null;
if (_currentHost != null)
_currentHost.HideOverlayWindow();
_currentHost = null;
}
#endregion
#region Internal Methods
internal void Abort()
{
var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;
_currentWindowAreas.ForEach( a => _currentWindow.DragLeave( a ) );
if( _currentDropTarget != null )
_currentWindow.DragLeave( _currentDropTarget );
if( _currentWindow != null )
_currentWindow.DragLeave( _floatingWindow );
_currentWindow = null;
if( _currentHost != null )
_currentHost.HideOverlayWindow();
_currentHost = null;
}
#endregion
#region Private Methods
private void GetOverlayWindowHosts()
{
_overlayWindowHosts.AddRange( _manager.GetFloatingWindowsByZOrder().OfType<LayoutAnchorableFloatingWindowControl>().Where( fw => fw != _floatingWindow && fw.IsVisible ) );
_overlayWindowHosts.Add( _manager );
}
#endregion
}
}

100
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropArea.cs

@ -14,64 +14,78 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
public enum DropAreaType
public enum DropAreaType
{
DockingManager,
DocumentPane,
DocumentPaneGroup,
AnchorablePane,
}
public interface IDropArea
{
Rect DetectionRect
{
DockingManager,
get;
}
DropAreaType Type
{
get;
}
}
DocumentPane,
public class DropArea<T> : IDropArea where T : FrameworkElement
{
#region Members
DocumentPaneGroup,
private Rect _detectionRect;
private DropAreaType _type;
private T _element;
AnchorablePane,
#endregion
#region Constructors
internal DropArea( T areaElement, DropAreaType type )
{
_element = areaElement;
_detectionRect = areaElement.GetScreenArea();
_type = type;
}
#endregion
public interface IDropArea
#region Properties
public Rect DetectionRect
{
Rect DetectionRect { get; }
DropAreaType Type { get; }
}
get
{
return _detectionRect;
}
}
public class DropArea<T> : IDropArea where T : FrameworkElement
public DropAreaType Type
{
internal DropArea(T areaElement, DropAreaType type)
{
_element = areaElement;
_detectionRect = areaElement.GetScreenArea();
_type = type;
}
Rect _detectionRect;
public Rect DetectionRect
{
get { return _detectionRect; }
}
DropAreaType _type;
public DropAreaType Type
{
get { return _type; }
}
T _element;
public T AreaElement
{
get
{
return _element;
}
}
get
{
return _type;
}
}
public T AreaElement
{
get
{
return _element;
}
}
#endregion
}
}

227
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropDownButton.cs

@ -14,119 +14,136 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls.Primitives;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Diagnostics;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class DropDownButton : ToggleButton
public class DropDownButton : ToggleButton
{
#region Constructors
public DropDownButton()
{
public DropDownButton()
{
this.Unloaded += new RoutedEventHandler(DropDownButton_Unloaded);
}
#region DropDownContextMenu
/// <summary>
/// DropDownContextMenu Dependency Property
/// </summary>
public static readonly DependencyProperty DropDownContextMenuProperty =
DependencyProperty.Register("DropDownContextMenu", typeof(ContextMenu), typeof(DropDownButton),
new FrameworkPropertyMetadata((ContextMenu)null,
new PropertyChangedCallback(OnDropDownContextMenuChanged)));
/// <summary>
/// Gets or sets the DropDownContextMenu property. This dependency property
/// indicates drop down menu to show up when user click on an anchorable menu pin.
/// </summary>
public ContextMenu DropDownContextMenu
{
get { return (ContextMenu)GetValue(DropDownContextMenuProperty); }
set { SetValue(DropDownContextMenuProperty, value); }
}
/// <summary>
/// Handles changes to the DropDownContextMenu property.
/// </summary>
private static void OnDropDownContextMenuChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((DropDownButton)d).OnDropDownContextMenuChanged(e);
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the DropDownContextMenu property.
/// </summary>
protected virtual void OnDropDownContextMenuChanged(DependencyPropertyChangedEventArgs e)
{
var oldContextMenu = e.OldValue as ContextMenu;
if (oldContextMenu != null && IsChecked.GetValueOrDefault())
oldContextMenu.Closed -= new RoutedEventHandler(OnContextMenuClosed);
}
#endregion
#region DropDownContextMenuDataContext
/// <summary>
/// DropDownContextMenuDataContext Dependency Property
/// </summary>
public static readonly DependencyProperty DropDownContextMenuDataContextProperty =
DependencyProperty.Register("DropDownContextMenuDataContext", typeof(object), typeof(DropDownButton),
new FrameworkPropertyMetadata((object)null));
/// <summary>
/// Gets or sets the DropDownContextMenuDataContext property. This dependency property
/// indicates data context to set for drop down context menu.
/// </summary>
public object DropDownContextMenuDataContext
{
get { return (object)GetValue(DropDownContextMenuDataContextProperty); }
set { SetValue(DropDownContextMenuDataContextProperty, value); }
}
#endregion
protected override void OnClick()
{
if (DropDownContextMenu != null)
{
//IsChecked = true;
DropDownContextMenu.PlacementTarget = this;
DropDownContextMenu.Placement = PlacementMode.Bottom;
DropDownContextMenu.DataContext = DropDownContextMenuDataContext;
DropDownContextMenu.Closed += new RoutedEventHandler(OnContextMenuClosed);
DropDownContextMenu.IsOpen = true;
}
base.OnClick();
}
void OnContextMenuClosed(object sender, RoutedEventArgs e)
{
//Debug.Assert(IsChecked.GetValueOrDefault());
var ctxMenu = sender as ContextMenu;
ctxMenu.Closed -= new RoutedEventHandler(OnContextMenuClosed);
IsChecked = false;
}
void DropDownButton_Unloaded(object sender, RoutedEventArgs e)
{
// When changing theme, Unloaded event is called, erasing the DropDownContextMenu.
// Prevent this on theme changes.
if( this.IsLoaded )
{
DropDownContextMenu = null;
}
}
this.Unloaded += new RoutedEventHandler( DropDownButton_Unloaded );
}
#endregion
#region Properties
#region DropDownContextMenu
/// <summary>
/// DropDownContextMenu Dependency Property
/// </summary>
public static readonly DependencyProperty DropDownContextMenuProperty = DependencyProperty.Register( "DropDownContextMenu", typeof( ContextMenu ), typeof( DropDownButton ),
new FrameworkPropertyMetadata( ( ContextMenu )null, new PropertyChangedCallback( OnDropDownContextMenuChanged ) ) );
/// <summary>
/// Gets or sets the DropDownContextMenu property. This dependency property
/// indicates drop down menu to show up when user click on an anchorable menu pin.
/// </summary>
public ContextMenu DropDownContextMenu
{
get
{
return ( ContextMenu )GetValue( DropDownContextMenuProperty );
}
set
{
SetValue( DropDownContextMenuProperty, value );
}
}
/// <summary>
/// Handles changes to the DropDownContextMenu property.
/// </summary>
private static void OnDropDownContextMenuChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( DropDownButton )d ).OnDropDownContextMenuChanged( e );
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the DropDownContextMenu property.
/// </summary>
protected virtual void OnDropDownContextMenuChanged( DependencyPropertyChangedEventArgs e )
{
var oldContextMenu = e.OldValue as ContextMenu;
if( oldContextMenu != null && IsChecked.GetValueOrDefault() )
oldContextMenu.Closed -= new RoutedEventHandler( OnContextMenuClosed );
}
#endregion
#region DropDownContextMenuDataContext
/// <summary>
/// DropDownContextMenuDataContext Dependency Property
/// </summary>
public static readonly DependencyProperty DropDownContextMenuDataContextProperty = DependencyProperty.Register( "DropDownContextMenuDataContext", typeof( object ), typeof( DropDownButton ),
new FrameworkPropertyMetadata( ( object )null ) );
/// <summary>
/// Gets or sets the DropDownContextMenuDataContext property. This dependency property
/// indicates data context to set for drop down context menu.
/// </summary>
public object DropDownContextMenuDataContext
{
get
{
return ( object )GetValue( DropDownContextMenuDataContextProperty );
}
set
{
SetValue( DropDownContextMenuDataContextProperty, value );
}
}
#endregion
#endregion
#region Overrides
protected override void OnClick()
{
if( DropDownContextMenu != null )
{
//IsChecked = true;
DropDownContextMenu.PlacementTarget = this;
DropDownContextMenu.Placement = PlacementMode.Bottom;
DropDownContextMenu.DataContext = DropDownContextMenuDataContext;
DropDownContextMenu.Closed += new RoutedEventHandler( OnContextMenuClosed );
DropDownContextMenu.IsOpen = true;
}
base.OnClick();
}
#endregion
#region Private Methods
private void OnContextMenuClosed( object sender, RoutedEventArgs e )
{
//Debug.Assert(IsChecked.GetValueOrDefault());
var ctxMenu = sender as ContextMenu;
ctxMenu.Closed -= new RoutedEventHandler( OnContextMenuClosed );
IsChecked = false;
}
private void DropDownButton_Unloaded( object sender, RoutedEventArgs e )
{
// When changing theme, Unloaded event is called, erasing the DropDownContextMenu.
// Prevent this on theme changes.
if( this.IsLoaded )
{
DropDownContextMenu = null;
}
}
#endregion
}
}

161
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropDownControlArea.cs

@ -14,105 +14,116 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using System.Windows.Input;
using System.Diagnostics;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class DropDownControlArea : UserControl
public class DropDownControlArea : UserControl
{
#region Constructors
//static DropDownControlArea()
//{
// //IsHitTestVisibleProperty.OverrideMetadata(typeof(DropDownControlArea), new FrameworkPropertyMetadata(true));
//}
public DropDownControlArea()
{
//static DropDownControlArea()
//{
// //IsHitTestVisibleProperty.OverrideMetadata(typeof(DropDownControlArea), new FrameworkPropertyMetadata(true));
//}
}
public DropDownControlArea()
{
#endregion
}
#region Properties
#region DropDownContextMenu
#region DropDownContextMenu
/// <summary>
/// DropDownContextMenu Dependency Property
/// </summary>
public static readonly DependencyProperty DropDownContextMenuProperty =
DependencyProperty.Register("DropDownContextMenu", typeof(ContextMenu), typeof(DropDownControlArea),
new FrameworkPropertyMetadata((ContextMenu)null));
/// <summary>
/// DropDownContextMenu Dependency Property
/// </summary>
public static readonly DependencyProperty DropDownContextMenuProperty = DependencyProperty.Register( "DropDownContextMenu", typeof( ContextMenu ), typeof( DropDownControlArea ),
new FrameworkPropertyMetadata( ( ContextMenu )null ) );
/// <summary>
/// Gets or sets the DropDownContextMenu property. This dependency property
/// indicates context menu to show when a right click is detected over the area occpied by the control.
/// </summary>
public ContextMenu DropDownContextMenu
{
get { return (ContextMenu)GetValue(DropDownContextMenuProperty); }
set { SetValue(DropDownContextMenuProperty, value); }
}
/// <summary>
/// Gets or sets the DropDownContextMenu property. This dependency property
/// indicates context menu to show when a right click is detected over the area occpied by the control.
/// </summary>
public ContextMenu DropDownContextMenu
{
get
{
return ( ContextMenu )GetValue( DropDownContextMenuProperty );
}
set
{
SetValue( DropDownContextMenuProperty, value );
}
}
#endregion
#endregion
#region DropDownContextMenuDataContext
#region DropDownContextMenuDataContext
/// <summary>
/// DropDownContextMenuDataContext Dependency Property
/// </summary>
public static readonly DependencyProperty DropDownContextMenuDataContextProperty =
DependencyProperty.Register("DropDownContextMenuDataContext", typeof(object), typeof(DropDownControlArea),
new FrameworkPropertyMetadata((object)null));
/// <summary>
/// DropDownContextMenuDataContext Dependency Property
/// </summary>
public static readonly DependencyProperty DropDownContextMenuDataContextProperty = DependencyProperty.Register( "DropDownContextMenuDataContext", typeof( object ), typeof( DropDownControlArea ),
new FrameworkPropertyMetadata( ( object )null ) );
/// <summary>
/// Gets or sets the DropDownContextMenuDataContext property. This dependency property
/// indicates data context to attach when context menu is shown.
/// </summary>
public object DropDownContextMenuDataContext
{
get { return (object)GetValue(DropDownContextMenuDataContextProperty); }
set { SetValue(DropDownContextMenuDataContextProperty, value); }
}
/// <summary>
/// Gets or sets the DropDownContextMenuDataContext property. This dependency property
/// indicates data context to attach when context menu is shown.
/// </summary>
public object DropDownContextMenuDataContext
{
get
{
return ( object )GetValue( DropDownContextMenuDataContextProperty );
}
set
{
SetValue( DropDownContextMenuDataContextProperty, value );
}
}
#endregion
#endregion
protected override void OnMouseRightButtonDown(System.Windows.Input.MouseButtonEventArgs e)
{
base.OnMouseRightButtonDown(e);
#endregion
#region Overrides
}
protected override void OnMouseRightButtonDown( System.Windows.Input.MouseButtonEventArgs e )
{
base.OnMouseRightButtonDown( e );
}
protected override void OnPreviewMouseRightButtonUp( System.Windows.Input.MouseButtonEventArgs e )
{
base.OnPreviewMouseRightButtonUp( e );
protected override void OnPreviewMouseRightButtonUp(System.Windows.Input.MouseButtonEventArgs e)
if( !e.Handled )
{
if( DropDownContextMenu != null )
{
base.OnPreviewMouseRightButtonUp(e);
if (!e.Handled)
{
if (DropDownContextMenu != null)
{
DropDownContextMenu.PlacementTarget = null;
DropDownContextMenu.Placement = PlacementMode.MousePoint;
DropDownContextMenu.DataContext = DropDownContextMenuDataContext;
DropDownContextMenu.IsOpen = true;
// e.Handled = true;
}
}
DropDownContextMenu.PlacementTarget = null;
DropDownContextMenu.Placement = PlacementMode.MousePoint;
DropDownContextMenu.DataContext = DropDownContextMenuDataContext;
DropDownContextMenu.IsOpen = true;
// e.Handled = true;
}
}
}
//protected override System.Windows.Media.HitTestResult HitTestCore(System.Windows.Media.PointHitTestParameters hitTestParameters)
//{
// var hitResult = base.HitTestCore(hitTestParameters);
// if (hitResult == null)
// return new PointHitTestResult(this, hitTestParameters.HitPoint);
//protected override System.Windows.Media.HitTestResult HitTestCore(System.Windows.Media.PointHitTestParameters hitTestParameters)
//{
// var hitResult = base.HitTestCore(hitTestParameters);
// if (hitResult == null)
// return new PointHitTestResult(this, hitTestParameters.HitPoint);
// return hitResult;
//}
// return hitResult;
//}
}
#endregion
}
}

161
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTarget.cs

@ -17,7 +17,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using Xceed.Wpf.AvalonDock.Layout;
@ -25,91 +24,117 @@ using System.Windows.Threading;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal abstract class DropTarget<T> : DropTargetBase, IDropTarget where T : FrameworkElement
{
protected DropTarget(T targetElement, Rect detectionRect, DropTargetType type)
{
_targetElement = targetElement;
_detectionRect = new Rect[] { detectionRect };
_type = type;
}
internal abstract class DropTarget<T> : DropTargetBase, IDropTarget where T : FrameworkElement
{
#region Members
protected DropTarget(T targetElement, IEnumerable<Rect> detectionRects, DropTargetType type)
{
_targetElement = targetElement;
_detectionRect = detectionRects.ToArray();
_type = type;
}
private Rect[] _detectionRect;
private T _targetElement;
private DropTargetType _type;
Rect[] _detectionRect;
#endregion
public Rect[] DetectionRects
{
get { return _detectionRect; }
}
#region Constructors
protected DropTarget( T targetElement, Rect detectionRect, DropTargetType type )
{
_targetElement = targetElement;
_detectionRect = new Rect[] { detectionRect };
_type = type;
}
T _targetElement;
public T TargetElement
{
get { return _targetElement; }
}
protected DropTarget( T targetElement, IEnumerable<Rect> detectionRects, DropTargetType type )
{
_targetElement = targetElement;
_detectionRect = detectionRects.ToArray();
_type = type;
}
DropTargetType _type;
#endregion
public DropTargetType Type
{
get { return _type; }
}
#region Properties
protected virtual void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{ }
public Rect[] DetectionRects
{
get
{
return _detectionRect;
}
}
protected virtual void Drop(LayoutDocumentFloatingWindow floatingWindow)
{ }
public T TargetElement
{
get
{
return _targetElement;
}
}
public DropTargetType Type
{
get
{
return _type;
}
}
public void Drop(LayoutFloatingWindow floatingWindow)
{
var root = floatingWindow.Root;
var currentActiveContent = floatingWindow.Root.ActiveContent;
var fwAsAnchorable = floatingWindow as LayoutAnchorableFloatingWindow;
#endregion
if (fwAsAnchorable != null)
{
this.Drop(fwAsAnchorable);
}
else
{
var fwAsDocument = floatingWindow as LayoutDocumentFloatingWindow;
this.Drop(fwAsDocument);
}
#region Overrides
Dispatcher.BeginInvoke(new Action(() =>
{
currentActiveContent.IsSelected = false;
currentActiveContent.IsActive = false;
currentActiveContent.IsActive = true;
}), DispatcherPriority.Background);
}
protected virtual void Drop( LayoutAnchorableFloatingWindow floatingWindow )
{
}
public virtual bool HitTest(Point dragPoint)
{
return _detectionRect.Any(dr => dr.Contains(dragPoint));
}
protected virtual void Drop( LayoutDocumentFloatingWindow floatingWindow )
{
}
public abstract Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindow);
#endregion
#region Public Methods
public void Drop( LayoutFloatingWindow floatingWindow )
{
var root = floatingWindow.Root;
var currentActiveContent = floatingWindow.Root.ActiveContent;
var fwAsAnchorable = floatingWindow as LayoutAnchorableFloatingWindow;
if( fwAsAnchorable != null )
{
this.Drop( fwAsAnchorable );
}
else
{
var fwAsDocument = floatingWindow as LayoutDocumentFloatingWindow;
this.Drop( fwAsDocument );
}
Dispatcher.BeginInvoke( new Action( () =>
{
currentActiveContent.IsSelected = false;
currentActiveContent.IsActive = false;
currentActiveContent.IsActive = true;
} ), DispatcherPriority.Background );
}
public void DragEnter()
{
SetIsDraggingOver(TargetElement, true);
}
public virtual bool HitTest( Point dragPoint )
{
return _detectionRect.Any( dr => dr.Contains( dragPoint ) );
}
public void DragLeave()
{
SetIsDraggingOver(TargetElement, false);
}
public abstract Geometry GetPreviewPath( OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindow );
public void DragEnter()
{
SetIsDraggingOver( TargetElement, true );
}
public void DragLeave()
{
SetIsDraggingOver( TargetElement, false );
}
#endregion
}
}

65
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTargetBase.cs

@ -14,43 +14,42 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
abstract class DropTargetBase : DependencyObject
abstract class DropTargetBase : DependencyObject
{
#region Properties
#region IsDraggingOver
/// <summary>
/// IsDraggingOver Attached Dependency Property
/// </summary>
public static readonly DependencyProperty IsDraggingOverProperty = DependencyProperty.RegisterAttached( "IsDraggingOver", typeof( bool ), typeof( DropTargetBase ),
new FrameworkPropertyMetadata( ( bool )false ) );
/// <summary>
/// Gets the IsDraggingOver property. This dependency property
/// indicates if user is dragging a window over the target element.
/// </summary>
public static bool GetIsDraggingOver( DependencyObject d )
{
#region IsDraggingOver
/// <summary>
/// IsDraggingOver Attached Dependency Property
/// </summary>
public static readonly DependencyProperty IsDraggingOverProperty =
DependencyProperty.RegisterAttached("IsDraggingOver", typeof(bool), typeof(DropTargetBase),
new FrameworkPropertyMetadata((bool)false));
/// <summary>
/// Gets the IsDraggingOver property. This dependency property
/// indicates if user is dragging a window over the target element.
/// </summary>
public static bool GetIsDraggingOver(DependencyObject d)
{
return (bool)d.GetValue(IsDraggingOverProperty);
}
/// <summary>
/// Sets the IsDraggingOver property. This dependency property
/// indicates if user is dragging away a window from the target element.
/// </summary>
public static void SetIsDraggingOver(DependencyObject d, bool value)
{
d.SetValue(IsDraggingOverProperty, value);
}
#endregion
return ( bool )d.GetValue( IsDraggingOverProperty );
}
/// <summary>
/// Sets the IsDraggingOver property. This dependency property
/// indicates if user is dragging away a window from the target element.
/// </summary>
public static void SetIsDraggingOver( DependencyObject d, bool value )
{
d.SetValue( IsDraggingOverProperty, value );
}
#endregion
#endregion
}
}

57
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTargetType.cs

@ -14,37 +14,32 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Xceed.Wpf.AvalonDock.Controls
{
public enum DropTargetType
{
DockingManagerDockLeft,
DockingManagerDockTop,
DockingManagerDockRight,
DockingManagerDockBottom,
DocumentPaneDockLeft,
DocumentPaneDockTop,
DocumentPaneDockRight,
DocumentPaneDockBottom,
DocumentPaneDockInside,
DocumentPaneGroupDockInside,
AnchorablePaneDockLeft,
AnchorablePaneDockTop,
AnchorablePaneDockRight,
AnchorablePaneDockBottom,
AnchorablePaneDockInside,
DocumentPaneDockAsAnchorableLeft,
DocumentPaneDockAsAnchorableTop,
DocumentPaneDockAsAnchorableRight,
DocumentPaneDockAsAnchorableBottom,
}
public enum DropTargetType
{
DockingManagerDockLeft,
DockingManagerDockTop,
DockingManagerDockRight,
DockingManagerDockBottom,
DocumentPaneDockLeft,
DocumentPaneDockTop,
DocumentPaneDockRight,
DocumentPaneDockBottom,
DocumentPaneDockInside,
DocumentPaneGroupDockInside,
AnchorablePaneDockLeft,
AnchorablePaneDockTop,
AnchorablePaneDockRight,
AnchorablePaneDockBottom,
AnchorablePaneDockInside,
DocumentPaneDockAsAnchorableLeft,
DocumentPaneDockAsAnchorableTop,
DocumentPaneDockAsAnchorableRight,
DocumentPaneDockAsAnchorableBottom,
}
}

158
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Extentions.cs

@ -14,107 +14,103 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Runtime.InteropServices;
namespace Xceed.Wpf.AvalonDock.Controls
{
public static class Extentions
public static class Extentions
{
public static IEnumerable<T> FindVisualChildren<T>( this DependencyObject depObj ) where T : DependencyObject
{
public static IEnumerable<T> FindVisualChildren<T>(this DependencyObject depObj) where T : DependencyObject
if( depObj != null )
{
for( int i = 0; i < VisualTreeHelper.GetChildrenCount( depObj ); i++ )
{
if (depObj != null)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
if (child != null && child is T)
{
yield return (T)child;
}
foreach (T childOfChild in FindVisualChildren<T>(child))
{
yield return childOfChild;
}
}
}
DependencyObject child = VisualTreeHelper.GetChild( depObj, i );
if( child != null && child is T )
{
yield return ( T )child;
}
foreach( T childOfChild in FindVisualChildren<T>( child ) )
{
yield return childOfChild;
}
}
}
}
public static IEnumerable<T> FindLogicalChildren<T>(this DependencyObject depObj) where T : DependencyObject
public static IEnumerable<T> FindLogicalChildren<T>( this DependencyObject depObj ) where T : DependencyObject
{
if( depObj != null )
{
foreach( DependencyObject child in LogicalTreeHelper.GetChildren( depObj ).OfType<DependencyObject>() )
{
if (depObj != null)
{
foreach (DependencyObject child in LogicalTreeHelper.GetChildren(depObj).OfType<DependencyObject>())
{
if (child != null && child is T)
{
yield return (T)child;
}
foreach (T childOfChild in FindLogicalChildren<T>(child))
{
yield return childOfChild;
}
}
}
if( child != null && child is T )
{
yield return ( T )child;
}
foreach( T childOfChild in FindLogicalChildren<T>( child ) )
{
yield return childOfChild;
}
}
}
}
public static DependencyObject FindVisualTreeRoot(this DependencyObject initial)
{
DependencyObject current = initial;
DependencyObject result = initial;
while (current != null)
{
result = current;
if (current is Visual || current is Visual3D)
{
current = VisualTreeHelper.GetParent(current);
}
else
{
// If we're in Logical Land then we must walk
// up the logical tree until we find a
// Visual/Visual3D to get us back to Visual Land.
current = LogicalTreeHelper.GetParent(current);
}
}
return result;
}
public static DependencyObject FindVisualTreeRoot( this DependencyObject initial )
{
DependencyObject current = initial;
DependencyObject result = initial;
public static T FindVisualAncestor<T>(this DependencyObject dependencyObject) where T : class
while( current != null )
{
result = current;
if( current is Visual || current is Visual3D )
{
DependencyObject target = dependencyObject;
do
{
target = VisualTreeHelper.GetParent(target);
}
while (target != null && !(target is T));
return target as T;
current = VisualTreeHelper.GetParent( current );
}
public static T FindLogicalAncestor<T>(this DependencyObject dependencyObject) where T : class
else
{
DependencyObject target = dependencyObject;
do
{
var current = target;
target = LogicalTreeHelper.GetParent(target);
if (target == null)
target = VisualTreeHelper.GetParent(current);
}
while (target != null && !(target is T));
return target as T;
// If we're in Logical Land then we must walk
// up the logical tree until we find a
// Visual/Visual3D to get us back to Visual Land.
current = LogicalTreeHelper.GetParent( current );
}
}
return result;
}
public static T FindVisualAncestor<T>( this DependencyObject dependencyObject ) where T : class
{
DependencyObject target = dependencyObject;
do
{
target = VisualTreeHelper.GetParent( target );
}
while( target != null && !( target is T ) );
return target as T;
}
public static T FindLogicalAncestor<T>( this DependencyObject dependencyObject ) where T : class
{
DependencyObject target = dependencyObject;
do
{
var current = target;
target = LogicalTreeHelper.GetParent( target );
if( target == null )
target = VisualTreeHelper.GetParent( current );
}
while( target != null && !( target is T ) );
return target as T;
}
}
}

400
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/FocusElementManager.cs

@ -17,7 +17,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows;
@ -28,241 +27,246 @@ using System.Windows.Threading;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal static class FocusElementManager
{
#region Focus Management
static List<DockingManager> _managers = new List<DockingManager>();
internal static void SetupFocusManagement(DockingManager manager)
{
if (_managers.Count == 0)
{
//InputManager.Current.EnterMenuMode += new EventHandler(InputManager_EnterMenuMode);
//InputManager.Current.LeaveMenuMode += new EventHandler(InputManager_LeaveMenuMode);
_windowHandler = new WindowHookHandler();
_windowHandler.FocusChanged += new EventHandler<FocusChangeEventArgs>(WindowFocusChanging);
//_windowHandler.Activate += new EventHandler<WindowActivateEventArgs>(WindowActivating);
_windowHandler.Attach();
if (Application.Current != null)
Application.Current.Exit += new ExitEventHandler(Current_Exit);
}
internal static class FocusElementManager
{
#region Member
manager.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(manager_PreviewGotKeyboardFocus);
_managers.Add(manager);
}
private static List<DockingManager> _managers = new List<DockingManager>();
private static FullWeakDictionary<ILayoutElement, IInputElement> _modelFocusedElement = new FullWeakDictionary<ILayoutElement, IInputElement>();
private static WeakDictionary<ILayoutElement, IntPtr> _modelFocusedWindowHandle = new WeakDictionary<ILayoutElement, IntPtr>();
private static WeakReference _lastFocusedElement;
private static WindowHookHandler _windowHandler = null;
private static DispatcherOperation _setFocusAsyncOperation;
private static WeakReference _lastFocusedElementBeforeEnterMenuMode = null;
internal static void FinalizeFocusManagement(DockingManager manager)
{
manager.PreviewGotKeyboardFocus -= new KeyboardFocusChangedEventHandler(manager_PreviewGotKeyboardFocus);
_managers.Remove(manager);
#endregion
if (_managers.Count == 0)
{
//InputManager.Current.EnterMenuMode -= new EventHandler(InputManager_EnterMenuMode);
//InputManager.Current.LeaveMenuMode -= new EventHandler(InputManager_LeaveMenuMode);
if (_windowHandler != null)
{
_windowHandler.FocusChanged -= new EventHandler<FocusChangeEventArgs>(WindowFocusChanging);
//_windowHandler.Activate -= new EventHandler<WindowActivateEventArgs>(WindowActivating);
_windowHandler.Detach();
_windowHandler = null;
}
}
#region Internal Methods
}
internal static void SetupFocusManagement( DockingManager manager )
{
if( _managers.Count == 0 )
{
//InputManager.Current.EnterMenuMode += new EventHandler(InputManager_EnterMenuMode);
//InputManager.Current.LeaveMenuMode += new EventHandler(InputManager_LeaveMenuMode);
_windowHandler = new WindowHookHandler();
_windowHandler.FocusChanged += new EventHandler<FocusChangeEventArgs>( WindowFocusChanging );
//_windowHandler.Activate += new EventHandler<WindowActivateEventArgs>(WindowActivating);
_windowHandler.Attach();
if( Application.Current != null )
Application.Current.Exit += new ExitEventHandler( Current_Exit );
}
manager.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler( manager_PreviewGotKeyboardFocus );
_managers.Add( manager );
}
private static void Current_Exit(object sender, ExitEventArgs e)
internal static void FinalizeFocusManagement( DockingManager manager )
{
manager.PreviewGotKeyboardFocus -= new KeyboardFocusChangedEventHandler( manager_PreviewGotKeyboardFocus );
_managers.Remove( manager );
if( _managers.Count == 0 )
{
//InputManager.Current.EnterMenuMode -= new EventHandler(InputManager_EnterMenuMode);
//InputManager.Current.LeaveMenuMode -= new EventHandler(InputManager_LeaveMenuMode);
if( _windowHandler != null )
{
Application.Current.Exit -= new ExitEventHandler(Current_Exit);
if (_windowHandler != null)
{
_windowHandler.FocusChanged -= new EventHandler<FocusChangeEventArgs>(WindowFocusChanging);
//_windowHandler.Activate -= new EventHandler<WindowActivateEventArgs>(WindowActivating);
_windowHandler.Detach();
_windowHandler = null;
}
_windowHandler.FocusChanged -= new EventHandler<FocusChangeEventArgs>( WindowFocusChanging );
//_windowHandler.Activate -= new EventHandler<WindowActivateEventArgs>(WindowActivating);
_windowHandler.Detach();
_windowHandler = null;
}
}
static void manager_PreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
var focusedElement = e.NewFocus as Visual;
if (focusedElement != null &&
!(focusedElement is LayoutAnchorableTabItem || focusedElement is LayoutDocumentTabItem))
//Avoid tracking focus for elements like this
{
var parentAnchorable = focusedElement.FindVisualAncestor<LayoutAnchorableControl>();
if (parentAnchorable != null)
{
_modelFocusedElement[parentAnchorable.Model] = e.NewFocus;
}
else
{
var parentDocument = focusedElement.FindVisualAncestor<LayoutDocumentControl>();
if (parentDocument != null)
{
_modelFocusedElement[parentDocument.Model] = e.NewFocus;
}
}
}
}
}
static FullWeakDictionary<ILayoutElement, IInputElement> _modelFocusedElement = new FullWeakDictionary<ILayoutElement, IInputElement>();
static WeakDictionary<ILayoutElement, IntPtr> _modelFocusedWindowHandle = new WeakDictionary<ILayoutElement, IntPtr>();
/// <summary>
/// Get the input element that was focused before user left the layout element
/// </summary>
/// <param name="model">Element to look for</param>
/// <returns>Input element </returns>
internal static IInputElement GetLastFocusedElement( ILayoutElement model )
{
IInputElement objectWithFocus;
if( _modelFocusedElement.GetValue( model, out objectWithFocus ) )
return objectWithFocus;
/// <summary>
/// Get the input element that was focused before user left the layout element
/// </summary>
/// <param name="model">Element to look for</param>
/// <returns>Input element </returns>
internal static IInputElement GetLastFocusedElement(ILayoutElement model)
{
IInputElement objectWithFocus;
if (_modelFocusedElement.GetValue(model, out objectWithFocus))
return objectWithFocus;
return null;
}
return null;
}
/// <summary>
/// Get the last window handle focused before user left the element passed as argument
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
internal static IntPtr GetLastWindowHandle( ILayoutElement model )
{
IntPtr handleWithFocus;
if( _modelFocusedWindowHandle.GetValue( model, out handleWithFocus ) )
return handleWithFocus;
/// <summary>
/// Get the last window handle focused before user left the element passed as argument
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
internal static IntPtr GetLastWindowHandle(ILayoutElement model)
{
IntPtr handleWithFocus;
if (_modelFocusedWindowHandle.GetValue(model, out handleWithFocus))
return handleWithFocus;
return IntPtr.Zero;
}
return IntPtr.Zero;
}
static WeakReference _lastFocusedElement;
/// <summary>
/// Given a layout element tries to set the focus of the keyword where it was before user moved to another element
/// </summary>
/// <param name="model"></param>
internal static void SetFocusOnLastElement( ILayoutElement model )
{
bool focused = false;
IInputElement objectToFocus;
if( _modelFocusedElement.GetValue( model, out objectToFocus ) )
{
focused = objectToFocus == Keyboard.Focus( objectToFocus );
}
/// <summary>
/// Given a layout element tries to set the focus of the keyword where it was before user moved to another element
/// </summary>
/// <param name="model"></param>
internal static void SetFocusOnLastElement(ILayoutElement model)
{
bool focused = false;
IInputElement objectToFocus;
if (_modelFocusedElement.GetValue(model, out objectToFocus))
{
focused = objectToFocus == Keyboard.Focus(objectToFocus);
}
IntPtr handleToFocus;
if( _modelFocusedWindowHandle.GetValue( model, out handleToFocus ) )
focused = IntPtr.Zero != Win32Helper.SetFocus( handleToFocus );
IntPtr handleToFocus;
if (_modelFocusedWindowHandle.GetValue(model, out handleToFocus))
focused = IntPtr.Zero != Win32Helper.SetFocus(handleToFocus);
if( focused )
{
_lastFocusedElement = new WeakReference( model );
}
if (focused)
{
_lastFocusedElement = new WeakReference(model);
}
}
}
#endregion
static WindowHookHandler _windowHandler = null;
#region Private Methods
static void WindowFocusChanging(object sender, FocusChangeEventArgs e)
private static void Current_Exit( object sender, ExitEventArgs e )
{
Application.Current.Exit -= new ExitEventHandler( Current_Exit );
if( _windowHandler != null )
{
_windowHandler.FocusChanged -= new EventHandler<FocusChangeEventArgs>( WindowFocusChanging );
//_windowHandler.Activate -= new EventHandler<WindowActivateEventArgs>(WindowActivating);
_windowHandler.Detach();
_windowHandler = null;
}
}
private static void manager_PreviewGotKeyboardFocus( object sender, KeyboardFocusChangedEventArgs e )
{
var focusedElement = e.NewFocus as Visual;
if( focusedElement != null &&
!( focusedElement is LayoutAnchorableTabItem || focusedElement is LayoutDocumentTabItem ) )
//Avoid tracking focus for elements like this
{
var parentAnchorable = focusedElement.FindVisualAncestor<LayoutAnchorableControl>();
if( parentAnchorable != null )
{
foreach (var manager in _managers)
{
var hostContainingFocusedHandle = manager.FindLogicalChildren<HwndHost>().FirstOrDefault(hw => Win32Helper.IsChild(hw.Handle, e.GotFocusWinHandle));
if (hostContainingFocusedHandle != null)
{
var parentAnchorable = hostContainingFocusedHandle.FindVisualAncestor<LayoutAnchorableControl>();
if (parentAnchorable != null)
{
_modelFocusedWindowHandle[parentAnchorable.Model] = e.GotFocusWinHandle;
if (parentAnchorable.Model != null)
parentAnchorable.Model.IsActive = true;
}
else
{
var parentDocument = hostContainingFocusedHandle.FindVisualAncestor<LayoutDocumentControl>();
if (parentDocument != null)
{
_modelFocusedWindowHandle[parentDocument.Model] = e.GotFocusWinHandle;
if (parentDocument.Model != null)
parentDocument.Model.IsActive = true;
}
}
}
}
_modelFocusedElement[ parentAnchorable.Model ] = e.NewFocus;
}
else
{
var parentDocument = focusedElement.FindVisualAncestor<LayoutDocumentControl>();
if( parentDocument != null )
{
_modelFocusedElement[ parentDocument.Model ] = e.NewFocus;
}
}
}
}
static DispatcherOperation _setFocusAsyncOperation;
private static void WindowFocusChanging( object sender, FocusChangeEventArgs e )
{
foreach( var manager in _managers )
{
var hostContainingFocusedHandle = manager.FindLogicalChildren<HwndHost>().FirstOrDefault( hw => Win32Helper.IsChild( hw.Handle, e.GotFocusWinHandle ) );
static void WindowActivating(object sender, WindowActivateEventArgs e)
if( hostContainingFocusedHandle != null )
{
if (Keyboard.FocusedElement == null &&
_lastFocusedElement != null &&
_lastFocusedElement.IsAlive)
var parentAnchorable = hostContainingFocusedHandle.FindVisualAncestor<LayoutAnchorableControl>();
if( parentAnchorable != null )
{
_modelFocusedWindowHandle[ parentAnchorable.Model ] = e.GotFocusWinHandle;
if( parentAnchorable.Model != null )
parentAnchorable.Model.IsActive = true;
}
else
{
var parentDocument = hostContainingFocusedHandle.FindVisualAncestor<LayoutDocumentControl>();
if( parentDocument != null )
{
var elementToSetFocus = _lastFocusedElement.Target as ILayoutElement;
if (elementToSetFocus != null)
{
var manager = elementToSetFocus.Root.Manager;
if (manager == null)
return;
IntPtr parentHwnd;
if (!manager.GetParentWindowHandle(out parentHwnd))
return;
if (e.HwndActivating != parentHwnd)
return;
_setFocusAsyncOperation = Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
{
try
{
SetFocusOnLastElement(elementToSetFocus);
}
finally
{
_setFocusAsyncOperation = null;
}
}), DispatcherPriority.Input);
}
_modelFocusedWindowHandle[ parentDocument.Model ] = e.GotFocusWinHandle;
if( parentDocument.Model != null )
parentDocument.Model.IsActive = true;
}
}
}
}
}
static WeakReference _lastFocusedElementBeforeEnterMenuMode = null;
static void InputManager_EnterMenuMode(object sender, EventArgs e)
private static void WindowActivating( object sender, WindowActivateEventArgs e )
{
if( Keyboard.FocusedElement == null &&
_lastFocusedElement != null &&
_lastFocusedElement.IsAlive )
{
var elementToSetFocus = _lastFocusedElement.Target as ILayoutElement;
if( elementToSetFocus != null )
{
if (Keyboard.FocusedElement == null)
return;
var manager = elementToSetFocus.Root.Manager;
if( manager == null )
return;
IntPtr parentHwnd;
if( !manager.GetParentWindowHandle( out parentHwnd ) )
return;
if( e.HwndActivating != parentHwnd )
return;
var lastfocusDepObj = Keyboard.FocusedElement as DependencyObject;
if (lastfocusDepObj.FindLogicalAncestor<DockingManager>() == null)
_setFocusAsyncOperation = Dispatcher.CurrentDispatcher.BeginInvoke( new Action( () =>
{
try
{
_lastFocusedElementBeforeEnterMenuMode = null;
return;
SetFocusOnLastElement( elementToSetFocus );
}
_lastFocusedElementBeforeEnterMenuMode = new WeakReference(Keyboard.FocusedElement);
}
static void InputManager_LeaveMenuMode(object sender, EventArgs e)
{
if (_lastFocusedElementBeforeEnterMenuMode != null &&
_lastFocusedElementBeforeEnterMenuMode.IsAlive)
finally
{
var lastFocusedInputElement = _lastFocusedElementBeforeEnterMenuMode.GetValueOrDefault<UIElement>();
if (lastFocusedInputElement != null)
{
if (lastFocusedInputElement != Keyboard.Focus(lastFocusedInputElement))
Debug.WriteLine("Unable to activate the element");
}
_setFocusAsyncOperation = null;
}
} ), DispatcherPriority.Input );
}
}
}
#endregion
private static void InputManager_EnterMenuMode( object sender, EventArgs e )
{
if( Keyboard.FocusedElement == null )
return;
var lastfocusDepObj = Keyboard.FocusedElement as DependencyObject;
if( lastfocusDepObj.FindLogicalAncestor<DockingManager>() == null )
{
_lastFocusedElementBeforeEnterMenuMode = null;
return;
}
_lastFocusedElementBeforeEnterMenuMode = new WeakReference( Keyboard.FocusedElement );
}
private static void InputManager_LeaveMenuMode( object sender, EventArgs e )
{
if( _lastFocusedElementBeforeEnterMenuMode != null &&
_lastFocusedElementBeforeEnterMenuMode.IsAlive )
{
var lastFocusedInputElement = _lastFocusedElementBeforeEnterMenuMode.GetValueOrDefault<UIElement>();
if( lastFocusedInputElement != null )
{
if( lastFocusedInputElement != Keyboard.Focus( lastFocusedInputElement ) )
Debug.WriteLine( "Unable to activate the element" );
}
}
}
#endregion
}
}

158
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/FullWeakDictionary.cs

@ -16,91 +16,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Xceed.Wpf.AvalonDock.Controls
{
class FullWeakDictionary<K,V> where K : class
internal class FullWeakDictionary<K, V> where K : class
{
#region Members
private List<WeakReference> _keys = new List<WeakReference>();
private List<WeakReference> _values = new List<WeakReference>();
#endregion
#region Constructors
public FullWeakDictionary()
{
public FullWeakDictionary()
{}
}
List<WeakReference> _keys = new List<WeakReference>();
List<WeakReference> _values = new List<WeakReference>();
#endregion
public V this[K key]
{
get
{
V valueToReturn;
if (!GetValue(key, out valueToReturn))
throw new ArgumentException();
return valueToReturn;
}
set
{
SetValue(key, value);
}
}
#region Public Methods
public bool ContainsKey(K key)
{
CollectGarbage();
return -1 != _keys.FindIndex(k => k.GetValueOrDefault<K>() == key);
}
public V this[ K key ]
{
get
{
V valueToReturn;
if( !GetValue( key, out valueToReturn ) )
throw new ArgumentException();
return valueToReturn;
}
set
{
SetValue( key, value );
}
}
public void SetValue(K key, V value)
{
CollectGarbage();
int vIndex = _keys.FindIndex(k => k.GetValueOrDefault<K>() == key);
if (vIndex > -1)
_values[vIndex] = new WeakReference(value);
else
{
_values.Add(new WeakReference(value));
_keys.Add(new WeakReference(key));
}
}
public bool ContainsKey( K key )
{
CollectGarbage();
return -1 != _keys.FindIndex( k => k.GetValueOrDefault<K>() == key );
}
public bool GetValue(K key, out V value)
{
CollectGarbage();
int vIndex = _keys.FindIndex(k => k.GetValueOrDefault<K>() == key);
value = default(V);
if (vIndex == -1)
return false;
value = _values[vIndex].GetValueOrDefault<V>();
return true;
}
public void SetValue( K key, V value )
{
CollectGarbage();
int vIndex = _keys.FindIndex( k => k.GetValueOrDefault<K>() == key );
if( vIndex > -1 )
_values[ vIndex ] = new WeakReference( value );
else
{
_values.Add( new WeakReference( value ) );
_keys.Add( new WeakReference( key ) );
}
}
public bool GetValue( K key, out V value )
{
CollectGarbage();
int vIndex = _keys.FindIndex( k => k.GetValueOrDefault<K>() == key );
value = default( V );
if( vIndex == -1 )
return false;
value = _values[ vIndex ].GetValueOrDefault<V>();
return true;
}
void CollectGarbage()
{
int vIndex = 0;
do
{
vIndex = _keys.FindIndex(vIndex, k => !k.IsAlive);
if (vIndex >= 0)
{
_keys.RemoveAt(vIndex);
_values.RemoveAt(vIndex);
}
}
while (vIndex >= 0);
vIndex = 0;
do
{
vIndex = _values.FindIndex(vIndex, v => !v.IsAlive);
if (vIndex >= 0)
{
_values.RemoveAt(vIndex);
_keys.RemoveAt(vIndex);
}
}
while (vIndex >= 0);
void CollectGarbage()
{
int vIndex = 0;
do
{
vIndex = _keys.FindIndex( vIndex, k => !k.IsAlive );
if( vIndex >= 0 )
{
_keys.RemoveAt( vIndex );
_values.RemoveAt( vIndex );
}
}
while( vIndex >= 0 );
vIndex = 0;
do
{
vIndex = _values.FindIndex( vIndex, v => !v.IsAlive );
if( vIndex >= 0 )
{
_values.RemoveAt( vIndex );
_keys.RemoveAt( vIndex );
}
}
while( vIndex >= 0 );
}
#endregion
}
}

31
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IDropTarget.cs

@ -14,28 +14,35 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal interface IDropTarget
internal interface IDropTarget
{
#region Properties
DropTargetType Type
{
Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindow);
get;
}
bool HitTest(Point dragPoint);
#endregion
DropTargetType Type { get; }
#region Methods
void Drop(LayoutFloatingWindow floatingWindow);
Geometry GetPreviewPath( OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindow );
void DragEnter();
bool HitTest( Point dragPoint );
void DragLeave();
}
void Drop( LayoutFloatingWindow floatingWindow );
void DragEnter();
void DragLeave();
#endregion
}
}

25
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IOverlayWindow.cs

@ -14,25 +14,22 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal interface IOverlayWindow
{
IEnumerable<IDropTarget> GetTargets();
internal interface IOverlayWindow
{
IEnumerable<IDropTarget> GetTargets();
void DragEnter(LayoutFloatingWindowControl floatingWindow);
void DragLeave(LayoutFloatingWindowControl floatingWindow);
void DragEnter( LayoutFloatingWindowControl floatingWindow );
void DragLeave( LayoutFloatingWindowControl floatingWindow );
void DragEnter(IDropArea area);
void DragLeave(IDropArea area);
void DragEnter( IDropArea area );
void DragLeave( IDropArea area );
void DragEnter(IDropTarget target);
void DragLeave(IDropTarget target);
void DragDrop(IDropTarget target);
}
void DragEnter( IDropTarget target );
void DragLeave( IDropTarget target );
void DragDrop( IDropTarget target );
}
}

11
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IOverlayWindowArea.cs

@ -14,16 +14,15 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal interface IOverlayWindowArea
internal interface IOverlayWindowArea
{
Rect ScreenDetectionArea
{
Rect ScreenDetectionArea { get; }
get;
}
}
}

16
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IOverlayWindowDropTarget.cs

@ -14,18 +14,20 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
interface IOverlayWindowDropTarget
interface IOverlayWindowDropTarget
{
Rect ScreenDetectionArea
{
Rect ScreenDetectionArea { get; }
get;
}
OverlayWindowDropTargetType Type { get; }
OverlayWindowDropTargetType Type
{
get;
}
}
}

28
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/IOverlayWindowHost.cs

@ -14,24 +14,32 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
internal interface IOverlayWindowHost
internal interface IOverlayWindowHost
{
#region Properties
DockingManager Manager
{
bool HitTest(Point dragPoint);
get;
}
IOverlayWindow ShowOverlayWindow(LayoutFloatingWindowControl draggingWindow);
#endregion
void HideOverlayWindow();
#region Methods
IEnumerable<IDropArea> GetDropAreas(LayoutFloatingWindowControl draggingWindow);
bool HitTest( Point dragPoint );
DockingManager Manager { get; }
}
IOverlayWindow ShowOverlayWindow( LayoutFloatingWindowControl draggingWindow );
void HideOverlayWindow();
IEnumerable<IDropArea> GetDropAreas( LayoutFloatingWindowControl draggingWindow );
#endregion
}
}

130
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorControl.cs

@ -24,13 +24,21 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutAnchorControl : Control, ILayoutControl
{
#region Members
private LayoutAnchorable _model;
private DispatcherTimer _openUpTimer = null;
#endregion
#region Constructors
static LayoutAnchorControl()
{
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutAnchorControl ), new FrameworkPropertyMetadata( typeof( LayoutAnchorControl ) ) );
Control.IsHitTestVisibleProperty.AddOwner( typeof( LayoutAnchorControl ), new FrameworkPropertyMetadata( true ) );
}
internal LayoutAnchorControl( LayoutAnchorable model )
{
_model = model;
@ -40,7 +48,61 @@ namespace Xceed.Wpf.AvalonDock.Controls
SetSide( _model.FindParent<LayoutAnchorSide>().Side );
}
void _model_IsSelectedChanged( object sender, EventArgs e )
#endregion
#region Properties
#region Model
public ILayoutElement Model
{
get
{
return _model;
}
}
#endregion
#region Side
/// <summary>
/// Side Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey SidePropertyKey = DependencyProperty.RegisterReadOnly( "Side", typeof( AnchorSide ), typeof( LayoutAnchorControl ),
new FrameworkPropertyMetadata( ( AnchorSide )AnchorSide.Left ) );
public static readonly DependencyProperty SideProperty = SidePropertyKey.DependencyProperty;
/// <summary>
/// Gets the Side property. This dependency property
/// indicates the anchor side of the control.
/// </summary>
public AnchorSide Side
{
get
{
return ( AnchorSide )GetValue( SideProperty );
}
}
/// <summary>
/// Provides a secure method for setting the Side property.
/// This dependency property indicates the anchor side of the control.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetSide( AnchorSide value )
{
SetValue( SidePropertyKey, value );
}
#endregion
#endregion
#region Private Methods
private void _model_IsSelectedChanged( object sender, EventArgs e )
{
if( !_model.IsAutoHidden )
_model.IsSelectedChanged -= new EventHandler( _model_IsSelectedChanged );
@ -51,7 +113,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
void _model_IsActiveChanged( object sender, EventArgs e )
private void _model_IsActiveChanged( object sender, EventArgs e )
{
if( !_model.IsAutoHidden )
_model.IsActiveChanged -= new EventHandler( _model_IsActiveChanged );
@ -59,16 +121,18 @@ namespace Xceed.Wpf.AvalonDock.Controls
_model.Root.Manager.ShowAutoHideWindow( this );
}
LayoutAnchorable _model;
public ILayoutElement Model
private void _openUpTimer_Tick( object sender, EventArgs e )
{
get
{
return _model;
}
_openUpTimer.Tick -= new EventHandler( _openUpTimer_Tick );
_openUpTimer.Stop();
_openUpTimer = null;
_model.Root.Manager.ShowAutoHideWindow( this );
}
#endregion
#region Overrides
//protected override void OnVisualParentChanged(DependencyObject oldParent)
//{
// base.OnVisualParentChanged(oldParent);
@ -110,9 +174,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
DispatcherTimer _openUpTimer = null;
protected override void OnMouseEnter( System.Windows.Input.MouseEventArgs e )
{
base.OnMouseEnter( e );
@ -126,14 +187,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
void _openUpTimer_Tick( object sender, EventArgs e )
{
_openUpTimer.Tick -= new EventHandler( _openUpTimer_Tick );
_openUpTimer.Stop();
_openUpTimer = null;
_model.Root.Manager.ShowAutoHideWindow( this );
}
protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e )
{
if( _openUpTimer != null )
@ -146,41 +199,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
#region Side
/// <summary>
/// Side Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey SidePropertyKey
= DependencyProperty.RegisterReadOnly( "Side", typeof( AnchorSide ), typeof( LayoutAnchorControl ),
new FrameworkPropertyMetadata( ( AnchorSide )AnchorSide.Left ) );
public static readonly DependencyProperty SideProperty
= SidePropertyKey.DependencyProperty;
/// <summary>
/// Gets the Side property. This dependency property
/// indicates the anchor side of the control.
/// </summary>
public AnchorSide Side
{
get
{
return ( AnchorSide )GetValue( SideProperty );
}
}
/// <summary>
/// Provides a secure method for setting the Side property.
/// This dependency property indicates the anchor side of the control.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetSide( AnchorSide value )
{
SetValue( SidePropertyKey, value );
}
#endregion
}
}

135
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorGroupControl.cs

@ -14,10 +14,7 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Collections.ObjectModel;
using Xceed.Wpf.AvalonDock.Layout;
@ -25,75 +22,95 @@ using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutAnchorGroupControl : Control, ILayoutControl
public class LayoutAnchorGroupControl : Control, ILayoutControl
{
#region Members
private ObservableCollection<LayoutAnchorControl> _childViews = new ObservableCollection<LayoutAnchorControl>();
private LayoutAnchorGroup _model;
#endregion
#region Constructors
static LayoutAnchorGroupControl()
{
static LayoutAnchorGroupControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(LayoutAnchorGroupControl), new FrameworkPropertyMetadata(typeof(LayoutAnchorGroupControl)));
}
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutAnchorGroupControl ), new FrameworkPropertyMetadata( typeof( LayoutAnchorGroupControl ) ) );
}
internal LayoutAnchorGroupControl( LayoutAnchorGroup model )
{
_model = model;
CreateChildrenViews();
internal LayoutAnchorGroupControl(LayoutAnchorGroup model)
{
_model = model;
CreateChildrenViews();
_model.Children.CollectionChanged += ( s, e ) => OnModelChildrenCollectionChanged( e );
}
_model.Children.CollectionChanged += (s, e) => OnModelChildrenCollectionChanged(e);
}
#endregion
private void CreateChildrenViews()
{
var manager = _model.Root.Manager;
foreach (var childModel in _model.Children)
{
_childViews.Add(new LayoutAnchorControl(childModel) { Template = manager.AnchorTemplate });
}
}
#region Properties
private void OnModelChildrenCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace)
{
if (e.OldItems != null)
{
{
foreach (var childModel in e.OldItems)
_childViews.Remove(_childViews.First(cv => cv.Model == childModel));
}
}
}
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
_childViews.Clear();
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace)
{
if (e.NewItems != null)
{
var manager = _model.Root.Manager;
int insertIndex = e.NewStartingIndex;
foreach (LayoutAnchorable childModel in e.NewItems)
{
_childViews.Insert(insertIndex++, new LayoutAnchorControl(childModel) { Template = manager.AnchorTemplate });
}
}
}
}
public ObservableCollection<LayoutAnchorControl> Children
{
get
{
return _childViews;
}
}
public ILayoutElement Model
{
get
{
return _model;
}
}
ObservableCollection<LayoutAnchorControl> _childViews = new ObservableCollection<LayoutAnchorControl>();
#endregion
public ObservableCollection<LayoutAnchorControl> Children
#region Private Methods
private void CreateChildrenViews()
{
var manager = _model.Root.Manager;
foreach( var childModel in _model.Children )
{
_childViews.Add( new LayoutAnchorControl( childModel ) { Template = manager.AnchorTemplate } );
}
}
private void OnModelChildrenCollectionChanged( System.Collections.Specialized.NotifyCollectionChangedEventArgs e )
{
if( e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace )
{
if( e.OldItems != null )
{
get { return _childViews; }
{
foreach( var childModel in e.OldItems )
_childViews.Remove( _childViews.First( cv => cv.Model == childModel ) );
}
}
}
if( e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset )
_childViews.Clear();
LayoutAnchorGroup _model;
public ILayoutElement Model
if( e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace )
{
if( e.NewItems != null )
{
get { return _model; }
var manager = _model.Root.Manager;
int insertIndex = e.NewStartingIndex;
foreach( LayoutAnchorable childModel in e.NewItems )
{
_childViews.Insert( insertIndex++, new LayoutAnchorControl( childModel ) { Template = manager.AnchorTemplate } );
}
}
}
}
#endregion
}
}

158
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorSideControl.cs

@ -25,12 +25,21 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutAnchorSideControl : Control, ILayoutControl
{
#region Members
private LayoutAnchorSide _model = null;
private ObservableCollection<LayoutAnchorGroupControl> _childViews = new ObservableCollection<LayoutAnchorGroupControl>();
#endregion
#region Constructors
static LayoutAnchorSideControl()
{
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutAnchorSideControl ), new FrameworkPropertyMetadata( typeof( LayoutAnchorSideControl ) ) );
}
internal LayoutAnchorSideControl( LayoutAnchorSide model )
{
if( model == null )
@ -46,42 +55,12 @@ namespace Xceed.Wpf.AvalonDock.Controls
UpdateSide();
}
private void CreateChildrenViews()
{
var manager = _model.Root.Manager;
foreach( var childModel in _model.Children )
{
_childViews.Add( manager.CreateUIElementForModel( childModel ) as LayoutAnchorGroupControl );
}
}
#endregion
private void OnModelChildrenCollectionChanged( System.Collections.Specialized.NotifyCollectionChangedEventArgs e )
{
if( e.OldItems != null &&
( e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace ) )
{
foreach( var childModel in e.OldItems )
_childViews.Remove( _childViews.First( cv => cv.Model == childModel ) );
}
#region Properties
if( e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset )
_childViews.Clear();
#region Model
if( e.NewItems != null &&
( e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace ) )
{
var manager = _model.Root.Manager;
int insertIndex = e.NewStartingIndex;
foreach( LayoutAnchorGroup childModel in e.NewItems )
{
_childViews.Insert( insertIndex++, manager.CreateUIElementForModel( childModel ) as LayoutAnchorGroupControl );
}
}
}
LayoutAnchorSide _model = null;
public ILayoutElement Model
{
get
@ -90,7 +69,9 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
ObservableCollection<LayoutAnchorGroupControl> _childViews = new ObservableCollection<LayoutAnchorGroupControl>();
#endregion
#region Children
public ObservableCollection<LayoutAnchorGroupControl> Children
{
@ -100,36 +81,17 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
void UpdateSide()
{
switch( _model.Side )
{
case AnchorSide.Left:
SetIsLeftSide( true );
break;
case AnchorSide.Top:
SetIsTopSide( true );
break;
case AnchorSide.Right:
SetIsRightSide( true );
break;
case AnchorSide.Bottom:
SetIsBottomSide( true );
break;
}
}
#endregion
#region IsLeftSide
/// <summary>
/// IsLeftSide Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey IsLeftSidePropertyKey
= DependencyProperty.RegisterReadOnly( "IsLeftSide", typeof( bool ), typeof( LayoutAnchorSideControl ),
private static readonly DependencyPropertyKey IsLeftSidePropertyKey = DependencyProperty.RegisterReadOnly( "IsLeftSide", typeof( bool ), typeof( LayoutAnchorSideControl ),
new FrameworkPropertyMetadata( ( bool )false ) );
public static readonly DependencyProperty IsLeftSideProperty
= IsLeftSidePropertyKey.DependencyProperty;
public static readonly DependencyProperty IsLeftSideProperty = IsLeftSidePropertyKey.DependencyProperty;
/// <summary>
/// Gets the IsLeftSide property. This dependency property
@ -160,12 +122,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// IsTopSide Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey IsTopSidePropertyKey
= DependencyProperty.RegisterReadOnly( "IsTopSide", typeof( bool ), typeof( LayoutAnchorSideControl ),
private static readonly DependencyPropertyKey IsTopSidePropertyKey = DependencyProperty.RegisterReadOnly( "IsTopSide", typeof( bool ), typeof( LayoutAnchorSideControl ),
new FrameworkPropertyMetadata( ( bool )false ) );
public static readonly DependencyProperty IsTopSideProperty
= IsTopSidePropertyKey.DependencyProperty;
public static readonly DependencyProperty IsTopSideProperty = IsTopSidePropertyKey.DependencyProperty;
/// <summary>
/// Gets the IsTopSide property. This dependency property
@ -196,12 +156,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// IsRightSide Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey IsRightSidePropertyKey
= DependencyProperty.RegisterReadOnly( "IsRightSide", typeof( bool ), typeof( LayoutAnchorSideControl ),
private static readonly DependencyPropertyKey IsRightSidePropertyKey = DependencyProperty.RegisterReadOnly( "IsRightSide", typeof( bool ), typeof( LayoutAnchorSideControl ),
new FrameworkPropertyMetadata( ( bool )false ) );
public static readonly DependencyProperty IsRightSideProperty
= IsRightSidePropertyKey.DependencyProperty;
public static readonly DependencyProperty IsRightSideProperty = IsRightSidePropertyKey.DependencyProperty;
/// <summary>
/// Gets the IsRightSide property. This dependency property
@ -232,12 +190,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// IsBottomSide Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey IsBottomSidePropertyKey
= DependencyProperty.RegisterReadOnly( "IsBottomSide", typeof( bool ), typeof( LayoutAnchorSideControl ),
private static readonly DependencyPropertyKey IsBottomSidePropertyKey = DependencyProperty.RegisterReadOnly( "IsBottomSide", typeof( bool ), typeof( LayoutAnchorSideControl ),
new FrameworkPropertyMetadata( ( bool )false ) );
public static readonly DependencyProperty IsBottomSideProperty
= IsBottomSidePropertyKey.DependencyProperty;
public static readonly DependencyProperty IsBottomSideProperty = IsBottomSidePropertyKey.DependencyProperty;
/// <summary>
/// Gets the IsBottomSide property. This dependency property
@ -263,5 +219,69 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#endregion
#region Overrides
#endregion
#region Private Methods
private void CreateChildrenViews()
{
var manager = _model.Root.Manager;
foreach( var childModel in _model.Children )
{
_childViews.Add( manager.CreateUIElementForModel( childModel ) as LayoutAnchorGroupControl );
}
}
private void OnModelChildrenCollectionChanged( System.Collections.Specialized.NotifyCollectionChangedEventArgs e )
{
if( e.OldItems != null &&
( e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace ) )
{
foreach( var childModel in e.OldItems )
_childViews.Remove( _childViews.First( cv => cv.Model == childModel ) );
}
if( e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset )
_childViews.Clear();
if( e.NewItems != null &&
( e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace ) )
{
var manager = _model.Root.Manager;
int insertIndex = e.NewStartingIndex;
foreach( LayoutAnchorGroup childModel in e.NewItems )
{
_childViews.Insert( insertIndex++, manager.CreateUIElementForModel( childModel ) as LayoutAnchorGroupControl );
}
}
}
private void UpdateSide()
{
switch( _model.Side )
{
case AnchorSide.Left:
SetIsLeftSide( true );
break;
case AnchorSide.Top:
SetIsTopSide( true );
break;
case AnchorSide.Right:
SetIsRightSide( true );
break;
case AnchorSide.Bottom:
SetIsBottomSide( true );
break;
}
}
#endregion
}
}

21
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableControl.cs

@ -22,6 +22,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutAnchorableControl : Control
{
#region Constructors
static LayoutAnchorableControl()
{
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutAnchorableControl ), new FrameworkPropertyMetadata( typeof( LayoutAnchorableControl ) ) );
@ -33,16 +35,17 @@ namespace Xceed.Wpf.AvalonDock.Controls
//SetBinding(FlowDirectionProperty, new Binding("Model.Root.Manager.FlowDirection") { Source = this });
}
#endregion
#region Properties
#region Model
/// <summary>
/// Model Dependency Property
/// </summary>
public static readonly DependencyProperty ModelProperty =
DependencyProperty.Register( "Model", typeof( LayoutAnchorable ), typeof( LayoutAnchorableControl ),
new FrameworkPropertyMetadata( ( LayoutAnchorable )null,
new PropertyChangedCallback( OnModelChanged ) ) );
public static readonly DependencyProperty ModelProperty = DependencyProperty.Register( "Model", typeof( LayoutAnchorable ), typeof( LayoutAnchorableControl ),
new FrameworkPropertyMetadata( ( LayoutAnchorable )null, new PropertyChangedCallback( OnModelChanged ) ) );
/// <summary>
/// Gets or sets the Model property. This dependency property
@ -112,12 +115,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// LayoutItem Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey LayoutItemPropertyKey
= DependencyProperty.RegisterReadOnly( "LayoutItem", typeof( LayoutItem ), typeof( LayoutAnchorableControl ),
private static readonly DependencyPropertyKey LayoutItemPropertyKey = DependencyProperty.RegisterReadOnly( "LayoutItem", typeof( LayoutItem ), typeof( LayoutAnchorableControl ),
new FrameworkPropertyMetadata( ( LayoutItem )null ) );
public static readonly DependencyProperty LayoutItemProperty
= LayoutItemPropertyKey.DependencyProperty;
public static readonly DependencyProperty LayoutItemProperty = LayoutItemPropertyKey.DependencyProperty;
/// <summary>
/// Gets the LayoutItem property. This dependency property
@ -143,6 +144,9 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#endregion
#region Overrides
protected override void OnGotKeyboardFocus( System.Windows.Input.KeyboardFocusChangedEventArgs e )
{
@ -153,5 +157,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
#endregion
}
}

243
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs

@ -17,17 +17,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Runtime.InteropServices;
using System.Windows.Interop;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Input;
using Xceed.Wpf.AvalonDock.Layout;
using Xceed.Wpf.AvalonDock.Converters;
using System.Diagnostics;
using System.Windows.Controls.Primitives;
using Xceed.Wpf.AvalonDock.Commands;
using Microsoft.Windows.Shell;
@ -36,12 +30,21 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutAnchorableFloatingWindowControl : LayoutFloatingWindowControl, IOverlayWindowHost
{
#region Members
private LayoutAnchorableFloatingWindow _model;
private OverlayWindow _overlayWindow = null;
private List<IDropArea> _dropAreas = null;
#endregion
#region Constructors
static LayoutAnchorableFloatingWindowControl()
{
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutAnchorableFloatingWindowControl ), new FrameworkPropertyMetadata( typeof( LayoutAnchorableFloatingWindowControl ) ) );
}
internal LayoutAnchorableFloatingWindowControl( LayoutAnchorableFloatingWindow model )
: base( model )
{
@ -51,33 +54,17 @@ namespace Xceed.Wpf.AvalonDock.Controls
UpdateThemeResources();
}
internal override void UpdateThemeResources( Xceed.Wpf.AvalonDock.Themes.Theme oldTheme = null )
{
base.UpdateThemeResources( oldTheme );
if( _overlayWindow != null )
_overlayWindow.UpdateThemeResources( oldTheme );
}
LayoutAnchorableFloatingWindow _model;
#endregion
public override ILayoutElement Model
{
get
{
return _model;
}
}
#region Properties
#region SingleContentLayoutItem
/// <summary>
/// SingleContentLayoutItem Dependency Property
/// </summary>
public static readonly DependencyProperty SingleContentLayoutItemProperty =
DependencyProperty.Register( "SingleContentLayoutItem", typeof( LayoutItem ), typeof( LayoutAnchorableFloatingWindowControl ),
new FrameworkPropertyMetadata( ( LayoutItem )null,
new PropertyChangedCallback( OnSingleContentLayoutItemChanged ) ) );
public static readonly DependencyProperty SingleContentLayoutItemProperty = DependencyProperty.Register( "SingleContentLayoutItem", typeof( LayoutItem ), typeof( LayoutAnchorableFloatingWindowControl ),
new FrameworkPropertyMetadata( ( LayoutItem )null, new PropertyChangedCallback( OnSingleContentLayoutItemChanged ) ) );
/// <summary>
/// Gets or sets the SingleContentLayoutItem property. This dependency property
@ -112,7 +99,17 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#endregion
#region Overrides
public override ILayoutElement Model
{
get
{
return _model;
}
}
protected override void OnInitialized( EventArgs e )
{
@ -139,89 +136,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
_model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler( _model_PropertyChanged );
}
void _model_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
{
if( e.PropertyName == "RootPanel" &&
_model.RootPanel == null )
{
InternalClose();
}
}
bool IOverlayWindowHost.HitTest( Point dragPoint )
{
Rect detectionRect = new Rect( this.PointToScreenDPIWithoutFlowDirection( new Point() ), this.TransformActualSizeToAncestor() );
return detectionRect.Contains( dragPoint );
}
DockingManager IOverlayWindowHost.Manager
{
get
{
return _model.Root.Manager;
}
}
OverlayWindow _overlayWindow = null;
void CreateOverlayWindow()
{
if( _overlayWindow == null )
_overlayWindow = new OverlayWindow( this );
Rect rectWindow = new Rect( this.PointToScreenDPIWithoutFlowDirection( new Point() ), this.TransformActualSizeToAncestor() );
_overlayWindow.Left = rectWindow.Left;
_overlayWindow.Top = rectWindow.Top;
_overlayWindow.Width = rectWindow.Width;
_overlayWindow.Height = rectWindow.Height;
}
IOverlayWindow IOverlayWindowHost.ShowOverlayWindow( LayoutFloatingWindowControl draggingWindow )
{
CreateOverlayWindow();
_overlayWindow.Owner = draggingWindow;
_overlayWindow.EnableDropTargets();
_overlayWindow.Show();
return _overlayWindow;
}
void IOverlayWindowHost.HideOverlayWindow()
{
_dropAreas = null;
_overlayWindow.Owner = null;
_overlayWindow.HideDropTargets();
}
List<IDropArea> _dropAreas = null;
IEnumerable<IDropArea> IOverlayWindowHost.GetDropAreas( LayoutFloatingWindowControl draggingWindow )
{
if( _dropAreas != null )
return _dropAreas;
_dropAreas = new List<IDropArea>();
if( draggingWindow.Model is LayoutDocumentFloatingWindow )
return _dropAreas;
var rootVisual = ( Content as FloatingWindowContentHost ).RootVisual;
foreach( var areaHost in rootVisual.FindVisualChildren<LayoutAnchorablePaneControl>() )
{
_dropAreas.Add( new DropArea<LayoutAnchorablePaneControl>(
areaHost,
DropAreaType.AnchorablePane ) );
}
foreach( var areaHost in rootVisual.FindVisualChildren<LayoutDocumentPaneControl>() )
{
_dropAreas.Add( new DropArea<LayoutDocumentPaneControl>(
areaHost,
DropAreaType.DocumentPane ) );
}
return _dropAreas;
}
protected override void OnClosed( EventArgs e )
{
var root = Model.Root;
@ -283,7 +197,41 @@ namespace Xceed.Wpf.AvalonDock.Controls
return base.FilterMessage( hwnd, msg, wParam, lParam, ref handled );
}
bool OpenContextMenu()
internal override void UpdateThemeResources( Xceed.Wpf.AvalonDock.Themes.Theme oldTheme = null )
{
base.UpdateThemeResources( oldTheme );
if( _overlayWindow != null )
{
_overlayWindow.UpdateThemeResources( oldTheme );
}
}
#endregion
#region Private Methods
private void _model_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
{
if( e.PropertyName == "RootPanel" &&
_model.RootPanel == null )
{
InternalClose();
}
}
private void CreateOverlayWindow()
{
if( _overlayWindow == null )
_overlayWindow = new OverlayWindow( this );
Rect rectWindow = new Rect( this.PointToScreenDPIWithoutFlowDirection( new Point() ), this.TransformActualSizeToAncestor() );
_overlayWindow.Left = rectWindow.Left;
_overlayWindow.Top = rectWindow.Top;
_overlayWindow.Width = rectWindow.Width;
_overlayWindow.Height = rectWindow.Height;
}
private bool OpenContextMenu()
{
var ctxMenu = _model.Root.Manager.AnchorableContextMenu;
if( ctxMenu != null && SingleContentLayoutItem != null )
@ -298,7 +246,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
return false;
}
bool IsContextMenuOpen()
private bool IsContextMenuOpen()
{
var ctxMenu = _model.Root.Manager.AnchorableContextMenu;
if( ctxMenu != null && SingleContentLayoutItem != null )
@ -309,7 +257,12 @@ namespace Xceed.Wpf.AvalonDock.Controls
return false;
}
#endregion
#region Commands
#region HideWindowCommand
public ICommand HideWindowCommand
{
get;
@ -417,6 +370,72 @@ namespace Xceed.Wpf.AvalonDock.Controls
anchorableLayoutItem.CloseCommand.Execute( parameter );
}
}
#endregion
#endregion
#region IOverlayWindowHost
bool IOverlayWindowHost.HitTest( Point dragPoint )
{
Rect detectionRect = new Rect( this.PointToScreenDPIWithoutFlowDirection( new Point() ), this.TransformActualSizeToAncestor() );
return detectionRect.Contains( dragPoint );
}
DockingManager IOverlayWindowHost.Manager
{
get
{
return _model.Root.Manager;
}
}
IOverlayWindow IOverlayWindowHost.ShowOverlayWindow( LayoutFloatingWindowControl draggingWindow )
{
CreateOverlayWindow();
_overlayWindow.Owner = draggingWindow;
_overlayWindow.EnableDropTargets();
_overlayWindow.Show();
return _overlayWindow;
}
void IOverlayWindowHost.HideOverlayWindow()
{
_dropAreas = null;
_overlayWindow.Owner = null;
_overlayWindow.HideDropTargets();
}
IEnumerable<IDropArea> IOverlayWindowHost.GetDropAreas( LayoutFloatingWindowControl draggingWindow )
{
if( _dropAreas != null )
return _dropAreas;
_dropAreas = new List<IDropArea>();
if( draggingWindow.Model is LayoutDocumentFloatingWindow )
return _dropAreas;
var rootVisual = ( Content as FloatingWindowContentHost ).RootVisual;
foreach( var areaHost in rootVisual.FindVisualChildren<LayoutAnchorablePaneControl>() )
{
_dropAreas.Add( new DropArea<LayoutAnchorablePaneControl>(
areaHost,
DropAreaType.AnchorablePane ) );
}
foreach( var areaHost in rootVisual.FindVisualChildren<LayoutDocumentPaneControl>() )
{
_dropAreas.Add( new DropArea<LayoutDocumentPaneControl>(
areaHost,
DropAreaType.DocumentPane ) );
}
return _dropAreas;
}
#endregion
}
}

600
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableItem.cs

@ -15,9 +15,6 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xceed.Wpf.AvalonDock.Layout;
using System.Windows.Input;
using System.Windows;
@ -26,341 +23,370 @@ using System.Windows.Data;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutAnchorableItem : LayoutItem
public class LayoutAnchorableItem : LayoutItem
{
#region Members
private LayoutAnchorable _anchorable;
private ICommand _defaultHideCommand;
private ICommand _defaultAutoHideCommand;
private ICommand _defaultDockCommand;
private ReentrantFlag _visibilityReentrantFlag = new ReentrantFlag();
#endregion
#region Constructors
internal LayoutAnchorableItem()
{
LayoutAnchorable _anchorable;
internal LayoutAnchorableItem()
{
}
}
#endregion
internal override void Attach(LayoutContent model)
{
_anchorable = model as LayoutAnchorable;
_anchorable.IsVisibleChanged += new EventHandler(_anchorable_IsVisibleChanged);
#region Properties
base.Attach(model);
}
#region HideCommand
internal override void Detach()
{
_anchorable.IsVisibleChanged -= new EventHandler(_anchorable_IsVisibleChanged);
_anchorable = null;
base.Detach();
}
/// <summary>
/// HideCommand Dependency Property
/// </summary>
public static readonly DependencyProperty HideCommandProperty = DependencyProperty.Register( "HideCommand", typeof( ICommand ), typeof( LayoutAnchorableItem ),
new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnHideCommandChanged ), new CoerceValueCallback( CoerceHideCommandValue ) ) );
protected override void Close()
{
if( (_anchorable.Root != null) && (_anchorable.Root.Manager != null) )
{
var dockingManager = _anchorable.Root.Manager;
dockingManager._ExecuteCloseCommand( _anchorable );
}
}
/// <summary>
/// Gets or sets the HideCommand property. This dependency property
/// indicates the command to execute when an anchorable is hidden.
/// </summary>
public ICommand HideCommand
{
get
{
return ( ICommand )GetValue( HideCommandProperty );
}
set
{
SetValue( HideCommandProperty, value );
}
}
ICommand _defaultHideCommand;
ICommand _defaultAutoHideCommand;
ICommand _defaultDockCommand;
/// <summary>
/// Handles changes to the HideCommand property.
/// </summary>
private static void OnHideCommandChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( LayoutAnchorableItem )d ).OnHideCommandChanged( e );
}
protected override void InitDefaultCommands()
{
_defaultHideCommand = new RelayCommand((p) => ExecuteHideCommand(p), (p) => CanExecuteHideCommand(p));
_defaultAutoHideCommand = new RelayCommand((p) => ExecuteAutoHideCommand(p), (p) => CanExecuteAutoHideCommand(p));
_defaultDockCommand = new RelayCommand((p) => ExecuteDockCommand(p), (p) => CanExecuteDockCommand(p));
/// <summary>
/// Provides derived classes an opportunity to handle changes to the HideCommand property.
/// </summary>
protected virtual void OnHideCommandChanged( DependencyPropertyChangedEventArgs e )
{
}
base.InitDefaultCommands();
}
/// <summary>
/// Coerces the HideCommand value.
/// </summary>
private static object CoerceHideCommandValue( DependencyObject d, object value )
{
return value;
}
protected override void ClearDefaultBindings()
{
if (HideCommand == _defaultHideCommand)
BindingOperations.ClearBinding(this, HideCommandProperty);
if (AutoHideCommand == _defaultAutoHideCommand)
BindingOperations.ClearBinding(this, AutoHideCommandProperty);
if (DockCommand == _defaultDockCommand)
BindingOperations.ClearBinding(this, DockCommandProperty);
base.ClearDefaultBindings();
}
private bool CanExecuteHideCommand( object parameter )
{
if( LayoutElement == null )
return false;
return _anchorable.CanHide;
}
protected override void SetDefaultBindings()
{
if (HideCommand == null)
HideCommand = _defaultHideCommand;
if (AutoHideCommand == null)
AutoHideCommand = _defaultAutoHideCommand;
if (DockCommand == null)
DockCommand = _defaultDockCommand;
Visibility = _anchorable.IsVisible ? Visibility.Visible : System.Windows.Visibility.Hidden;
base.SetDefaultBindings();
}
private void ExecuteHideCommand( object parameter )
{
if( _anchorable != null && _anchorable.Root != null && _anchorable.Root.Manager != null )
_anchorable.Root.Manager._ExecuteHideCommand( _anchorable );
}
#endregion
#region HideCommand
#region AutoHideCommand
/// <summary>
/// HideCommand Dependency Property
/// </summary>
public static readonly DependencyProperty HideCommandProperty =
DependencyProperty.Register("HideCommand", typeof(ICommand), typeof(LayoutAnchorableItem),
new FrameworkPropertyMetadata(null,
new PropertyChangedCallback(OnHideCommandChanged),
new CoerceValueCallback(CoerceHideCommandValue)));
/// <summary>
/// AutoHideCommand Dependency Property
/// </summary>
public static readonly DependencyProperty AutoHideCommandProperty = DependencyProperty.Register( "AutoHideCommand", typeof( ICommand ), typeof( LayoutAnchorableItem ),
new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnAutoHideCommandChanged ), new CoerceValueCallback( CoerceAutoHideCommandValue ) ) );
/// <summary>
/// Gets or sets the HideCommand property. This dependency property
/// indicates the command to execute when an anchorable is hidden.
/// </summary>
public ICommand HideCommand
{
get { return (ICommand)GetValue(HideCommandProperty); }
set { SetValue(HideCommandProperty, value); }
}
/// <summary>
/// Gets or sets the AutoHideCommand property. This dependency property
/// indicates the command to execute when user click the auto hide button.
/// </summary>
/// <remarks>By default this command toggles auto hide state for an anchorable.</remarks>
public ICommand AutoHideCommand
{
get
{
return ( ICommand )GetValue( AutoHideCommandProperty );
}
set
{
SetValue( AutoHideCommandProperty, value );
}
}
/// <summary>
/// Handles changes to the HideCommand property.
/// </summary>
private static void OnHideCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((LayoutAnchorableItem)d).OnHideCommandChanged(e);
}
/// <summary>
/// Handles changes to the AutoHideCommand property.
/// </summary>
private static void OnAutoHideCommandChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( LayoutAnchorableItem )d ).OnAutoHideCommandChanged( e );
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the HideCommand property.
/// </summary>
protected virtual void OnHideCommandChanged(DependencyPropertyChangedEventArgs e)
{
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the AutoHideCommand property.
/// </summary>
protected virtual void OnAutoHideCommandChanged( DependencyPropertyChangedEventArgs e )
{
}
/// <summary>
/// Coerces the HideCommand value.
/// </summary>
private static object CoerceHideCommandValue(DependencyObject d, object value)
{
return value;
}
/// <summary>
/// Coerces the AutoHideCommand value.
/// </summary>
private static object CoerceAutoHideCommandValue( DependencyObject d, object value )
{
return value;
}
private bool CanExecuteAutoHideCommand( object parameter )
{
if( LayoutElement == null )
return false;
private bool CanExecuteHideCommand(object parameter)
{
if (LayoutElement == null)
return false;
return _anchorable.CanHide;
}
if( LayoutElement.FindParent<LayoutAnchorableFloatingWindow>() != null )
return false;//is floating
private void ExecuteHideCommand(object parameter)
{
if (_anchorable != null && _anchorable.Root != null && _anchorable.Root.Manager != null)
_anchorable.Root.Manager._ExecuteHideCommand(_anchorable);
}
return _anchorable.CanAutoHide;
}
#endregion
#region AutoHideCommand
/// <summary>
/// AutoHideCommand Dependency Property
/// </summary>
public static readonly DependencyProperty AutoHideCommandProperty =
DependencyProperty.Register("AutoHideCommand", typeof(ICommand), typeof(LayoutAnchorableItem),
new FrameworkPropertyMetadata(null,
new PropertyChangedCallback(OnAutoHideCommandChanged),
new CoerceValueCallback(CoerceAutoHideCommandValue)));
/// <summary>
/// Gets or sets the AutoHideCommand property. This dependency property
/// indicates the command to execute when user click the auto hide button.
/// </summary>
/// <remarks>By default this command toggles auto hide state for an anchorable.</remarks>
public ICommand AutoHideCommand
{
get { return (ICommand)GetValue(AutoHideCommandProperty); }
set { SetValue(AutoHideCommandProperty, value); }
}
private void ExecuteAutoHideCommand( object parameter )
{
if( _anchorable != null && _anchorable.Root != null && _anchorable.Root.Manager != null )
_anchorable.Root.Manager._ExecuteAutoHideCommand( _anchorable );
}
/// <summary>
/// Handles changes to the AutoHideCommand property.
/// </summary>
private static void OnAutoHideCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((LayoutAnchorableItem)d).OnAutoHideCommandChanged(e);
}
#endregion
/// <summary>
/// Provides derived classes an opportunity to handle changes to the AutoHideCommand property.
/// </summary>
protected virtual void OnAutoHideCommandChanged(DependencyPropertyChangedEventArgs e)
{
}
#region DockCommand
/// <summary>
/// Coerces the AutoHideCommand value.
/// </summary>
private static object CoerceAutoHideCommandValue(DependencyObject d, object value)
{
return value;
}
/// <summary>
/// DockCommand Dependency Property
/// </summary>
public static readonly DependencyProperty DockCommandProperty = DependencyProperty.Register( "DockCommand", typeof( ICommand ), typeof( LayoutAnchorableItem ),
new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnDockCommandChanged ), new CoerceValueCallback( CoerceDockCommandValue ) ) );
private bool CanExecuteAutoHideCommand(object parameter)
{
if (LayoutElement == null)
return false;
/// <summary>
/// Gets or sets the DockCommand property. This dependency property
/// indicates the command to execute when user click the Dock button.
/// </summary>
/// <remarks>By default this command moves the anchorable inside the container pane which previously hosted the object.</remarks>
public ICommand DockCommand
{
get
{
return ( ICommand )GetValue( DockCommandProperty );
}
set
{
SetValue( DockCommandProperty, value );
}
}
if (LayoutElement.FindParent<LayoutAnchorableFloatingWindow>() != null)
return false;//is floating
/// <summary>
/// Handles changes to the DockCommand property.
/// </summary>
private static void OnDockCommandChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( LayoutAnchorableItem )d ).OnDockCommandChanged( e );
}
return _anchorable.CanAutoHide;
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the DockCommand property.
/// </summary>
protected virtual void OnDockCommandChanged( DependencyPropertyChangedEventArgs e )
{
}
private void ExecuteAutoHideCommand(object parameter)
{
if (_anchorable != null && _anchorable.Root != null && _anchorable.Root.Manager != null)
_anchorable.Root.Manager._ExecuteAutoHideCommand(_anchorable);
}
/// <summary>
/// Coerces the DockCommand value.
/// </summary>
private static object CoerceDockCommandValue( DependencyObject d, object value )
{
return value;
}
#endregion
#region DockCommand
/// <summary>
/// DockCommand Dependency Property
/// </summary>
public static readonly DependencyProperty DockCommandProperty =
DependencyProperty.Register("DockCommand", typeof(ICommand), typeof(LayoutAnchorableItem),
new FrameworkPropertyMetadata(null,
new PropertyChangedCallback(OnDockCommandChanged),
new CoerceValueCallback(CoerceDockCommandValue)));
/// <summary>
/// Gets or sets the DockCommand property. This dependency property
/// indicates the command to execute when user click the Dock button.
/// </summary>
/// <remarks>By default this command moves the anchorable inside the container pane which previously hosted the object.</remarks>
public ICommand DockCommand
{
get { return (ICommand)GetValue(DockCommandProperty); }
set { SetValue(DockCommandProperty, value); }
}
private bool CanExecuteDockCommand( object parameter )
{
if( LayoutElement == null )
return false;
return LayoutElement.FindParent<LayoutAnchorableFloatingWindow>() != null;
}
/// <summary>
/// Handles changes to the DockCommand property.
/// </summary>
private static void OnDockCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((LayoutAnchorableItem)d).OnDockCommandChanged(e);
}
private void ExecuteDockCommand( object parameter )
{
LayoutElement.Root.Manager._ExecuteDockCommand( _anchorable );
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the DockCommand property.
/// </summary>
protected virtual void OnDockCommandChanged(DependencyPropertyChangedEventArgs e)
{
}
#endregion
/// <summary>
/// Coerces the DockCommand value.
/// </summary>
private static object CoerceDockCommandValue(DependencyObject d, object value)
{
return value;
}
#region CanHide
private bool CanExecuteDockCommand(object parameter)
{
if (LayoutElement == null)
return false;
return LayoutElement.FindParent<LayoutAnchorableFloatingWindow>() != null;
}
/// <summary>
/// CanHide Dependency Property
/// </summary>
public static readonly DependencyProperty CanHideProperty = DependencyProperty.Register( "CanHide", typeof( bool ), typeof( LayoutAnchorableItem ), new FrameworkPropertyMetadata( ( bool )true,
new PropertyChangedCallback( OnCanHideChanged ) ) );
private void ExecuteDockCommand(object parameter)
{
LayoutElement.Root.Manager._ExecuteDockCommand(_anchorable);
}
/// <summary>
/// Gets or sets the CanHide property. This dependency property
/// indicates if user can hide the anchorable item.
/// </summary>
public bool CanHide
{
get
{
return ( bool )GetValue( CanHideProperty );
}
set
{
SetValue( CanHideProperty, value );
}
}
#endregion
/// <summary>
/// Handles changes to the CanHide property.
/// </summary>
private static void OnCanHideChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( LayoutAnchorableItem )d ).OnCanHideChanged( e );
}
#region Visibility
ReentrantFlag _visibilityReentrantFlag = new ReentrantFlag();
/// <summary>
/// Provides derived classes an opportunity to handle changes to the CanHide property.
/// </summary>
protected virtual void OnCanHideChanged( DependencyPropertyChangedEventArgs e )
{
if( _anchorable != null )
_anchorable.CanHide = ( bool )e.NewValue;
}
protected override void OnVisibilityChanged()
{
if (_anchorable != null && _anchorable.Root != null)
{
if (_visibilityReentrantFlag.CanEnter)
{
using (_visibilityReentrantFlag.Enter())
{
if (Visibility == System.Windows.Visibility.Hidden)
_anchorable.Hide(false);
else if (Visibility == System.Windows.Visibility.Visible)
_anchorable.Show();
}
}
}
base.OnVisibilityChanged();
}
#endregion
#endregion
void _anchorable_IsVisibleChanged(object sender, EventArgs e)
{
if (_anchorable != null && _anchorable.Root != null)
{
if (_visibilityReentrantFlag.CanEnter)
{
using (_visibilityReentrantFlag.Enter())
{
if (_anchorable.IsVisible)
Visibility = Visibility.Visible;
else
Visibility = Visibility.Hidden;
}
}
}
}
#region Overrides
#endregion
internal override void Attach( LayoutContent model )
{
_anchorable = model as LayoutAnchorable;
_anchorable.IsVisibleChanged += new EventHandler( _anchorable_IsVisibleChanged );
#region CanHide
base.Attach( model );
}
/// <summary>
/// CanHide Dependency Property
/// </summary>
public static readonly DependencyProperty CanHideProperty =
DependencyProperty.Register("CanHide", typeof(bool), typeof(LayoutAnchorableItem),
new FrameworkPropertyMetadata((bool)true,
new PropertyChangedCallback(OnCanHideChanged)));
internal override void Detach()
{
_anchorable.IsVisibleChanged -= new EventHandler( _anchorable_IsVisibleChanged );
_anchorable = null;
base.Detach();
}
/// <summary>
/// Gets or sets the CanHide property. This dependency property
/// indicates if user can hide the anchorable item.
/// </summary>
public bool CanHide
{
get { return (bool)GetValue(CanHideProperty); }
set { SetValue(CanHideProperty, value); }
}
protected override void Close()
{
if( ( _anchorable.Root != null ) && ( _anchorable.Root.Manager != null ) )
{
var dockingManager = _anchorable.Root.Manager;
dockingManager._ExecuteCloseCommand( _anchorable );
}
}
protected override void InitDefaultCommands()
{
_defaultHideCommand = new RelayCommand( ( p ) => ExecuteHideCommand( p ), ( p ) => CanExecuteHideCommand( p ) );
_defaultAutoHideCommand = new RelayCommand( ( p ) => ExecuteAutoHideCommand( p ), ( p ) => CanExecuteAutoHideCommand( p ) );
_defaultDockCommand = new RelayCommand( ( p ) => ExecuteDockCommand( p ), ( p ) => CanExecuteDockCommand( p ) );
base.InitDefaultCommands();
}
protected override void ClearDefaultBindings()
{
if( HideCommand == _defaultHideCommand )
BindingOperations.ClearBinding( this, HideCommandProperty );
if( AutoHideCommand == _defaultAutoHideCommand )
BindingOperations.ClearBinding( this, AutoHideCommandProperty );
if( DockCommand == _defaultDockCommand )
BindingOperations.ClearBinding( this, DockCommandProperty );
base.ClearDefaultBindings();
}
protected override void SetDefaultBindings()
{
if( HideCommand == null )
HideCommand = _defaultHideCommand;
if( AutoHideCommand == null )
AutoHideCommand = _defaultAutoHideCommand;
if( DockCommand == null )
DockCommand = _defaultDockCommand;
Visibility = _anchorable.IsVisible ? Visibility.Visible : System.Windows.Visibility.Hidden;
base.SetDefaultBindings();
}
/// <summary>
/// Handles changes to the CanHide property.
/// </summary>
private static void OnCanHideChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
protected override void OnVisibilityChanged()
{
if( _anchorable != null && _anchorable.Root != null )
{
if( _visibilityReentrantFlag.CanEnter )
{
((LayoutAnchorableItem)d).OnCanHideChanged(e);
using( _visibilityReentrantFlag.Enter() )
{
if( Visibility == System.Windows.Visibility.Hidden )
_anchorable.Hide( false );
else if( Visibility == System.Windows.Visibility.Visible )
_anchorable.Show();
}
}
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the CanHide property.
/// </summary>
protected virtual void OnCanHideChanged(DependencyPropertyChangedEventArgs e)
base.OnVisibilityChanged();
}
#endregion
#region Private Methods
private void _anchorable_IsVisibleChanged( object sender, EventArgs e )
{
if( _anchorable != null && _anchorable.Root != null )
{
if( _visibilityReentrantFlag.CanEnter )
{
if (_anchorable != null)
_anchorable.CanHide = (bool)e.NewValue;
using( _visibilityReentrantFlag.Enter() )
{
if( _anchorable.IsVisible )
Visibility = Visibility.Visible;
else
Visibility = Visibility.Hidden;
}
}
}
}
#endregion
}
#endregion
}
}

34
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneControl.cs

@ -24,6 +24,14 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutAnchorablePaneControl : TabControl, ILayoutControl//, ILogicalChildrenContainer
{
#region Members
private LayoutAnchorablePane _model;
#endregion
#region Constructors
static LayoutAnchorablePaneControl()
{
FocusableProperty.OverrideMetadata( typeof( LayoutAnchorablePaneControl ), new FrameworkPropertyMetadata( false ) );
@ -42,14 +50,9 @@ namespace Xceed.Wpf.AvalonDock.Controls
this.LayoutUpdated += new EventHandler( OnLayoutUpdated );
}
void OnLayoutUpdated( object sender, EventArgs e )
{
var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
modelWithAtcualSize.ActualWidth = ActualWidth;
modelWithAtcualSize.ActualHeight = ActualHeight;
}
#endregion
LayoutAnchorablePane _model;
#region Properties
public ILayoutElement Model
{
@ -59,6 +62,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
#endregion
#region Overrides
protected override void OnGotKeyboardFocus( System.Windows.Input.KeyboardFocusChangedEventArgs e )
{
if( ( _model != null ) && ( _model.SelectedContent != null ) )
@ -89,5 +96,18 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
#endregion
#region Private Methods
private void OnLayoutUpdated( object sender, EventArgs e )
{
var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
modelWithAtcualSize.ActualWidth = ActualWidth;
modelWithAtcualSize.ActualHeight = ActualHeight;
}
#endregion
}
}

82
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorablePaneGroupControl.cs

@ -14,54 +14,60 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutAnchorablePaneGroupControl : LayoutGridControl<ILayoutAnchorablePane>, ILayoutControl
public class LayoutAnchorablePaneGroupControl : LayoutGridControl<ILayoutAnchorablePane>, ILayoutControl
{
#region Members
private LayoutAnchorablePaneGroup _model;
#endregion
#region Constructors
internal LayoutAnchorablePaneGroupControl( LayoutAnchorablePaneGroup model )
: base( model, model.Orientation )
{
internal LayoutAnchorablePaneGroupControl(LayoutAnchorablePaneGroup model)
: base(model, model.Orientation)
{
_model = model;
}
_model = model;
}
#endregion
LayoutAnchorablePaneGroup _model;
#region Overrides
protected override void OnFixChildrenDockLengths()
protected override void OnFixChildrenDockLengths()
{
#region Setup DockWidth/Height for children
if( _model.Orientation == Orientation.Horizontal )
{
for( int i = 0; i < _model.Children.Count; i++ )
{
#region Setup DockWidth/Height for children
if (_model.Orientation == Orientation.Horizontal)
{
for (int i = 0; i < _model.Children.Count; i++)
{
var childModel = _model.Children[i] as ILayoutPositionableElement;
if (!childModel.DockWidth.IsStar)
{
childModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
}
}
}
else
{
for (int i = 0; i < _model.Children.Count; i++)
{
var childModel = _model.Children[i] as ILayoutPositionableElement;
if (!childModel.DockHeight.IsStar)
{
childModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
}
}
}
#endregion
var childModel = _model.Children[ i ] as ILayoutPositionableElement;
if( !childModel.DockWidth.IsStar )
{
childModel.DockWidth = new GridLength( 1.0, GridUnitType.Star );
}
}
}
else
{
for( int i = 0; i < _model.Children.Count; i++ )
{
var childModel = _model.Children[ i ] as ILayoutPositionableElement;
if( !childModel.DockHeight.IsStar )
{
childModel.DockHeight = new GridLength( 1.0, GridUnitType.Star );
}
}
}
#endregion
}
#endregion
}
}

49
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs

@ -14,17 +14,11 @@
***********************************************************************************/
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.Input;
using Xceed.Wpf.AvalonDock.Layout;
using System.Reflection;
using System.Diagnostics;
namespace Xceed.Wpf.AvalonDock.Controls
{
@ -38,6 +32,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#region Constructors
static LayoutAnchorableTabItem()
{
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutAnchorableTabItem ), new FrameworkPropertyMetadata( typeof( LayoutAnchorableTabItem ) ) );
@ -47,17 +43,17 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
}
#endregion
#region Properties
#region Model
/// <summary>
/// Model Dependency Property
/// </summary>
public static readonly DependencyProperty ModelProperty =
DependencyProperty.Register( "Model", typeof( LayoutContent ), typeof( LayoutAnchorableTabItem ),
new FrameworkPropertyMetadata( (LayoutContent)null,
new PropertyChangedCallback( OnModelChanged ) ) );
public static readonly DependencyProperty ModelProperty = DependencyProperty.Register( "Model", typeof( LayoutContent ), typeof( LayoutAnchorableTabItem ),
new FrameworkPropertyMetadata( ( LayoutContent )null, new PropertyChangedCallback( OnModelChanged ) ) );
/// <summary>
/// Gets or sets the Model property. This dependency property
@ -67,7 +63,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
get
{
return (LayoutContent)GetValue( ModelProperty );
return ( LayoutContent )GetValue( ModelProperty );
}
set
{
@ -80,7 +76,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// </summary>
private static void OnModelChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( (LayoutAnchorableTabItem)d ).OnModelChanged( e );
( ( LayoutAnchorableTabItem )d ).OnModelChanged( e );
}
/// <summary>
@ -102,12 +98,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// LayoutItem Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey LayoutItemPropertyKey
= DependencyProperty.RegisterReadOnly( "LayoutItem", typeof( LayoutItem ), typeof( LayoutAnchorableTabItem ),
new FrameworkPropertyMetadata( (LayoutItem)null ) );
private static readonly DependencyPropertyKey LayoutItemPropertyKey = DependencyProperty.RegisterReadOnly( "LayoutItem", typeof( LayoutItem ), typeof( LayoutAnchorableTabItem ),
new FrameworkPropertyMetadata( ( LayoutItem )null ) );
public static readonly DependencyProperty LayoutItemProperty
= LayoutItemPropertyKey.DependencyProperty;
public static readonly DependencyProperty LayoutItemProperty = LayoutItemPropertyKey.DependencyProperty;
/// <summary>
/// Gets the LayoutItem property. This dependency property
@ -117,7 +111,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
get
{
return (LayoutItem)GetValue( LayoutItemProperty );
return ( LayoutItem )GetValue( LayoutItemProperty );
}
}
@ -133,6 +127,9 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#endregion
#region Overrides
protected override void OnMouseLeftButtonDown( System.Windows.Input.MouseButtonEventArgs e )
{
base.OnMouseLeftButtonDown( e );
@ -184,17 +181,16 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
base.OnMouseEnter( e );
if( _draggingItem != null &&
_draggingItem != this &&
if( _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 )
if( ( containerPane is LayoutAnchorablePane ) && !( ( LayoutAnchorablePane )containerPane ).CanRepositionItems )
return;
if( ( containerPane.Parent != null ) && ( containerPane.Parent is LayoutAnchorablePaneGroup ) && !( (LayoutAnchorablePaneGroup)containerPane.Parent ).CanRepositionItems )
if( ( containerPane.Parent != null ) && ( containerPane.Parent is LayoutAnchorablePaneGroup ) && !( ( LayoutAnchorablePaneGroup )containerPane.Parent ).CanRepositionItems )
return;
var childrenList = container.Children.ToList();
@ -208,6 +204,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
#endregion
#region Internal Methods
internal static bool IsDraggingItem()
{
return _draggingItem != null;
@ -221,10 +221,11 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
_draggingItem = null;
}
internal static void CancelMouseLeave()
{
_cancelMouseLeave = true;
}
}
#endregion
}
}

378
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAutoHideWindowControl.cs

@ -29,6 +29,28 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutAutoHideWindowControl : HwndHost, ILayoutControl
{
#region Members
internal LayoutAnchorableControl _internalHost = null;
private LayoutAnchorControl _anchor;
private LayoutAnchorable _model;
private HwndSource _internalHwndSource = null;
private IntPtr parentWindowHandle;
private bool _internalHost_ContentRendered = false;
private ContentPresenter _internalHostPresenter = new ContentPresenter();
private Grid _internalGrid = null;
private AnchorSide _side;
private LayoutGridResizerControl _resizer = null;
private DockingManager _manager;
private Border _resizerGhost = null;
private Window _resizerWindowHost = null;
private Vector _initialStartPoint;
#endregion
#region Constructors
static LayoutAutoHideWindowControl()
{
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutAutoHideWindowControl ), new FrameworkPropertyMetadata( typeof( LayoutAutoHideWindowControl ) ) );
@ -41,41 +63,63 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
}
internal void Show( LayoutAnchorControl anchor )
{
if( _model != null )
throw new InvalidOperationException();
#endregion
_anchor = anchor;
_model = anchor.Model as LayoutAnchorable;
_side = ( anchor.Model.Parent.Parent as LayoutAnchorSide ).Side;
_manager = _model.Root.Manager;
CreateInternalGrid();
#region Properties
_model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler( _model_PropertyChanged );
#region AnchorableStyle
Visibility = System.Windows.Visibility.Visible;
InvalidateMeasure();
UpdateWindowPos();
}
/// <summary>
/// AnchorableStyle Dependency Property
/// </summary>
public static readonly DependencyProperty AnchorableStyleProperty = DependencyProperty.Register( "AnchorableStyle", typeof( Style ), typeof( LayoutAutoHideWindowControl ),
new FrameworkPropertyMetadata( ( Style )null ) );
internal void Hide()
/// <summary>
/// Gets or sets the AnchorableStyle property. This dependency property
/// indicates the style to apply to the LayoutAnchorableControl hosted in this auto hide window.
/// </summary>
public Style AnchorableStyle
{
if( _model == null )
return;
get
{
return ( Style )GetValue( AnchorableStyleProperty );
}
set
{
SetValue( AnchorableStyleProperty, value );
}
}
_model.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler( _model_PropertyChanged );
#endregion
RemoveInternalGrid();
_anchor = null;
_model = null;
_manager = null;
Visibility = System.Windows.Visibility.Hidden;
#region Background
/// <summary>
/// Background Dependency Property
/// </summary>
public static readonly DependencyProperty BackgroundProperty = DependencyProperty.Register( "Background", typeof( Brush ), typeof( LayoutAutoHideWindowControl ),
new FrameworkPropertyMetadata( ( Brush )null ) );
/// <summary>
/// Gets or sets the Background property. This dependency property
/// indicates background of the autohide childwindow.
/// </summary>
public Brush Background
{
get
{
return ( Brush )GetValue( BackgroundProperty );
}
set
{
SetValue( BackgroundProperty, value );
}
}
LayoutAnchorControl _anchor;
#endregion
LayoutAnchorable _model;
#region Model
public ILayoutElement Model
{
@ -85,8 +129,22 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
HwndSource _internalHwndSource = null;
IntPtr parentWindowHandle;
#endregion
#region Resizer
internal bool IsResizing
{
get;
private set;
}
#endregion
#endregion
#region Overrides
protected override System.Runtime.InteropServices.HandleRef BuildWindowCore( System.Runtime.InteropServices.HandleRef hwndParent )
{
parentWindowHandle = hwndParent.Handle;
@ -106,14 +164,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
return new HandleRef( this, _internalHwndSource.Handle );
}
private bool _internalHost_ContentRendered = false;
void _internalHwndSource_ContentRendered( object sender, EventArgs e )
{
_internalHost_ContentRendered = true;
}
protected override IntPtr WndProc( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled )
{
if( msg == Win32Helper.WM_WINDOWPOSCHANGING )
@ -137,18 +187,117 @@ namespace Xceed.Wpf.AvalonDock.Controls
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
}
protected override bool HasFocusWithinCore()
{
return false;
}
protected override System.Collections.IEnumerator LogicalChildren
{
get
{
if( _internalHostPresenter == null )
return new UIElement[] { }.GetEnumerator();
return new UIElement[] { _internalHostPresenter }.GetEnumerator();
}
}
ContentPresenter _internalHostPresenter = new ContentPresenter();
Grid _internalGrid = null;
internal LayoutAnchorableControl _internalHost = null;
AnchorSide _side;
LayoutGridResizerControl _resizer = null;
DockingManager _manager;
protected override Size MeasureOverride( Size constraint )
{
if( _internalHostPresenter == null )
return base.MeasureOverride( constraint );
_internalHostPresenter.Measure( constraint );
//return base.MeasureOverride(constraint);
return _internalHostPresenter.DesiredSize;
}
void _model_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
protected override Size ArrangeOverride( Size finalSize )
{
if( _internalHostPresenter == null )
return base.ArrangeOverride( finalSize );
_internalHostPresenter.Arrange( new Rect( finalSize ) );
return base.ArrangeOverride( finalSize );// new Size(_internalHostPresenter.ActualWidth, _internalHostPresenter.ActualHeight);
}
#endregion
#region Internal Methods
internal void Show( LayoutAnchorControl anchor )
{
if( _model != null )
throw new InvalidOperationException();
_anchor = anchor;
_model = anchor.Model as LayoutAnchorable;
_side = ( anchor.Model.Parent.Parent as LayoutAnchorSide ).Side;
_manager = _model.Root.Manager;
CreateInternalGrid();
_model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler( _model_PropertyChanged );
Visibility = System.Windows.Visibility.Visible;
InvalidateMeasure();
UpdateWindowPos();
}
internal void Hide()
{
if( _model == null )
return;
_model.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler( _model_PropertyChanged );
RemoveInternalGrid();
_anchor = null;
_model = null;
_manager = null;
Visibility = System.Windows.Visibility.Hidden;
}
internal bool IsWin32MouseOver
{
get
{
var ptMouse = new Win32Helper.Win32Point();
if( !Win32Helper.GetCursorPos( ref ptMouse ) )
return false;
Point location = this.PointToScreenDPI( new Point() );
Rect rectWindow = this.GetScreenArea();
if( rectWindow.Contains( new Point( ptMouse.X, ptMouse.Y ) ) )
return true;
var manager = Model.Root.Manager;
var anchor = manager.FindVisualChildren<LayoutAnchorControl>().Where( c => c.Model == Model ).FirstOrDefault();
if( anchor == null )
return false;
location = anchor.PointToScreenDPI( new Point() );
if( anchor.IsMouseOver )
return true;
return false;
}
}
#endregion
#region Private Methods
private void _internalHwndSource_ContentRendered( object sender, EventArgs e )
{
_internalHost_ContentRendered = true;
}
private void _model_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
{
if( e.PropertyName == "IsAutoHidden" )
{
@ -159,7 +308,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
void CreateInternalGrid()
private void CreateInternalGrid()
{
_internalGrid = new Grid() { FlowDirection = System.Windows.FlowDirection.LeftToRight };
_internalGrid.SetBinding( Grid.BackgroundProperty, new Binding( "Background" ) { Source = this } );
@ -248,7 +397,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
_internalHostPresenter.Content = _internalGrid;
}
void RemoveInternalGrid()
private void RemoveInternalGrid()
{
_resizer.DragStarted -= new System.Windows.Controls.Primitives.DragStartedEventHandler( OnResizerDragStarted );
_resizer.DragDelta -= new System.Windows.Controls.Primitives.DragDeltaEventHandler( OnResizerDragDelta );
@ -257,19 +406,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
_internalHostPresenter.Content = null;
}
protected override bool HasFocusWithinCore()
{
return false;
}
#region Resizer
Border _resizerGhost = null;
Window _resizerWindowHost = null;
Vector _initialStartPoint;
void ShowResizerOverlayWindow( LayoutGridResizerControl splitter )
private void ShowResizerOverlayWindow( LayoutGridResizerControl splitter )
{
_resizerGhost = new Border()
{
@ -346,7 +483,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
_resizerWindowHost.Show();
}
void HideResizerOverlayWindow()
private void HideResizerOverlayWindow()
{
if( _resizerWindowHost != null )
{
@ -355,13 +492,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
internal bool IsResizing
{
get;
private set;
}
void OnResizerDragCompleted( object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e )
private void OnResizerDragCompleted( object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e )
{
LayoutGridResizerControl splitter = sender as LayoutGridResizerControl;
var rootVisual = this.FindVisualTreeRoot() as Visual;
@ -419,7 +550,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
InvalidateMeasure();
}
void OnResizerDragDelta( object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e )
private void OnResizerDragDelta( object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e )
{
LayoutGridResizerControl splitter = sender as LayoutGridResizerControl;
var rootVisual = this.FindVisualTreeRoot() as Visual;
@ -440,126 +571,13 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
void OnResizerDragStarted( object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e )
private void OnResizerDragStarted( object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e )
{
var resizer = sender as LayoutGridResizerControl;
ShowResizerOverlayWindow( resizer );
IsResizing = true;
}
#endregion
protected override System.Collections.IEnumerator LogicalChildren
{
get
{
if( _internalHostPresenter == null )
return new UIElement[] { }.GetEnumerator();
return new UIElement[] { _internalHostPresenter }.GetEnumerator();
}
}
protected override Size MeasureOverride( Size constraint )
{
if( _internalHostPresenter == null )
return base.MeasureOverride( constraint );
_internalHostPresenter.Measure( constraint );
//return base.MeasureOverride(constraint);
return _internalHostPresenter.DesiredSize;
}
protected override Size ArrangeOverride( Size finalSize )
{
if( _internalHostPresenter == null )
return base.ArrangeOverride( finalSize );
_internalHostPresenter.Arrange( new Rect( finalSize ) );
return base.ArrangeOverride( finalSize );// new Size(_internalHostPresenter.ActualWidth, _internalHostPresenter.ActualHeight);
}
#region Background
/// <summary>
/// Background Dependency Property
/// </summary>
public static readonly DependencyProperty BackgroundProperty =
DependencyProperty.Register( "Background", typeof( Brush ), typeof( LayoutAutoHideWindowControl ),
new FrameworkPropertyMetadata( ( Brush )null ) );
/// <summary>
/// Gets or sets the Background property. This dependency property
/// indicates background of the autohide childwindow.
/// </summary>
public Brush Background
{
get
{
return ( Brush )GetValue( BackgroundProperty );
}
set
{
SetValue( BackgroundProperty, value );
}
}
#endregion
internal bool IsWin32MouseOver
{
get
{
var ptMouse = new Win32Helper.Win32Point();
if( !Win32Helper.GetCursorPos( ref ptMouse ) )
return false;
Point location = this.PointToScreenDPI( new Point() );
Rect rectWindow = this.GetScreenArea();
if( rectWindow.Contains( new Point( ptMouse.X, ptMouse.Y ) ) )
return true;
var manager = Model.Root.Manager;
var anchor = manager.FindVisualChildren<LayoutAnchorControl>().Where( c => c.Model == Model ).FirstOrDefault();
if( anchor == null )
return false;
location = anchor.PointToScreenDPI( new Point() );
if( anchor.IsMouseOver )
return true;
return false;
}
}
#region AnchorableStyle
/// <summary>
/// AnchorableStyle Dependency Property
/// </summary>
public static readonly DependencyProperty AnchorableStyleProperty =
DependencyProperty.Register( "AnchorableStyle", typeof( Style ), typeof( LayoutAutoHideWindowControl ),
new FrameworkPropertyMetadata( ( Style )null ) );
/// <summary>
/// Gets or sets the AnchorableStyle property. This dependency property
/// indicates the style to apply to the LayoutAnchorableControl hosted in this auto hide window.
/// </summary>
public Style AnchorableStyle
{
get
{
return ( Style )GetValue( AnchorableStyleProperty );
}
set
{
SetValue( AnchorableStyleProperty, value );
}
}
#endregion
}
}

29
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentControl.cs

@ -24,21 +24,25 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutDocumentControl : Control
{
#region Constructors
static LayoutDocumentControl()
{
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutDocumentControl ), new FrameworkPropertyMetadata( typeof( LayoutDocumentControl ) ) );
FocusableProperty.OverrideMetadata( typeof( LayoutDocumentControl ), new FrameworkPropertyMetadata( true ) );
}
#endregion
#region Properties
#region Model
/// <summary>
/// Model Dependency Property
/// </summary>
public static readonly DependencyProperty ModelProperty = DependencyProperty.Register( "Model",
typeof( LayoutContent ),
typeof( LayoutDocumentControl ),
new FrameworkPropertyMetadata( null, OnModelChanged ) );
public static readonly DependencyProperty ModelProperty = DependencyProperty.Register( "Model", typeof( LayoutContent ), typeof( LayoutDocumentControl ),
new FrameworkPropertyMetadata( null, OnModelChanged ) );
/// <summary>
/// Gets or sets the Model property. This dependency property
@ -110,11 +114,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// LayoutItem Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey LayoutItemPropertyKey = DependencyProperty.RegisterReadOnly( "LayoutItem",
typeof( LayoutItem ),
typeof( LayoutDocumentControl ),
new FrameworkPropertyMetadata(
( LayoutItem )null ) );
private static readonly DependencyPropertyKey LayoutItemPropertyKey = DependencyProperty.RegisterReadOnly( "LayoutItem", typeof( LayoutItem ), typeof( LayoutDocumentControl ),
new FrameworkPropertyMetadata(( LayoutItem )null ) );
public static readonly DependencyProperty LayoutItemProperty = LayoutItemPropertyKey.DependencyProperty;
@ -142,6 +143,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#endregion
#region Overrides
protected override void OnPreviewGotKeyboardFocus( KeyboardFocusChangedEventArgs e )
{
this.SetIsActive();
@ -161,6 +166,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
#endregion
#region Private Methods
private void SetIsActive()
{
if( this.Model != null )
@ -168,5 +177,7 @@ namespace Xceed.Wpf.AvalonDock.Controls
this.Model.IsActive = true;
}
}
#endregion
}
}

80
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs

@ -15,20 +15,23 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using Xceed.Wpf.AvalonDock.Layout;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Microsoft.Windows.Shell;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutDocumentFloatingWindowControl : LayoutFloatingWindowControl
{
#region Members
private LayoutDocumentFloatingWindow _model;
#endregion
#region Constructors
static LayoutDocumentFloatingWindowControl()
{
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutDocumentFloatingWindowControl ), new FrameworkPropertyMetadata( typeof( LayoutDocumentFloatingWindowControl ) ) );
@ -41,22 +44,27 @@ namespace Xceed.Wpf.AvalonDock.Controls
UpdateThemeResources();
}
#endregion
LayoutDocumentFloatingWindow _model;
#region Properties
public override ILayoutElement Model
public LayoutItem RootDocumentLayoutItem
{
get
{
return _model;
return _model.Root.Manager.GetLayoutItemFromModel( _model.RootDocument );
}
}
public LayoutItem RootDocumentLayoutItem
#endregion
#region Overrides
public override ILayoutElement Model
{
get
{
return _model.Root.Manager.GetLayoutItemFromModel( _model.RootDocument );
return _model;
}
}
@ -78,14 +86,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
void _model_RootDocumentChanged( object sender, EventArgs e )
{
if( _model.RootDocument == null )
{
InternalClose();
}
}
protected override IntPtr FilterMessage( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled )
{
switch( msg )
@ -114,22 +114,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
return base.FilterMessage( hwnd, msg, wParam, lParam, ref handled );
}
bool OpenContextMenu()
{
var ctxMenu = _model.Root.Manager.DocumentContextMenu;
if( ctxMenu != null && RootDocumentLayoutItem != null )
{
ctxMenu.PlacementTarget = null;
ctxMenu.Placement = PlacementMode.MousePoint;
ctxMenu.DataContext = RootDocumentLayoutItem;
ctxMenu.IsOpen = true;
return true;
}
return false;
}
protected override void OnClosed( EventArgs e )
{
var root = Model.Root;
@ -146,5 +130,33 @@ namespace Xceed.Wpf.AvalonDock.Controls
_model.RootDocumentChanged -= new EventHandler( _model_RootDocumentChanged );
}
#endregion
#region Private Methods
private void _model_RootDocumentChanged( object sender, EventArgs e )
{
if( _model.RootDocument == null )
{
InternalClose();
}
}
private bool OpenContextMenu()
{
var ctxMenu = _model.Root.Manager.DocumentContextMenu;
if( ctxMenu != null && RootDocumentLayoutItem != null )
{
ctxMenu.PlacementTarget = null;
ctxMenu.Placement = PlacementMode.MousePoint;
ctxMenu.DataContext = RootDocumentLayoutItem;
ctxMenu.IsOpen = true;
return true;
}
return false;
}
#endregion
}
}

168
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentItem.cs

@ -14,80 +14,130 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xceed.Wpf.AvalonDock.Layout;
using System.Windows;
using Xceed.Wpf.AvalonDock.Commands;
using System.Windows.Input;
using System.Windows.Data;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutDocumentItem : LayoutItem
public class LayoutDocumentItem : LayoutItem
{
#region Members
private LayoutDocument _document;
#endregion
#region Constructors
internal LayoutDocumentItem()
{
LayoutDocument _document;
internal LayoutDocumentItem()
{
}
}
#endregion
internal override void Attach(LayoutContent model)
{
_document = model as LayoutDocument;
base.Attach(model);
}
#region Properties
protected override void Close()
{
if( (_document.Root != null) && (_document.Root.Manager != null) )
{
var dockingManager = _document.Root.Manager;
dockingManager._ExecuteCloseCommand( _document );
}
}
#region Description
#region Description
/// <summary>
/// Description Dependency Property
/// </summary>
public static readonly DependencyProperty DescriptionProperty =
DependencyProperty.Register("Description", typeof(string), typeof(LayoutDocumentItem),
new FrameworkPropertyMetadata((string)null,
new PropertyChangedCallback(OnDescriptionChanged)));
/// <summary>
/// Gets or sets the Description property. This dependency property
/// indicates the description to display for the document item.
/// </summary>
public string Description
{
get { return (string)GetValue(DescriptionProperty); }
set { SetValue(DescriptionProperty, value); }
}
/// <summary>
/// Description Dependency Property
/// </summary>
public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register( "Description", typeof( string ), typeof( LayoutDocumentItem ),
new FrameworkPropertyMetadata( ( string )null, new PropertyChangedCallback( OnDescriptionChanged ) ) );
/// <summary>
/// Handles changes to the Description property.
/// </summary>
private static void OnDescriptionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((LayoutDocumentItem)d).OnDescriptionChanged(e);
}
/// <summary>
/// Gets or sets the Description property. This dependency property
/// indicates the description to display for the document item.
/// </summary>
public string Description
{
get
{
return ( string )GetValue( DescriptionProperty );
}
set
{
SetValue( DescriptionProperty, value );
}
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the Description property.
/// </summary>
protected virtual void OnDescriptionChanged(DependencyPropertyChangedEventArgs e)
{
_document.Description = (string)e.NewValue;
}
/// <summary>
/// Handles changes to the Description property.
/// </summary>
private static void OnDescriptionChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( LayoutDocumentItem )d ).OnDescriptionChanged( e );
}
#endregion
/// <summary>
/// Provides derived classes an opportunity to handle changes to the Description property.
/// </summary>
protected virtual void OnDescriptionChanged( DependencyPropertyChangedEventArgs e )
{
_document.Description = ( string )e.NewValue;
}
#endregion
internal override void Detach()
#endregion
#region Overrides
protected override void Close()
{
if( ( _document.Root != null ) && ( _document.Root.Manager != null ) )
{
var dockingManager = _document.Root.Manager;
dockingManager._ExecuteCloseCommand( _document );
}
}
protected override void OnVisibilityChanged()
{
if( (_document != null) && (_document.Root != null) )
{
_document.IsVisible = ( this.Visibility == Visibility.Visible );
if( _document.Parent is LayoutDocumentPane )
{
_document = null;
base.Detach();
( ( LayoutDocumentPane )_document.Parent ).ComputeVisibility();
}
}
base.OnVisibilityChanged();
}
internal override void Attach( LayoutContent model )
{
_document = model as LayoutDocument;
base.Attach( model );
}
internal override void Detach()
{
_document = null;
base.Detach();
}
#endregion
#region Private Methods
#endregion
}
}

58
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentPaneControl.cs

@ -25,12 +25,20 @@ namespace Xceed.Wpf.AvalonDock.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 )
@ -43,22 +51,21 @@ namespace Xceed.Wpf.AvalonDock.Controls
this.LayoutUpdated += new EventHandler( OnLayoutUpdated );
}
void OnLayoutUpdated( object sender, EventArgs e )
{
var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
modelWithAtcualSize.ActualWidth = ActualWidth;
modelWithAtcualSize.ActualHeight = ActualHeight;
}
#endregion
protected override void OnSelectionChanged( SelectionChangedEventArgs e )
{
base.OnSelectionChanged( e );
#region Properties
if( _model.SelectedContent != null )
_model.SelectedContent.IsActive = true;
public ILayoutElement Model
{
get
{
return _model;
}
}
List<object> _logicalChildren = new List<object>();
#endregion
#region Overrides
protected override System.Collections.IEnumerator LogicalChildren
{
@ -68,14 +75,12 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
LayoutDocumentPane _model;
public ILayoutElement Model
protected override void OnSelectionChanged( SelectionChangedEventArgs e )
{
get
{
return _model;
}
base.OnSelectionChanged( e );
if( _model.SelectedContent != null )
_model.SelectedContent.IsActive = true;
}
protected override void OnMouseLeftButtonDown( System.Windows.Input.MouseButtonEventArgs e )
@ -95,5 +100,18 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
#endregion
#region Private Methods
private void OnLayoutUpdated( object sender, EventArgs e )
{
var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
modelWithAtcualSize.ActualWidth = ActualWidth;
modelWithAtcualSize.ActualHeight = ActualHeight;
}
#endregion
}
}

81
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentPaneGroupControl.cs

@ -14,53 +14,60 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutDocumentPaneGroupControl : LayoutGridControl<ILayoutDocumentPane>, ILayoutControl
public class LayoutDocumentPaneGroupControl : LayoutGridControl<ILayoutDocumentPane>, ILayoutControl
{
#region Members
private LayoutDocumentPaneGroup _model;
#endregion
#region Constructors
internal LayoutDocumentPaneGroupControl( LayoutDocumentPaneGroup model )
: base( model, model.Orientation )
{
internal LayoutDocumentPaneGroupControl(LayoutDocumentPaneGroup model)
:base(model, model.Orientation)
{
_model = model;
}
_model = model;
}
LayoutDocumentPaneGroup _model;
#endregion
protected override void OnFixChildrenDockLengths()
#region Overrides
protected override void OnFixChildrenDockLengths()
{
#region Setup DockWidth/Height for children
if( _model.Orientation == Orientation.Horizontal )
{
for( int i = 0; i < _model.Children.Count; i++ )
{
#region Setup DockWidth/Height for children
if (_model.Orientation == Orientation.Horizontal)
{
for (int i = 0; i < _model.Children.Count; i++)
{
var childModel = _model.Children[i] as ILayoutPositionableElement;
if (!childModel.DockWidth.IsStar)
{
childModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
}
}
}
else
{
for (int i = 0; i < _model.Children.Count; i++)
{
var childModel = _model.Children[i] as ILayoutPositionableElement;
if (!childModel.DockHeight.IsStar)
{
childModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
}
}
}
#endregion
var childModel = _model.Children[ i ] as ILayoutPositionableElement;
if( !childModel.DockWidth.IsStar )
{
childModel.DockWidth = new GridLength( 1.0, GridUnitType.Star );
}
}
}
else
{
for( int i = 0; i < _model.Children.Count; i++ )
{
var childModel = _model.Children[ i ] as ILayoutPositionableElement;
if( !childModel.DockHeight.IsStar )
{
childModel.DockHeight = new GridLength( 1.0, GridUnitType.Star );
}
}
}
#endregion
}
#endregion
}
}

383
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentTabItem.cs

@ -17,218 +17,249 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Xceed.Wpf.AvalonDock.Layout;
using System.Diagnostics;
using System.Windows.Media;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutDocumentTabItem : Control
public class LayoutDocumentTabItem : Control
{
#region Members
private List<Rect> _otherTabsScreenArea = null;
private List<TabItem> _otherTabs = null;
private Rect _parentDocumentTabPanelScreenArea;
private DocumentPaneTabPanel _parentDocumentTabPanel;
private bool _isMouseDown = false;
private Point _mouseDownPoint;
#endregion
#region Contructors
static LayoutDocumentTabItem()
{
static LayoutDocumentTabItem()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(LayoutDocumentTabItem), new FrameworkPropertyMetadata(typeof(LayoutDocumentTabItem)));
}
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutDocumentTabItem ), new FrameworkPropertyMetadata( typeof( LayoutDocumentTabItem ) ) );
}
public LayoutDocumentTabItem()
{
}
public LayoutDocumentTabItem()
{
}
#region Model
/// <summary>
/// Model Dependency Property
/// </summary>
public static readonly DependencyProperty ModelProperty =
DependencyProperty.Register("Model", typeof(LayoutContent), typeof(LayoutDocumentTabItem),
new FrameworkPropertyMetadata((LayoutContent)null,
new PropertyChangedCallback(OnModelChanged)));
/// <summary>
/// Gets or sets the Model property. This dependency property
/// indicates the layout content model attached to the tab item.
/// </summary>
public LayoutContent Model
{
get { return (LayoutContent)GetValue(ModelProperty); }
set { SetValue(ModelProperty, value); }
}
#endregion
/// <summary>
/// Handles changes to the Model property.
/// </summary>
private static void OnModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((LayoutDocumentTabItem)d).OnModelChanged(e);
}
#region Properties
#region Model
/// <summary>
/// Provides derived classes an opportunity to handle changes to the Model property.
/// </summary>
protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e)
{
if (Model != null)
SetLayoutItem(Model.Root.Manager.GetLayoutItemFromModel(Model));
else
SetLayoutItem(null);
//UpdateLogicalParent();
}
/// <summary>
/// Model Dependency Property
/// </summary>
public static readonly DependencyProperty ModelProperty = DependencyProperty.Register( "Model", typeof( LayoutContent ), typeof( LayoutDocumentTabItem ),
new FrameworkPropertyMetadata( ( LayoutContent )null, new PropertyChangedCallback( OnModelChanged ) ) );
#endregion
/// <summary>
/// Gets or sets the Model property. This dependency property
/// indicates the layout content model attached to the tab item.
/// </summary>
public LayoutContent Model
{
get
{
return ( LayoutContent )GetValue( ModelProperty );
}
set
{
SetValue( ModelProperty, value );
}
}
#region LayoutItem
/// <summary>
/// Handles changes to the Model property.
/// </summary>
private static void OnModelChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( LayoutDocumentTabItem )d ).OnModelChanged( e );
}
/// <summary>
/// LayoutItem Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey LayoutItemPropertyKey
= DependencyProperty.RegisterReadOnly("LayoutItem", typeof(LayoutItem), typeof(LayoutDocumentTabItem),
new FrameworkPropertyMetadata((LayoutItem)null));
public static readonly DependencyProperty LayoutItemProperty
= LayoutItemPropertyKey.DependencyProperty;
/// <summary>
/// Provides derived classes an opportunity to handle changes to the Model property.
/// </summary>
protected virtual void OnModelChanged( DependencyPropertyChangedEventArgs e )
{
if( Model != null )
SetLayoutItem( Model.Root.Manager.GetLayoutItemFromModel( Model ) );
else
SetLayoutItem( null );
//UpdateLogicalParent();
}
/// <summary>
/// Gets the LayoutItem property. This dependency property
/// indicates the LayoutItem attached to this tag item.
/// </summary>
public LayoutItem LayoutItem
{
get { return (LayoutItem)GetValue(LayoutItemProperty); }
}
#endregion
/// <summary>
/// Provides a secure method for setting the LayoutItem property.
/// This dependency property indicates the LayoutItem attached to this tag item.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetLayoutItem(LayoutItem value)
{
SetValue(LayoutItemPropertyKey, value);
}
#region LayoutItem
#endregion
/// <summary>
/// LayoutItem Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey LayoutItemPropertyKey = DependencyProperty.RegisterReadOnly( "LayoutItem", typeof( LayoutItem ), typeof( LayoutDocumentTabItem ),
new FrameworkPropertyMetadata( ( LayoutItem )null ) );
List<Rect> _otherTabsScreenArea = null;
List<TabItem> _otherTabs = null;
Rect _parentDocumentTabPanelScreenArea;
DocumentPaneTabPanel _parentDocumentTabPanel;
bool _isMouseDown = false;
Point _mouseDownPoint;
public static readonly DependencyProperty LayoutItemProperty = LayoutItemPropertyKey.DependencyProperty;
void UpdateDragDetails()
{
_parentDocumentTabPanel = this.FindLogicalAncestor<DocumentPaneTabPanel>();
_parentDocumentTabPanelScreenArea = _parentDocumentTabPanel.GetScreenArea();
_otherTabs = _parentDocumentTabPanel.Children.Cast<TabItem>().Where(ch =>
ch.Visibility != System.Windows.Visibility.Collapsed).ToList();
Rect currentTabScreenArea = this.FindLogicalAncestor<TabItem>().GetScreenArea();
_otherTabsScreenArea = _otherTabs.Select(ti =>
{
var screenArea = ti.GetScreenArea();
return new Rect(screenArea.Left, screenArea.Top, currentTabScreenArea.Width, screenArea.Height);
}).ToList();
}
/// <summary>
/// Gets the LayoutItem property. This dependency property
/// indicates the LayoutItem attached to this tag item.
/// </summary>
public LayoutItem LayoutItem
{
get
{
return ( LayoutItem )GetValue( LayoutItemProperty );
}
}
protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
/// <summary>
/// Provides a secure method for setting the LayoutItem property.
/// This dependency property indicates the LayoutItem attached to this tag item.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetLayoutItem( LayoutItem value )
{
SetValue( LayoutItemPropertyKey, value );
}
Model.IsActive = true;
#endregion
if (e.ClickCount == 1)
{
_mouseDownPoint = e.GetPosition(this);
_isMouseDown = true;
}
}
#endregion
protected override void OnMouseMove(System.Windows.Input.MouseEventArgs e)
{
base.OnMouseMove(e);
if (_isMouseDown)
{
Point ptMouseMove = e.GetPosition(this);
if (Math.Abs(ptMouseMove.X - _mouseDownPoint.X) > SystemParameters.MinimumHorizontalDragDistance ||
Math.Abs(ptMouseMove.Y - _mouseDownPoint.Y) > SystemParameters.MinimumVerticalDragDistance)
{
UpdateDragDetails();
CaptureMouse();
_isMouseDown = false;
}
}
if (IsMouseCaptured)
{
var mousePosInScreenCoord = this.PointToScreenDPI(e.GetPosition(this));
if (!_parentDocumentTabPanelScreenArea.Contains(mousePosInScreenCoord))
{
ReleaseMouseCapture();
var manager = Model.Root.Manager;
manager.StartDraggingFloatingWindowForContent(Model);
}
else
{
int indexOfTabItemWithMouseOver = _otherTabsScreenArea.FindIndex(r => r.Contains(mousePosInScreenCoord));
if (indexOfTabItemWithMouseOver >= 0)
{
var targetModel = _otherTabs[indexOfTabItemWithMouseOver].Content as LayoutContent;
var container = Model.Parent as ILayoutContainer;
var containerPane = Model.Parent as ILayoutPane;
if( (containerPane is LayoutDocumentPane) && !((LayoutDocumentPane)containerPane).CanRepositionItems )
return;
if( (containerPane.Parent != null) && (containerPane.Parent is LayoutDocumentPaneGroup) && !((LayoutDocumentPaneGroup)containerPane.Parent).CanRepositionItems )
return;
var childrenList = container.Children.ToList();
containerPane.MoveChild( childrenList.IndexOf( Model ), childrenList.IndexOf( targetModel ) );
Model.IsActive = true;
_parentDocumentTabPanel.UpdateLayout();
UpdateDragDetails();
}
}
}
#region Overrides
}
protected override void OnMouseLeftButtonDown( System.Windows.Input.MouseButtonEventArgs e )
{
base.OnMouseLeftButtonDown( e );
protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e)
{
if (IsMouseCaptured)
ReleaseMouseCapture();
_isMouseDown = false;
Model.IsActive = true;
base.OnMouseLeftButtonUp(e);
}
if( e.ClickCount == 1 )
{
_mouseDownPoint = e.GetPosition( this );
_isMouseDown = true;
}
}
protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e )
{
base.OnMouseMove( e );
if( _isMouseDown )
{
Point ptMouseMove = e.GetPosition( this );
protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
if( Math.Abs( ptMouseMove.X - _mouseDownPoint.X ) > SystemParameters.MinimumHorizontalDragDistance ||
Math.Abs( ptMouseMove.Y - _mouseDownPoint.Y ) > SystemParameters.MinimumVerticalDragDistance )
{
base.OnMouseLeave(e);
_isMouseDown = false;
this.UpdateDragDetails();
this.CaptureMouse();
_isMouseDown = false;
}
}
protected override void OnMouseEnter(MouseEventArgs e)
if( this.IsMouseCaptured )
{
var mousePosInScreenCoord = this.PointToScreenDPI( e.GetPosition( this ) );
if( !_parentDocumentTabPanelScreenArea.Contains( mousePosInScreenCoord ) )
{
base.OnMouseEnter(e);
_isMouseDown = false;
this.StartDraggingFloatingWindowForContent();
}
protected override void OnMouseDown(MouseButtonEventArgs e)
else
{
if (e.ChangedButton == MouseButton.Middle)
{
if (LayoutItem.CloseCommand.CanExecute(null))
LayoutItem.CloseCommand.Execute(null);
}
base.OnMouseDown(e);
int indexOfTabItemWithMouseOver = _otherTabsScreenArea.FindIndex( r => r.Contains( mousePosInScreenCoord ) );
if( indexOfTabItemWithMouseOver >= 0 )
{
var targetModel = _otherTabs[ indexOfTabItemWithMouseOver ].Content as LayoutContent;
var container = this.Model.Parent as ILayoutContainer;
var containerPane = this.Model.Parent as ILayoutPane;
if( ( containerPane is LayoutDocumentPane ) && !( ( LayoutDocumentPane )containerPane ).CanRepositionItems )
return;
if( ( containerPane.Parent != null ) && ( containerPane.Parent is LayoutDocumentPaneGroup ) && !( ( LayoutDocumentPaneGroup )containerPane.Parent ).CanRepositionItems )
return;
var childrenList = container.Children.ToList();
containerPane.MoveChild( childrenList.IndexOf( Model ), childrenList.IndexOf( targetModel ) );
this.Model.IsActive = true;
_parentDocumentTabPanel.UpdateLayout();
this.UpdateDragDetails();
}
}
}
}
protected override void OnMouseLeftButtonUp( System.Windows.Input.MouseButtonEventArgs e )
{
if( IsMouseCaptured )
ReleaseMouseCapture();
_isMouseDown = false;
base.OnMouseLeftButtonUp( e );
}
protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e )
{
base.OnMouseLeave( e );
_isMouseDown = false;
}
protected override void OnMouseEnter( MouseEventArgs e )
{
base.OnMouseEnter( e );
_isMouseDown = false;
}
protected override void OnMouseDown( MouseButtonEventArgs e )
{
if( e.ChangedButton == MouseButton.Middle )
{
if( LayoutItem.CloseCommand.CanExecute( null ) )
LayoutItem.CloseCommand.Execute( null );
}
base.OnMouseDown( e );
}
#endregion
#region Private Methods
private void UpdateDragDetails()
{
_parentDocumentTabPanel = this.FindLogicalAncestor<DocumentPaneTabPanel>();
_parentDocumentTabPanelScreenArea = _parentDocumentTabPanel.GetScreenArea();
_otherTabs = _parentDocumentTabPanel.Children.Cast<TabItem>().Where( ch =>
ch.Visibility != System.Windows.Visibility.Collapsed ).ToList();
Rect currentTabScreenArea = this.FindLogicalAncestor<TabItem>().GetScreenArea();
_otherTabsScreenArea = _otherTabs.Select( ti =>
{
var screenArea = ti.GetScreenArea();
return new Rect( screenArea.Left, screenArea.Top, currentTabScreenArea.Width, screenArea.Height );
} ).ToList();
}
private void StartDraggingFloatingWindowForContent()
{
this.ReleaseMouseCapture();
if( this.Model is LayoutAnchorable )
{
( ( LayoutAnchorable )this.Model ).ResetCanCloseInternal();
}
var manager = this.Model.Root.Manager;
manager.StartDraggingFloatingWindowForContent( this.Model );
}
#endregion
}
}

666
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutFloatingWindowControl.cs

@ -31,8 +31,20 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
public abstract class LayoutFloatingWindowControl : Window, ILayoutControl
{
#region Members
private ResourceDictionary currentThemeResourceDictionary; // = null
private bool _isInternalChange; //false
private ILayoutElement _model;
private bool _attachDrag = false;
private HwndSource _hwndSrc;
private HwndSourceHook _hwndSrcHook;
private DragService _dragService = null;
private bool _internalCloseFlag = false;
#endregion
#region Constructors
static LayoutFloatingWindowControl()
{
@ -41,165 +53,159 @@ namespace Xceed.Wpf.AvalonDock.Controls
ShowInTaskbarProperty.OverrideMetadata( typeof( LayoutFloatingWindowControl ), new FrameworkPropertyMetadata( false ) );
}
static object CoerceContentValue( DependencyObject sender, object content )
protected LayoutFloatingWindowControl( ILayoutElement model )
{
return new FloatingWindowContentHost( sender as LayoutFloatingWindowControl ) { Content = content as UIElement };
this.Loaded += new RoutedEventHandler( OnLoaded );
this.Unloaded += new RoutedEventHandler( OnUnloaded );
_model = model;
}
protected internal class FloatingWindowContentHost : HwndHost
{
LayoutFloatingWindowControl _owner;
public FloatingWindowContentHost( LayoutFloatingWindowControl owner )
{
_owner = owner;
var manager = _owner.Model.Root.Manager;
}
#endregion
#region Properties
HwndSource _wpfContentHost = null;
Border _rootPresenter = null;
DockingManager _manager = null;
#region Model
protected override System.Runtime.InteropServices.HandleRef BuildWindowCore( System.Runtime.InteropServices.HandleRef hwndParent )
{
_wpfContentHost = new HwndSource( new HwndSourceParameters()
{
ParentWindow = hwndParent.Handle,
WindowStyle = Win32Helper.WS_CHILD | Win32Helper.WS_VISIBLE | Win32Helper.WS_CLIPSIBLINGS | Win32Helper.WS_CLIPCHILDREN,
Width = 1,
Height = 1
} );
_rootPresenter = new Border() { Child = new AdornerDecorator() { Child = Content }, Focusable = true };
_rootPresenter.SetBinding( Border.BackgroundProperty, new Binding( "Background" ) { Source = _owner } );
_wpfContentHost.RootVisual = _rootPresenter;
_wpfContentHost.SizeToContent = SizeToContent.Manual;
_manager = _owner.Model.Root.Manager;
_manager.InternalAddLogicalChild( _rootPresenter );
public abstract ILayoutElement Model
{
get;
}
return new HandleRef( this, _wpfContentHost.Handle );
}
#endregion
#region IsDragging
protected override void DestroyWindowCore( HandleRef hwnd )
{
_manager.InternalRemoveLogicalChild( _rootPresenter );
if( _wpfContentHost != null )
{
_wpfContentHost.Dispose();
_wpfContentHost = null;
}
}
/// <summary>
/// IsDragging Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey IsDraggingPropertyKey = DependencyProperty.RegisterReadOnly( "IsDragging", typeof( bool ), typeof( LayoutFloatingWindowControl ),
new FrameworkPropertyMetadata( ( bool )false, new PropertyChangedCallback( OnIsDraggingChanged ) ) );
public Visual RootVisual
{
get
{
return _rootPresenter;
}
}
public static readonly DependencyProperty IsDraggingProperty = IsDraggingPropertyKey.DependencyProperty;
protected override Size MeasureOverride( Size constraint )
/// <summary>
/// Gets the IsDragging property. This dependency property
/// indicates that this floating window is being dragged.
/// </summary>
public bool IsDragging
{
get
{
if( Content == null )
return base.MeasureOverride( constraint );
Content.Measure( constraint );
return Content.DesiredSize;
return ( bool )GetValue( IsDraggingProperty );
}
}
#region Content
/// <summary>
/// Provides a secure method for setting the IsDragging property.
/// This dependency property indicates that this floating window is being dragged.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetIsDragging( bool value )
{
SetValue( IsDraggingPropertyKey, value );
}
/// <summary>
/// Content Dependency Property
/// </summary>
public static readonly DependencyProperty ContentProperty =
DependencyProperty.Register( "Content", typeof( UIElement ), typeof( FloatingWindowContentHost ),
new FrameworkPropertyMetadata( ( UIElement )null,
new PropertyChangedCallback( OnContentChanged ) ) );
/// <summary>
/// Handles changes to the IsDragging property.
/// </summary>
private static void OnIsDraggingChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( LayoutFloatingWindowControl )d ).OnIsDraggingChanged( e );
}
/// <summary>
/// Gets or sets the Content property. This dependency property
/// indicates ....
/// </summary>
public UIElement Content
/// <summary>
/// Provides derived classes an opportunity to handle changes to the IsDragging property.
/// </summary>
protected virtual void OnIsDraggingChanged( DependencyPropertyChangedEventArgs e )
{
if( ( bool )e.NewValue )
{
get
{
return ( UIElement )GetValue( ContentProperty );
}
set
{
SetValue( ContentProperty, value );
}
CaptureMouse();
}
/// <summary>
/// Handles changes to the Content property.
/// </summary>
private static void OnContentChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
else
{
( ( FloatingWindowContentHost )d ).OnContentChanged( e );
ReleaseMouseCapture();
}
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the Content property.
/// </summary>
protected virtual void OnContentChanged( DependencyPropertyChangedEventArgs e )
#endregion
#region CloseInitiatedByUser
protected bool CloseInitiatedByUser
{
get
{
if( _rootPresenter != null )
_rootPresenter.Child = Content;
return !_internalCloseFlag;
}
#endregion
}
ILayoutElement _model;
#endregion
protected LayoutFloatingWindowControl( ILayoutElement model )
#region KeepContentVisibleOnClose
internal bool KeepContentVisibleOnClose
{
this.Loaded += new RoutedEventHandler( OnLoaded );
this.Unloaded += new RoutedEventHandler( OnUnloaded );
_model = model;
get;
set;
}
internal virtual void UpdateThemeResources( Theme oldTheme = null )
#endregion
#region IsMaximized
/// <summary>
/// IsMaximized Dependency Property
/// </summary>
public static readonly DependencyProperty IsMaximizedProperty = DependencyProperty.Register( "IsMaximized", typeof( bool ), typeof( LayoutFloatingWindowControl ),
new FrameworkPropertyMetadata( ( bool )false ) );
/// <summary>
/// Gets/sets the IsMaximized property. This dependency property
/// indicates if the window is maximized.
/// </summary>
public bool IsMaximized
{
if( oldTheme != null )
get
{
if( oldTheme is DictionaryTheme )
{
if( currentThemeResourceDictionary != null )
{
Resources.MergedDictionaries.Remove( currentThemeResourceDictionary );
currentThemeResourceDictionary = null;
}
}
else
{
var resourceDictionaryToRemove =
Resources.MergedDictionaries.FirstOrDefault( r => r.Source == oldTheme.GetResourceUri() );
if( resourceDictionaryToRemove != null )
Resources.MergedDictionaries.Remove(
resourceDictionaryToRemove );
}
return ( bool )GetValue( IsMaximizedProperty );
}
private set
{
SetValue( IsMaximizedProperty, value );
UpdatePositionAndSizeOfPanes();
}
}
var manager = _model.Root.Manager;
if( manager.Theme != null )
/// <summary>
/// Provides a secure method for setting the IsMaximized property.
/// This dependency property indicates if the window is maximized.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected override void OnStateChanged( EventArgs e )
{
if( !_isInternalChange )
{
if( manager.Theme is DictionaryTheme )
if( WindowState == WindowState.Maximized )
{
currentThemeResourceDictionary = ( ( DictionaryTheme )manager.Theme ).ThemeResourceDictionary;
Resources.MergedDictionaries.Add( currentThemeResourceDictionary );
UpdateMaximizedState( true );
}
else
{
Resources.MergedDictionaries.Add( new ResourceDictionary() { Source = manager.Theme.GetResourceUri() } );
WindowState = IsMaximized ? WindowState.Maximized : WindowState.Normal;
}
}
base.OnStateChanged( e );
}
#endregion
#endregion
#region Overrides
protected override void OnClosed( EventArgs e )
{
if( Content != null )
@ -218,72 +224,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
base.OnClosed( e );
}
bool _attachDrag = false;
internal void AttachDrag( bool onActivated = true )
{
if( onActivated )
{
_attachDrag = true;
this.Activated += new EventHandler( OnActivated );
}
else
{
IntPtr windowHandle = new WindowInteropHelper( this ).Handle;
IntPtr lParam = new IntPtr( ( ( int )Left & ( int )0xFFFF ) | ( ( ( int )Top ) << 16 ) );
Win32Helper.SendMessage( windowHandle, Win32Helper.WM_NCLBUTTONDOWN, new IntPtr( Win32Helper.HT_CAPTION ), lParam );
}
}
HwndSource _hwndSrc;
HwndSourceHook _hwndSrcHook;
void OnLoaded( object sender, RoutedEventArgs e )
{
this.Loaded -= new RoutedEventHandler( OnLoaded );
this.SetParentToMainWindowOf( Model.Root.Manager );
_hwndSrc = HwndSource.FromDependencyObject( this ) as HwndSource;
_hwndSrcHook = new HwndSourceHook( FilterMessage );
_hwndSrc.AddHook( _hwndSrcHook );
// Restore maximize state
var maximized = Model.Descendents().OfType<ILayoutElementForFloatingWindow>().Any( l => l.IsMaximized );
UpdateMaximizedState( maximized );
}
void OnUnloaded( object sender, RoutedEventArgs e )
{
this.Unloaded -= new RoutedEventHandler( OnUnloaded );
if( _hwndSrc != null )
{
_hwndSrc.RemoveHook( _hwndSrcHook );
InternalClose();
}
}
void OnActivated( object sender, EventArgs e )
{
this.Activated -= new EventHandler( OnActivated );
if( _attachDrag && Mouse.LeftButton == MouseButtonState.Pressed )
{
IntPtr windowHandle = new WindowInteropHelper( this ).Handle;
var mousePosition = this.PointToScreenDPI( Mouse.GetPosition( this ) );
var clientArea = Win32Helper.GetClientRect( windowHandle );
var windowArea = Win32Helper.GetWindowRect( windowHandle );
Left = mousePosition.X - windowArea.Width / 2.0;
Top = mousePosition.Y - ( windowArea.Height - clientArea.Height ) / 2.0;
_attachDrag = false;
IntPtr lParam = new IntPtr( ( ( int )mousePosition.X & ( int )0xFFFF ) | ( ( ( int )mousePosition.Y ) << 16 ) );
Win32Helper.SendMessage( windowHandle, Win32Helper.WM_NCLBUTTONDOWN, new IntPtr( Win32Helper.HT_CAPTION ), lParam );
}
}
protected override void OnInitialized( EventArgs e )
{
CommandBindings.Add( new CommandBinding( Microsoft.Windows.Shell.SystemCommands.CloseWindowCommand,
@ -299,105 +239,63 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
public abstract ILayoutElement Model
{
get;
}
#region IsDragging
/// <summary>
/// IsDragging Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey IsDraggingPropertyKey
= DependencyProperty.RegisterReadOnly( "IsDragging", typeof( bool ), typeof( LayoutFloatingWindowControl ),
new FrameworkPropertyMetadata( ( bool )false,
new PropertyChangedCallback( OnIsDraggingChanged ) ) );
public static readonly DependencyProperty IsDraggingProperty
= IsDraggingPropertyKey.DependencyProperty;
/// <summary>
/// Gets the IsDragging property. This dependency property
/// indicates that this floating window is being dragged.
/// </summary>
public bool IsDragging
{
get
{
return ( bool )GetValue( IsDraggingProperty );
}
}
/// <summary>
/// Provides a secure method for setting the IsDragging property.
/// This dependency property indicates that this floating window is being dragged.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetIsDragging( bool value )
{
SetValue( IsDraggingPropertyKey, value );
}
#endregion
/// <summary>
/// Handles changes to the IsDragging property.
/// </summary>
private static void OnIsDraggingChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( LayoutFloatingWindowControl )d ).OnIsDraggingChanged( e );
}
#region Internal Methods
/// <summary>
/// Provides derived classes an opportunity to handle changes to the IsDragging property.
/// </summary>
protected virtual void OnIsDraggingChanged( DependencyPropertyChangedEventArgs e )
internal virtual void UpdateThemeResources( Theme oldTheme = null )
{
if( ( bool )e.NewValue )
if( oldTheme != null )
{
CaptureMouse();
if( oldTheme is DictionaryTheme )
{
if( currentThemeResourceDictionary != null )
{
Resources.MergedDictionaries.Remove( currentThemeResourceDictionary );
currentThemeResourceDictionary = null;
}
}
else
{
var resourceDictionaryToRemove =
Resources.MergedDictionaries.FirstOrDefault( r => r.Source == oldTheme.GetResourceUri() );
if( resourceDictionaryToRemove != null )
Resources.MergedDictionaries.Remove(
resourceDictionaryToRemove );
}
}
else
var manager = _model.Root.Manager;
if( manager.Theme != null )
{
ReleaseMouseCapture();
if( manager.Theme is DictionaryTheme )
{
currentThemeResourceDictionary = ( ( DictionaryTheme )manager.Theme ).ThemeResourceDictionary;
Resources.MergedDictionaries.Add( currentThemeResourceDictionary );
}
else
{
Resources.MergedDictionaries.Add( new ResourceDictionary() { Source = manager.Theme.GetResourceUri() } );
}
}
}
#endregion
DragService _dragService = null;
void UpdatePositionAndSizeOfPanes()
internal void AttachDrag( bool onActivated = true )
{
foreach( var posElement in Model.Descendents().OfType<ILayoutElementForFloatingWindow>() )
if( onActivated )
{
posElement.FloatingLeft = Left;
posElement.FloatingTop = Top;
posElement.FloatingWidth = Width;
posElement.FloatingHeight = Height;
_attachDrag = true;
this.Activated += new EventHandler( OnActivated );
}
}
void UpdateMaximizedState( bool isMaximized )
{
foreach( var posElement in Model.Descendents().OfType<ILayoutElementForFloatingWindow>() )
else
{
posElement.IsMaximized = isMaximized;
IntPtr windowHandle = new WindowInteropHelper( this ).Handle;
IntPtr lParam = new IntPtr( ( ( int )Left & ( int )0xFFFF ) | ( ( ( int )Top ) << 16 ) );
Win32Helper.SendMessage( windowHandle, Win32Helper.WM_NCLBUTTONDOWN, new IntPtr( Win32Helper.HT_CAPTION ), lParam );
}
IsMaximized = isMaximized;
_isInternalChange = true;
WindowState = isMaximized ? WindowState.Maximized : WindowState.Normal;
_isInternalChange = false;
}
protected virtual IntPtr FilterMessage(
IntPtr hwnd,
int msg,
IntPtr wParam,
IntPtr lParam,
ref bool handled
)
protected virtual IntPtr FilterMessage( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled )
{
handled = false;
@ -460,6 +358,90 @@ namespace Xceed.Wpf.AvalonDock.Controls
return IntPtr.Zero;
}
internal void InternalClose()
{
_internalCloseFlag = true;
Close();
}
#endregion
#region Private Methods
private static object CoerceContentValue( DependencyObject sender, object content )
{
return new FloatingWindowContentHost( sender as LayoutFloatingWindowControl ) { Content = content as UIElement };
}
private void OnLoaded( object sender, RoutedEventArgs e )
{
this.Loaded -= new RoutedEventHandler( OnLoaded );
this.SetParentToMainWindowOf( Model.Root.Manager );
_hwndSrc = HwndSource.FromDependencyObject( this ) as HwndSource;
_hwndSrcHook = new HwndSourceHook( FilterMessage );
_hwndSrc.AddHook( _hwndSrcHook );
// Restore maximize state
var maximized = Model.Descendents().OfType<ILayoutElementForFloatingWindow>().Any( l => l.IsMaximized );
UpdateMaximizedState( maximized );
}
private void OnUnloaded( object sender, RoutedEventArgs e )
{
this.Unloaded -= new RoutedEventHandler( OnUnloaded );
if( _hwndSrc != null )
{
_hwndSrc.RemoveHook( _hwndSrcHook );
InternalClose();
}
}
private void OnActivated( object sender, EventArgs e )
{
this.Activated -= new EventHandler( OnActivated );
if( _attachDrag && Mouse.LeftButton == MouseButtonState.Pressed )
{
IntPtr windowHandle = new WindowInteropHelper( this ).Handle;
var mousePosition = this.PointToScreenDPI( Mouse.GetPosition( this ) );
var clientArea = Win32Helper.GetClientRect( windowHandle );
var windowArea = Win32Helper.GetWindowRect( windowHandle );
Left = mousePosition.X - windowArea.Width / 2.0;
Top = mousePosition.Y - ( windowArea.Height - clientArea.Height ) / 2.0;
_attachDrag = false;
IntPtr lParam = new IntPtr( ( ( int )mousePosition.X & ( int )0xFFFF ) | ( ( ( int )mousePosition.Y ) << 16 ) );
Win32Helper.SendMessage( windowHandle, Win32Helper.WM_NCLBUTTONDOWN, new IntPtr( Win32Helper.HT_CAPTION ), lParam );
}
}
private void UpdatePositionAndSizeOfPanes()
{
foreach( var posElement in Model.Descendents().OfType<ILayoutElementForFloatingWindow>() )
{
posElement.FloatingLeft = Left;
posElement.FloatingTop = Top;
posElement.FloatingWidth = Width;
posElement.FloatingHeight = Height;
}
}
private void UpdateMaximizedState( bool isMaximized )
{
foreach( var posElement in Model.Descendents().OfType<ILayoutElementForFloatingWindow>() )
{
posElement.IsMaximized = isMaximized;
}
IsMaximized = isMaximized;
_isInternalChange = true;
WindowState = isMaximized ? WindowState.Maximized : WindowState.Normal;
_isInternalChange = false;
}
private void UpdateDragPosition()
{
if( _dragService == null )
@ -472,76 +454,132 @@ namespace Xceed.Wpf.AvalonDock.Controls
_dragService.UpdateMouseLocation( mousePosition );
}
bool _internalCloseFlag = false;
#endregion
#region Internal Classes
internal void InternalClose()
protected internal class FloatingWindowContentHost : HwndHost
{
_internalCloseFlag = true;
Close();
}
#region Members
private LayoutFloatingWindowControl _owner;
private HwndSource _wpfContentHost = null;
private Border _rootPresenter = null;
private DockingManager _manager = null;
protected bool CloseInitiatedByUser
{
get
#endregion
#region Constructors
public FloatingWindowContentHost( LayoutFloatingWindowControl owner )
{
return !_internalCloseFlag;
_owner = owner;
var manager = _owner.Model.Root.Manager;
}
}
internal bool KeepContentVisibleOnClose
{
get;
set;
}
#endregion
#region IsMaximized
#region Properties
/// <summary>
/// IsMaximized Dependency Property
/// </summary>
public static readonly DependencyProperty IsMaximizedProperty
= DependencyProperty.Register( "IsMaximized", typeof( bool ), typeof( LayoutFloatingWindowControl ),
new FrameworkPropertyMetadata( ( bool )false ) );
#region RootVisual
/// <summary>
/// Gets/sets the IsMaximized property. This dependency property
/// indicates if the window is maximized.
/// </summary>
public bool IsMaximized
{
get
public Visual RootVisual
{
return ( bool )GetValue( IsMaximizedProperty );
get
{
return _rootPresenter;
}
}
private set
#endregion
#region Content
/// <summary>
/// Content Dependency Property
/// </summary>
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register( "Content", typeof( UIElement ), typeof( FloatingWindowContentHost ),
new FrameworkPropertyMetadata( ( UIElement )null, new PropertyChangedCallback( OnContentChanged ) ) );
/// <summary>
/// Gets or sets the Content property. This dependency property
/// indicates ....
/// </summary>
public UIElement Content
{
SetValue( IsMaximizedProperty, value );
UpdatePositionAndSizeOfPanes();
get
{
return ( UIElement )GetValue( ContentProperty );
}
set
{
SetValue( ContentProperty, value );
}
}
}
/// <summary>
/// Provides a secure method for setting the IsMaximized property.
/// This dependency property indicates if the window is maximized.
/// </summary>
/// <param name="value">The new value for the property.</param>
/// <summary>
/// Handles changes to the Content property.
/// </summary>
private static void OnContentChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( FloatingWindowContentHost )d ).OnContentChanged( e );
}
protected override void OnStateChanged( EventArgs e )
{
if( !_isInternalChange )
/// <summary>
/// Provides derived classes an opportunity to handle changes to the Content property.
/// </summary>
protected virtual void OnContentChanged( DependencyPropertyChangedEventArgs e )
{
if( WindowState == WindowState.Maximized )
if( _rootPresenter != null )
_rootPresenter.Child = Content;
}
#endregion
#endregion
#region Overrides
protected override System.Runtime.InteropServices.HandleRef BuildWindowCore( System.Runtime.InteropServices.HandleRef hwndParent )
{
_wpfContentHost = new HwndSource( new HwndSourceParameters()
{
UpdateMaximizedState( true );
}
else
ParentWindow = hwndParent.Handle,
WindowStyle = Win32Helper.WS_CHILD | Win32Helper.WS_VISIBLE | Win32Helper.WS_CLIPSIBLINGS | Win32Helper.WS_CLIPCHILDREN,
Width = 1,
Height = 1
} );
_rootPresenter = new Border() { Child = new AdornerDecorator() { Child = Content }, Focusable = true };
_rootPresenter.SetBinding( Border.BackgroundProperty, new Binding( "Background" ) { Source = _owner } );
_wpfContentHost.RootVisual = _rootPresenter;
_wpfContentHost.SizeToContent = SizeToContent.Manual;
_manager = _owner.Model.Root.Manager;
_manager.InternalAddLogicalChild( _rootPresenter );
return new HandleRef( this, _wpfContentHost.Handle );
}
protected override void DestroyWindowCore( HandleRef hwnd )
{
_manager.InternalRemoveLogicalChild( _rootPresenter );
if( _wpfContentHost != null )
{
WindowState = IsMaximized ? WindowState.Maximized : WindowState.Normal;
_wpfContentHost.Dispose();
_wpfContentHost = null;
}
}
base.OnStateChanged( e );
protected override Size MeasureOverride( Size constraint )
{
if( Content == null )
return base.MeasureOverride( constraint );
Content.Measure( constraint );
return Content.DesiredSize;
}
#endregion
}
#endregion

823
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridControl.cs

@ -15,370 +15,397 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using Xceed.Wpf.AvalonDock.Layout;
using System.Diagnostics;
using System.Windows.Threading;
namespace Xceed.Wpf.AvalonDock.Controls
{
public abstract class LayoutGridControl<T> : Grid, ILayoutControl where T : class, ILayoutPanelElement
public abstract class LayoutGridControl<T> : Grid, ILayoutControl where T : class, ILayoutPanelElement
{
#region Members
private LayoutPositionableGroup<T> _model;
private Orientation _orientation;
private bool _initialized;
private ChildrenTreeChange? _asyncRefreshCalled;
private ReentrantFlag _fixingChildrenDockLengths = new ReentrantFlag();
private Border _resizerGhost = null;
private Window _resizerWindowHost = null;
private Vector _initialStartPoint;
#endregion
#region Constructors
static LayoutGridControl()
{
static LayoutGridControl()
{
}
}
internal LayoutGridControl(LayoutPositionableGroup<T> model, Orientation orientation)
{
if (model == null)
throw new ArgumentNullException("model");
internal LayoutGridControl( LayoutPositionableGroup<T> model, Orientation orientation )
{
if( model == null )
throw new ArgumentNullException( "model" );
_model = model;
_orientation = orientation;
_model = model;
_orientation = orientation;
FlowDirection = System.Windows.FlowDirection.LeftToRight;
}
FlowDirection = System.Windows.FlowDirection.LeftToRight;
}
LayoutPositionableGroup<T> _model;
public ILayoutElement Model
{
get { return _model; }
}
#endregion
Orientation _orientation;
#region Properties
public Orientation Orientation
{
get { return (_model as ILayoutOrientableGroup).Orientation; }
}
public ILayoutElement Model
{
get
{
return _model;
}
}
bool _initialized;
ChildrenTreeChange? _asyncRefreshCalled;
public Orientation Orientation
{
get
{
return ( _model as ILayoutOrientableGroup ).Orientation;
}
}
bool AsyncRefreshCalled
{
get { return _asyncRefreshCalled != null; }
}
private bool AsyncRefreshCalled
{
get
{
return _asyncRefreshCalled != null;
}
}
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
_model.ChildrenTreeChanged += (s, args) =>
{
if (_asyncRefreshCalled.HasValue &&
_asyncRefreshCalled.Value == args.Change)
return;
_asyncRefreshCalled = args.Change;
Dispatcher.BeginInvoke(new Action(() =>
{
_asyncRefreshCalled = null;
UpdateChildren();
}), DispatcherPriority.Normal, null);
};
this.LayoutUpdated += new EventHandler(OnLayoutUpdated);
}
#endregion
void OnLayoutUpdated(object sender, EventArgs e)
{
var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
modelWithAtcualSize.ActualWidth = ActualWidth;
modelWithAtcualSize.ActualHeight = ActualHeight;
#region Overrides
if (!_initialized)
{
_initialized = true;
UpdateChildren();
}
}
protected override void OnInitialized( EventArgs e )
{
base.OnInitialized( e );
_model.ChildrenTreeChanged += ( s, args ) =>
{
if( _asyncRefreshCalled.HasValue &&
_asyncRefreshCalled.Value == args.Change )
return;
_asyncRefreshCalled = args.Change;
Dispatcher.BeginInvoke( new Action( () =>
{
_asyncRefreshCalled = null;
UpdateChildren();
} ), DispatcherPriority.Normal, null );
};
this.LayoutUpdated += new EventHandler( OnLayoutUpdated );
}
void UpdateChildren()
{
var alreadyContainedChildren = Children.OfType<ILayoutControl>().ToArray();
#endregion
DetachOldSplitters();
DetachPropertChangeHandler();
#region Internal Methods
Children.Clear();
ColumnDefinitions.Clear();
RowDefinitions.Clear();
protected void FixChildrenDockLengths()
{
using( _fixingChildrenDockLengths.Enter() )
OnFixChildrenDockLengths();
}
if (_model == null ||
_model.Root == null)
return;
protected abstract void OnFixChildrenDockLengths();
var manager = _model.Root.Manager;
if (manager == null)
return;
#endregion
#region Private Methods
foreach (ILayoutElement child in _model.Children)
{
var foundContainedChild = alreadyContainedChildren.FirstOrDefault(chVM => chVM.Model == child);
if (foundContainedChild != null)
Children.Add(foundContainedChild as UIElement);
else
Children.Add(manager.CreateUIElementForModel(child));
}
private void OnLayoutUpdated( object sender, EventArgs e )
{
var modelWithAtcualSize = _model as ILayoutPositionableElementWithActualSize;
modelWithAtcualSize.ActualWidth = ActualWidth;
modelWithAtcualSize.ActualHeight = ActualHeight;
CreateSplitters();
if( !_initialized )
{
_initialized = true;
UpdateChildren();
}
}
UpdateRowColDefinitions();
private void UpdateChildren()
{
var alreadyContainedChildren = Children.OfType<ILayoutControl>().ToArray();
AttachNewSplitters();
AttachPropertyChangeHandler();
}
DetachOldSplitters();
DetachPropertChangeHandler();
private void AttachPropertyChangeHandler()
{
foreach (var child in InternalChildren.OfType<ILayoutControl>())
{
child.Model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.OnChildModelPropertyChanged);
}
}
Children.Clear();
ColumnDefinitions.Clear();
RowDefinitions.Clear();
private void DetachPropertChangeHandler()
{
foreach (var child in InternalChildren.OfType<ILayoutControl>())
{
child.Model.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(this.OnChildModelPropertyChanged);
}
}
if( _model == null ||
_model.Root == null )
return;
void OnChildModelPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (AsyncRefreshCalled)
return;
var manager = _model.Root.Manager;
if( manager == null )
return;
if (_fixingChildrenDockLengths.CanEnter && e.PropertyName == "DockWidth" && Orientation == System.Windows.Controls.Orientation.Horizontal)
{
if (ColumnDefinitions.Count == InternalChildren.Count)
{
var changedElement = sender as ILayoutPositionableElement;
var childFromModel = InternalChildren.OfType<ILayoutControl>().First(ch => ch.Model == changedElement) as UIElement;
int indexOfChild = InternalChildren.IndexOf(childFromModel);
ColumnDefinitions[indexOfChild].Width = changedElement.DockWidth;
}
}
else if (_fixingChildrenDockLengths.CanEnter && e.PropertyName == "DockHeight" && Orientation == System.Windows.Controls.Orientation.Vertical)
{
if (RowDefinitions.Count == InternalChildren.Count)
{
var changedElement = sender as ILayoutPositionableElement;
var childFromModel = InternalChildren.OfType<ILayoutControl>().First(ch => ch.Model == changedElement) as UIElement;
int indexOfChild = InternalChildren.IndexOf(childFromModel);
RowDefinitions[indexOfChild].Height = changedElement.DockHeight;
}
}
else if (e.PropertyName == "IsVisible")
{
UpdateRowColDefinitions();
}
}
foreach( ILayoutElement child in _model.Children )
{
var foundContainedChild = alreadyContainedChildren.FirstOrDefault( chVM => chVM.Model == child );
if( foundContainedChild != null )
Children.Add( foundContainedChild as UIElement );
else
Children.Add( manager.CreateUIElementForModel( child ) );
}
void UpdateRowColDefinitions()
{
var root = _model.Root;
if (root == null)
return;
var manager = root.Manager;
if (manager == null)
return;
CreateSplitters();
FixChildrenDockLengths();
UpdateRowColDefinitions();
//Debug.Assert(InternalChildren.Count == _model.ChildrenCount + (_model.ChildrenCount - 1));
AttachNewSplitters();
AttachPropertyChangeHandler();
}
#region Setup GridRows/Cols
RowDefinitions.Clear();
ColumnDefinitions.Clear();
if (Orientation == Orientation.Horizontal)
{
int iColumn = 0;
int iChild = 0;
for (int iChildModel = 0; iChildModel < _model.Children.Count; iChildModel++, iColumn++, iChild++)
{
var childModel = _model.Children[iChildModel] as ILayoutPositionableElement;
ColumnDefinitions.Add(new ColumnDefinition()
{
Width = childModel.IsVisible ? childModel.DockWidth : new GridLength(0.0, GridUnitType.Pixel),
MinWidth = childModel.IsVisible ? childModel.DockMinWidth : 0.0
});
Grid.SetColumn(InternalChildren[iChild], iColumn);
//append column for splitter
if (iChild < InternalChildren.Count - 1)
{
iChild++;
iColumn++;
bool nextChildModelVisibleExist = false;
for (int i = iChildModel + 1; i < _model.Children.Count; i++)
{
var nextChildModel = _model.Children[i] as ILayoutPositionableElement;
if (nextChildModel.IsVisible)
{
nextChildModelVisibleExist = true;
break;
}
}
ColumnDefinitions.Add(new ColumnDefinition()
{
Width = childModel.IsVisible && nextChildModelVisibleExist ? new GridLength(manager.GridSplitterWidth) : new GridLength(0.0, GridUnitType.Pixel)
});
Grid.SetColumn(InternalChildren[iChild], iColumn);
}
}
}
else //if (_model.Orientation == Orientation.Vertical)
{
int iRow = 0;
int iChild = 0;
for (int iChildModel = 0; iChildModel < _model.Children.Count; iChildModel++, iRow++, iChild++)
{
var childModel = _model.Children[iChildModel] as ILayoutPositionableElement;
RowDefinitions.Add(new RowDefinition()
{
Height = childModel.IsVisible ? childModel.DockHeight : new GridLength(0.0, GridUnitType.Pixel),
MinHeight = childModel.IsVisible ? childModel.DockMinHeight : 0.0
});
Grid.SetRow(InternalChildren[iChild], iRow);
//if (RowDefinitions.Last().Height.Value == 0.0)
// System.Diagnostics.Debugger.Break();
//append row for splitter (if necessary)
if (iChild < InternalChildren.Count - 1)
{
iChild++;
iRow++;
bool nextChildModelVisibleExist = false;
for (int i = iChildModel + 1; i < _model.Children.Count; i++)
{
var nextChildModel = _model.Children[i] as ILayoutPositionableElement;
if (nextChildModel.IsVisible)
{
nextChildModelVisibleExist = true;
break;
}
}
RowDefinitions.Add(new RowDefinition()
{
Height = childModel.IsVisible && nextChildModelVisibleExist ? new GridLength(manager.GridSplitterHeight) : new GridLength(0.0, GridUnitType.Pixel)
});
//if (RowDefinitions.Last().Height.Value == 0.0)
// System.Diagnostics.Debugger.Break();
Grid.SetRow(InternalChildren[iChild], iRow);
}
}
}
private void AttachPropertyChangeHandler()
{
foreach( var child in InternalChildren.OfType<ILayoutControl>() )
{
child.Model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler( this.OnChildModelPropertyChanged );
}
}
#endregion
}
private void DetachPropertChangeHandler()
{
foreach( var child in InternalChildren.OfType<ILayoutControl>() )
{
child.Model.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler( this.OnChildModelPropertyChanged );
}
}
private void OnChildModelPropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
{
if( AsyncRefreshCalled )
return;
ReentrantFlag _fixingChildrenDockLengths = new ReentrantFlag();
protected void FixChildrenDockLengths()
if( _fixingChildrenDockLengths.CanEnter && e.PropertyName == "DockWidth" && Orientation == System.Windows.Controls.Orientation.Horizontal )
{
if( ColumnDefinitions.Count == InternalChildren.Count )
{
var changedElement = sender as ILayoutPositionableElement;
var childFromModel = InternalChildren.OfType<ILayoutControl>().First( ch => ch.Model == changedElement ) as UIElement;
int indexOfChild = InternalChildren.IndexOf( childFromModel );
ColumnDefinitions[ indexOfChild ].Width = changedElement.DockWidth;
}
}
else if( _fixingChildrenDockLengths.CanEnter && e.PropertyName == "DockHeight" && Orientation == System.Windows.Controls.Orientation.Vertical )
{
if( RowDefinitions.Count == InternalChildren.Count )
{
using (_fixingChildrenDockLengths.Enter())
OnFixChildrenDockLengths();
var changedElement = sender as ILayoutPositionableElement;
var childFromModel = InternalChildren.OfType<ILayoutControl>().First( ch => ch.Model == changedElement ) as UIElement;
int indexOfChild = InternalChildren.IndexOf( childFromModel );
RowDefinitions[ indexOfChild ].Height = changedElement.DockHeight;
}
}
else if( e.PropertyName == "IsVisible" )
{
UpdateRowColDefinitions();
}
}
protected abstract void OnFixChildrenDockLengths();
private void UpdateRowColDefinitions()
{
var root = _model.Root;
if( root == null )
return;
var manager = root.Manager;
if( manager == null )
return;
FixChildrenDockLengths();
#region Splitters
//Debug.Assert(InternalChildren.Count == _model.ChildrenCount + (_model.ChildrenCount - 1));
void CreateSplitters()
#region Setup GridRows/Cols
RowDefinitions.Clear();
ColumnDefinitions.Clear();
if( Orientation == Orientation.Horizontal )
{
int iColumn = 0;
int iChild = 0;
for( int iChildModel = 0; iChildModel < _model.Children.Count; iChildModel++, iColumn++, iChild++ )
{
for (int iChild = 1; iChild < Children.Count; iChild++)
var childModel = _model.Children[ iChildModel ] as ILayoutPositionableElement;
ColumnDefinitions.Add( new ColumnDefinition()
{
Width = childModel.IsVisible ? childModel.DockWidth : new GridLength( 0.0, GridUnitType.Pixel ),
MinWidth = childModel.IsVisible ? childModel.DockMinWidth : 0.0
} );
Grid.SetColumn( InternalChildren[ iChild ], iColumn );
//append column for splitter
if( iChild < InternalChildren.Count - 1 )
{
iChild++;
iColumn++;
bool nextChildModelVisibleExist = false;
for( int i = iChildModel + 1; i < _model.Children.Count; i++ )
{
var splitter = new LayoutGridResizerControl();
splitter.Cursor = this.Orientation == Orientation.Horizontal ? Cursors.SizeWE : Cursors.SizeNS;
Children.Insert(iChild, splitter);
iChild++;
var nextChildModel = _model.Children[ i ] as ILayoutPositionableElement;
if( nextChildModel.IsVisible )
{
nextChildModelVisibleExist = true;
break;
}
}
}
void DetachOldSplitters()
{
foreach (var splitter in Children.OfType<LayoutGridResizerControl>())
ColumnDefinitions.Add( new ColumnDefinition()
{
splitter.DragStarted -= new System.Windows.Controls.Primitives.DragStartedEventHandler(OnSplitterDragStarted);
splitter.DragDelta -= new System.Windows.Controls.Primitives.DragDeltaEventHandler(OnSplitterDragDelta);
splitter.DragCompleted -= new System.Windows.Controls.Primitives.DragCompletedEventHandler(OnSplitterDragCompleted);
}
Width = childModel.IsVisible && nextChildModelVisibleExist ? new GridLength( manager.GridSplitterWidth ) : new GridLength( 0.0, GridUnitType.Pixel )
} );
Grid.SetColumn( InternalChildren[ iChild ], iColumn );
}
}
void AttachNewSplitters()
}
else //if (_model.Orientation == Orientation.Vertical)
{
int iRow = 0;
int iChild = 0;
for( int iChildModel = 0; iChildModel < _model.Children.Count; iChildModel++, iRow++, iChild++ )
{
foreach (var splitter in Children.OfType<LayoutGridResizerControl>())
var childModel = _model.Children[ iChildModel ] as ILayoutPositionableElement;
RowDefinitions.Add( new RowDefinition()
{
Height = childModel.IsVisible ? childModel.DockHeight : new GridLength( 0.0, GridUnitType.Pixel ),
MinHeight = childModel.IsVisible ? childModel.DockMinHeight : 0.0
} );
Grid.SetRow( InternalChildren[ iChild ], iRow );
//if (RowDefinitions.Last().Height.Value == 0.0)
// System.Diagnostics.Debugger.Break();
//append row for splitter (if necessary)
if( iChild < InternalChildren.Count - 1 )
{
iChild++;
iRow++;
bool nextChildModelVisibleExist = false;
for( int i = iChildModel + 1; i < _model.Children.Count; i++ )
{
splitter.DragStarted += new System.Windows.Controls.Primitives.DragStartedEventHandler(OnSplitterDragStarted);
splitter.DragDelta += new System.Windows.Controls.Primitives.DragDeltaEventHandler(OnSplitterDragDelta);
splitter.DragCompleted += new System.Windows.Controls.Primitives.DragCompletedEventHandler(OnSplitterDragCompleted);
var nextChildModel = _model.Children[ i ] as ILayoutPositionableElement;
if( nextChildModel.IsVisible )
{
nextChildModelVisibleExist = true;
break;
}
}
}
void OnSplitterDragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
{
var resizer = sender as LayoutGridResizerControl;
ShowResizerOverlayWindow(resizer);
RowDefinitions.Add( new RowDefinition()
{
Height = childModel.IsVisible && nextChildModelVisibleExist ? new GridLength( manager.GridSplitterHeight ) : new GridLength( 0.0, GridUnitType.Pixel )
} );
//if (RowDefinitions.Last().Height.Value == 0.0)
// System.Diagnostics.Debugger.Break();
Grid.SetRow( InternalChildren[ iChild ], iRow );
}
}
}
void OnSplitterDragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
LayoutGridResizerControl splitter = sender as LayoutGridResizerControl;
var rootVisual = this.FindVisualTreeRoot() as Visual;
#endregion
}
var trToWnd = TransformToAncestor(rootVisual);
Vector transformedDelta = trToWnd.Transform(new Point(e.HorizontalChange, e.VerticalChange)) -
trToWnd.Transform(new Point());
private void CreateSplitters()
{
for( int iChild = 1; iChild < Children.Count; iChild++ )
{
var splitter = new LayoutGridResizerControl();
splitter.Cursor = this.Orientation == Orientation.Horizontal ? Cursors.SizeWE : Cursors.SizeNS;
Children.Insert( iChild, splitter );
iChild++;
}
}
if (Orientation == System.Windows.Controls.Orientation.Horizontal)
{
Canvas.SetLeft(_resizerGhost, MathHelper.MinMax(_initialStartPoint.X + transformedDelta.X, 0.0, _resizerWindowHost.Width - _resizerGhost.Width));
}
else
{
Canvas.SetTop(_resizerGhost, MathHelper.MinMax(_initialStartPoint.Y + transformedDelta.Y, 0.0, _resizerWindowHost.Height - _resizerGhost.Height));
}
}
private void DetachOldSplitters()
{
foreach( var splitter in Children.OfType<LayoutGridResizerControl>() )
{
splitter.DragStarted -= new System.Windows.Controls.Primitives.DragStartedEventHandler( OnSplitterDragStarted );
splitter.DragDelta -= new System.Windows.Controls.Primitives.DragDeltaEventHandler( OnSplitterDragDelta );
splitter.DragCompleted -= new System.Windows.Controls.Primitives.DragCompletedEventHandler( OnSplitterDragCompleted );
}
}
void OnSplitterDragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
{
LayoutGridResizerControl splitter = sender as LayoutGridResizerControl;
var rootVisual = this.FindVisualTreeRoot() as Visual;
private void AttachNewSplitters()
{
foreach( var splitter in Children.OfType<LayoutGridResizerControl>() )
{
splitter.DragStarted += new System.Windows.Controls.Primitives.DragStartedEventHandler( OnSplitterDragStarted );
splitter.DragDelta += new System.Windows.Controls.Primitives.DragDeltaEventHandler( OnSplitterDragDelta );
splitter.DragCompleted += new System.Windows.Controls.Primitives.DragCompletedEventHandler( OnSplitterDragCompleted );
}
}
private void OnSplitterDragStarted( object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e )
{
var resizer = sender as LayoutGridResizerControl;
ShowResizerOverlayWindow( resizer );
}
private void OnSplitterDragDelta( object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e )
{
LayoutGridResizerControl splitter = sender as LayoutGridResizerControl;
var rootVisual = this.FindVisualTreeRoot() as Visual;
var trToWnd = TransformToAncestor( rootVisual );
Vector transformedDelta = trToWnd.Transform( new Point( e.HorizontalChange, e.VerticalChange ) ) -
trToWnd.Transform( new Point() );
if( Orientation == System.Windows.Controls.Orientation.Horizontal )
{
Canvas.SetLeft( _resizerGhost, MathHelper.MinMax( _initialStartPoint.X + transformedDelta.X, 0.0, _resizerWindowHost.Width - _resizerGhost.Width ) );
}
else
{
Canvas.SetTop( _resizerGhost, MathHelper.MinMax( _initialStartPoint.Y + transformedDelta.Y, 0.0, _resizerWindowHost.Height - _resizerGhost.Height ) );
}
}
private void OnSplitterDragCompleted( object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e )
{
LayoutGridResizerControl splitter = sender as LayoutGridResizerControl;
var rootVisual = this.FindVisualTreeRoot() as Visual;
var trToWnd = TransformToAncestor(rootVisual);
Vector transformedDelta = trToWnd.Transform(new Point(e.HorizontalChange, e.VerticalChange)) -
trToWnd.Transform(new Point());
var trToWnd = TransformToAncestor( rootVisual );
Vector transformedDelta = trToWnd.Transform( new Point( e.HorizontalChange, e.VerticalChange ) ) -
trToWnd.Transform( new Point() );
double delta;
if (Orientation == System.Windows.Controls.Orientation.Horizontal)
delta = Canvas.GetLeft(_resizerGhost) - _initialStartPoint.X;
else
delta = Canvas.GetTop(_resizerGhost) - _initialStartPoint.Y;
double delta;
if( Orientation == System.Windows.Controls.Orientation.Horizontal )
delta = Canvas.GetLeft( _resizerGhost ) - _initialStartPoint.X;
else
delta = Canvas.GetTop( _resizerGhost ) - _initialStartPoint.Y;
int indexOfResizer = InternalChildren.IndexOf(splitter);
int indexOfResizer = InternalChildren.IndexOf( splitter );
var prevChild = InternalChildren[indexOfResizer - 1] as FrameworkElement;
var nextChild = GetNextVisibleChild(indexOfResizer);
var prevChild = InternalChildren[ indexOfResizer - 1 ] as FrameworkElement;
var nextChild = GetNextVisibleChild( indexOfResizer );
var prevChildActualSize = prevChild.TransformActualSizeToAncestor();
var nextChildActualSize = nextChild.TransformActualSizeToAncestor();
var prevChildActualSize = prevChild.TransformActualSizeToAncestor();
var nextChildActualSize = nextChild.TransformActualSizeToAncestor();
var prevChildModel = (ILayoutPositionableElement)(prevChild as ILayoutControl).Model;
var nextChildModel = (ILayoutPositionableElement)(nextChild as ILayoutControl).Model;
var prevChildModel = ( ILayoutPositionableElement )( prevChild as ILayoutControl ).Model;
var nextChildModel = ( ILayoutPositionableElement )( nextChild as ILayoutControl ).Model;
if( Orientation == System.Windows.Controls.Orientation.Horizontal )
{
@ -425,136 +452,128 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
HideResizerOverlayWindow();
}
HideResizerOverlayWindow();
}
Border _resizerGhost = null;
Window _resizerWindowHost = null;
Vector _initialStartPoint;
private FrameworkElement GetNextVisibleChild( int index )
{
for( int i = index + 1; i < InternalChildren.Count; i++ )
{
if( InternalChildren[ i ] is LayoutGridResizerControl )
continue;
FrameworkElement GetNextVisibleChild(int index)
if( Orientation == System.Windows.Controls.Orientation.Horizontal )
{
for (int i = index + 1; i < InternalChildren.Count; i++)
{
if (InternalChildren[i] is LayoutGridResizerControl)
continue;
if (Orientation == System.Windows.Controls.Orientation.Horizontal)
{
if (ColumnDefinitions[i].Width.IsStar || ColumnDefinitions[i].Width.Value > 0)
return InternalChildren[i] as FrameworkElement;
}
else
{
if (RowDefinitions[i].Height.IsStar || RowDefinitions[i].Height.Value > 0)
return InternalChildren[i] as FrameworkElement;
}
}
return null;
if( ColumnDefinitions[ i ].Width.IsStar || ColumnDefinitions[ i ].Width.Value > 0 )
return InternalChildren[ i ] as FrameworkElement;
}
void ShowResizerOverlayWindow(LayoutGridResizerControl splitter)
else
{
_resizerGhost = new Border()
{
Background = splitter.BackgroundWhileDragging,
Opacity = splitter.OpacityWhileDragging
};
int indexOfResizer = InternalChildren.IndexOf(splitter);
var prevChild = InternalChildren[indexOfResizer - 1] as FrameworkElement;
var nextChild = GetNextVisibleChild(indexOfResizer);
var prevChildActualSize = prevChild.TransformActualSizeToAncestor();
var nextChildActualSize = nextChild.TransformActualSizeToAncestor();
if( RowDefinitions[ i ].Height.IsStar || RowDefinitions[ i ].Height.Value > 0 )
return InternalChildren[ i ] as FrameworkElement;
}
}
var prevChildModel = (ILayoutPositionableElement)(prevChild as ILayoutControl).Model;
var nextChildModel = (ILayoutPositionableElement)(nextChild as ILayoutControl).Model;
return null;
}
Point ptTopLeftScreen = prevChild.PointToScreenDPIWithoutFlowDirection(new Point());
private void ShowResizerOverlayWindow( LayoutGridResizerControl splitter )
{
_resizerGhost = new Border()
{
Background = splitter.BackgroundWhileDragging,
Opacity = splitter.OpacityWhileDragging
};
Size actualSize;
int indexOfResizer = InternalChildren.IndexOf( splitter );
if (Orientation == System.Windows.Controls.Orientation.Horizontal)
{
actualSize = new Size(
prevChildActualSize.Width - prevChildModel.DockMinWidth + splitter.ActualWidth + nextChildActualSize.Width - nextChildModel.DockMinWidth,
nextChildActualSize.Height);
var prevChild = InternalChildren[ indexOfResizer - 1 ] as FrameworkElement;
var nextChild = GetNextVisibleChild( indexOfResizer );
_resizerGhost.Width = splitter.ActualWidth;
_resizerGhost.Height = actualSize.Height;
ptTopLeftScreen.Offset(prevChildModel.DockMinWidth, 0.0);
}
else
{
actualSize = new Size(
prevChildActualSize.Width,
prevChildActualSize.Height - prevChildModel.DockMinHeight + splitter.ActualHeight + nextChildActualSize.Height - nextChildModel.DockMinHeight);
var prevChildActualSize = prevChild.TransformActualSizeToAncestor();
var nextChildActualSize = nextChild.TransformActualSizeToAncestor();
_resizerGhost.Height = splitter.ActualHeight;
_resizerGhost.Width = actualSize.Width;
var prevChildModel = ( ILayoutPositionableElement )( prevChild as ILayoutControl ).Model;
var nextChildModel = ( ILayoutPositionableElement )( nextChild as ILayoutControl ).Model;
ptTopLeftScreen.Offset(0.0, prevChildModel.DockMinHeight);
}
Point ptTopLeftScreen = prevChild.PointToScreenDPIWithoutFlowDirection( new Point() );
_initialStartPoint = splitter.PointToScreenDPIWithoutFlowDirection(new Point()) - ptTopLeftScreen;
Size actualSize;
if (Orientation == System.Windows.Controls.Orientation.Horizontal)
{
Canvas.SetLeft(_resizerGhost, _initialStartPoint.X);
}
else
{
Canvas.SetTop(_resizerGhost, _initialStartPoint.Y);
}
if( Orientation == System.Windows.Controls.Orientation.Horizontal )
{
actualSize = new Size(
prevChildActualSize.Width - prevChildModel.DockMinWidth + splitter.ActualWidth + nextChildActualSize.Width - nextChildModel.DockMinWidth,
nextChildActualSize.Height );
Canvas panelHostResizer = new Canvas()
{
HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
VerticalAlignment = System.Windows.VerticalAlignment.Stretch
};
_resizerGhost.Width = splitter.ActualWidth;
_resizerGhost.Height = actualSize.Height;
ptTopLeftScreen.Offset( prevChildModel.DockMinWidth, 0.0 );
}
else
{
actualSize = new Size(
prevChildActualSize.Width,
prevChildActualSize.Height - prevChildModel.DockMinHeight + splitter.ActualHeight + nextChildActualSize.Height - nextChildModel.DockMinHeight );
panelHostResizer.Children.Add(_resizerGhost);
_resizerGhost.Height = splitter.ActualHeight;
_resizerGhost.Width = actualSize.Width;
ptTopLeftScreen.Offset( 0.0, prevChildModel.DockMinHeight );
}
_resizerWindowHost = new Window()
{
SizeToContent = System.Windows.SizeToContent.Manual,
ResizeMode = ResizeMode.NoResize,
WindowStyle = System.Windows.WindowStyle.None,
ShowInTaskbar = false,
AllowsTransparency = true,
Background = null,
Width = actualSize.Width,
Height = actualSize.Height,
Left = ptTopLeftScreen.X,
Top = ptTopLeftScreen.Y,
ShowActivated = false,
//Owner = Window.GetWindow(this),
Content = panelHostResizer
};
_resizerWindowHost.Loaded += (s, e) =>
{
_resizerWindowHost.SetParentToMainWindowOf(this);
};
_resizerWindowHost.Show();
}
_initialStartPoint = splitter.PointToScreenDPIWithoutFlowDirection( new Point() ) - ptTopLeftScreen;
void HideResizerOverlayWindow()
{
if (_resizerWindowHost != null)
{
_resizerWindowHost.Close();
_resizerWindowHost = null;
}
}
if( Orientation == System.Windows.Controls.Orientation.Horizontal )
{
Canvas.SetLeft( _resizerGhost, _initialStartPoint.X );
}
else
{
Canvas.SetTop( _resizerGhost, _initialStartPoint.Y );
}
#endregion
Canvas panelHostResizer = new Canvas()
{
HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
VerticalAlignment = System.Windows.VerticalAlignment.Stretch
};
panelHostResizer.Children.Add( _resizerGhost );
_resizerWindowHost = new Window()
{
SizeToContent = System.Windows.SizeToContent.Manual,
ResizeMode = ResizeMode.NoResize,
WindowStyle = System.Windows.WindowStyle.None,
ShowInTaskbar = false,
AllowsTransparency = true,
Background = null,
Width = actualSize.Width,
Height = actualSize.Height,
Left = ptTopLeftScreen.X,
Top = ptTopLeftScreen.Y,
ShowActivated = false,
//Owner = Window.GetWindow(this),
Content = panelHostResizer
};
_resizerWindowHost.Loaded += ( s, e ) =>
{
_resizerWindowHost.SetParentToMainWindowOf( this );
};
_resizerWindowHost.Show();
}
private void HideResizerOverlayWindow()
{
if( _resizerWindowHost != null )
{
_resizerWindowHost.Close();
_resizerWindowHost = null;
}
}
#endregion
}
}

129
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridResizerControl.cs

@ -14,70 +14,83 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls.Primitives;
using System.Windows;
using System.Windows.Media;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutGridResizerControl : Thumb
public class LayoutGridResizerControl : Thumb
{
#region Constructors
static LayoutGridResizerControl()
{
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
//This style is defined in themes\generic.xaml
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutGridResizerControl ), new FrameworkPropertyMetadata( typeof( LayoutGridResizerControl ) ) );
HorizontalAlignmentProperty.OverrideMetadata( typeof( LayoutGridResizerControl ), new FrameworkPropertyMetadata( HorizontalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure ) );
VerticalAlignmentProperty.OverrideMetadata( typeof( LayoutGridResizerControl ), new FrameworkPropertyMetadata( VerticalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure ) );
BackgroundProperty.OverrideMetadata( typeof( LayoutGridResizerControl ), new FrameworkPropertyMetadata( Brushes.Transparent ) );
IsHitTestVisibleProperty.OverrideMetadata( typeof( LayoutGridResizerControl ), new FrameworkPropertyMetadata( true, null ) );
}
#endregion
#region Properties
#region BackgroundWhileDragging
/// <summary>
/// BackgroundWhileDragging Dependency Property
/// </summary>
public static readonly DependencyProperty BackgroundWhileDraggingProperty = DependencyProperty.Register( "BackgroundWhileDragging", typeof( Brush ), typeof( LayoutGridResizerControl ),
new FrameworkPropertyMetadata( ( Brush )Brushes.Black ) );
/// <summary>
/// Gets or sets the BackgroundWhileDragging property. This dependency property
/// indicates ....
/// </summary>
public Brush BackgroundWhileDragging
{
static LayoutGridResizerControl()
{
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
//This style is defined in themes\generic.xaml
DefaultStyleKeyProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(typeof(LayoutGridResizerControl)));
HorizontalAlignmentProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
VerticalAlignmentProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(VerticalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
BackgroundProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(Brushes.Transparent));
IsHitTestVisibleProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(true, null));
}
#region BackgroundWhileDragging
/// <summary>
/// BackgroundWhileDragging Dependency Property
/// </summary>
public static readonly DependencyProperty BackgroundWhileDraggingProperty =
DependencyProperty.Register("BackgroundWhileDragging", typeof(Brush), typeof(LayoutGridResizerControl),
new FrameworkPropertyMetadata((Brush)Brushes.Black));
/// <summary>
/// Gets or sets the BackgroundWhileDragging property. This dependency property
/// indicates ....
/// </summary>
public Brush BackgroundWhileDragging
{
get { return (Brush)GetValue(BackgroundWhileDraggingProperty); }
set { SetValue(BackgroundWhileDraggingProperty, value); }
}
#endregion
#region OpacityWhileDragging
/// <summary>
/// OpacityWhileDragging Dependency Property
/// </summary>
public static readonly DependencyProperty OpacityWhileDraggingProperty =
DependencyProperty.Register("OpacityWhileDragging", typeof(double), typeof(LayoutGridResizerControl),
new FrameworkPropertyMetadata((double)0.5));
/// <summary>
/// Gets or sets the OpacityWhileDragging property. This dependency property
/// indicates ....
/// </summary>
public double OpacityWhileDragging
{
get { return (double)GetValue(OpacityWhileDraggingProperty); }
set { SetValue(OpacityWhileDraggingProperty, value); }
}
#endregion
get
{
return ( Brush )GetValue( BackgroundWhileDraggingProperty );
}
set
{
SetValue( BackgroundWhileDraggingProperty, value );
}
}
#endregion
#region OpacityWhileDragging
/// <summary>
/// OpacityWhileDragging Dependency Property
/// </summary>
public static readonly DependencyProperty OpacityWhileDraggingProperty = DependencyProperty.Register( "OpacityWhileDragging", typeof( double ), typeof( LayoutGridResizerControl ),
new FrameworkPropertyMetadata( ( double )0.5 ) );
/// <summary>
/// Gets or sets the OpacityWhileDragging property. This dependency property
/// indicates ....
/// </summary>
public double OpacityWhileDragging
{
get
{
return ( double )GetValue( OpacityWhileDraggingProperty );
}
set
{
SetValue( OpacityWhileDraggingProperty, value );
}
}
#endregion
#endregion
}
}

477
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs

@ -15,14 +15,11 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
using System.Windows.Input;
using Xceed.Wpf.AvalonDock.Commands;
using System.ComponentModel;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Controls;
@ -31,6 +28,26 @@ namespace Xceed.Wpf.AvalonDock.Controls
{
public abstract class LayoutItem : FrameworkElement
{
#region Members
private ICommand _defaultCloseCommand;
private ICommand _defaultFloatCommand;
private ICommand _defaultDockAsDocumentCommand;
private ICommand _defaultCloseAllButThisCommand;
private ICommand _defaultCloseAllCommand;
private ICommand _defaultActivateCommand;
private ICommand _defaultNewVerticalTabGroupCommand;
private ICommand _defaultNewHorizontalTabGroupCommand;
private ICommand _defaultMoveToNextTabGroupCommand;
private ICommand _defaultMoveToPreviousTabGroupCommand;
private ContentPresenter _view = null;
private ReentrantFlag _isSelectedReentrantFlag = new ReentrantFlag();
private ReentrantFlag _isActiveReentrantFlag = new ReentrantFlag();
#endregion
#region Constructors
static LayoutItem()
{
ToolTipProperty.OverrideMetadata( typeof( LayoutItem ), new FrameworkPropertyMetadata( null, ( s, e ) => OnToolTipChanged( s, e ) ) );
@ -40,55 +57,13 @@ namespace Xceed.Wpf.AvalonDock.Controls
internal LayoutItem()
{
}
internal virtual void Attach( LayoutContent model )
{
LayoutElement = model;
Model = model.Content;
InitDefaultCommands();
LayoutElement.IsSelectedChanged += new EventHandler( LayoutElement_IsSelectedChanged );
LayoutElement.IsActiveChanged += new EventHandler( LayoutElement_IsActiveChanged );
DataContext = this;
}
#endregion
#region Properties
void LayoutElement_IsActiveChanged( object sender, EventArgs e )
{
if( _isActiveReentrantFlag.CanEnter )
{
using( _isActiveReentrantFlag.Enter() )
{
var bnd = BindingOperations.GetBinding( this, IsActiveProperty );
IsActive = LayoutElement.IsActive;
var bnd2 = BindingOperations.GetBinding( this, IsActiveProperty );
}
}
}
void LayoutElement_IsSelectedChanged( object sender, EventArgs e )
{
if( _isSelectedReentrantFlag.CanEnter )
{
using( _isSelectedReentrantFlag.Enter() )
{
IsSelected = LayoutElement.IsSelected;
}
}
}
internal virtual void Detach()
{
LayoutElement.IsSelectedChanged -= new EventHandler( LayoutElement_IsSelectedChanged );
LayoutElement.IsActiveChanged -= new EventHandler( LayoutElement_IsActiveChanged );
LayoutElement = null;
Model = null;
}
#region LayoutElement
public LayoutContent LayoutElement
{
@ -96,106 +71,20 @@ namespace Xceed.Wpf.AvalonDock.Controls
private set;
}
#endregion
#region Model
public object Model
{
get;
private set;
}
ICommand _defaultCloseCommand;
ICommand _defaultFloatCommand;
ICommand _defaultDockAsDocumentCommand;
ICommand _defaultCloseAllButThisCommand;
ICommand _defaultCloseAllCommand;
ICommand _defaultActivateCommand;
ICommand _defaultNewVerticalTabGroupCommand;
ICommand _defaultNewHorizontalTabGroupCommand;
ICommand _defaultMoveToNextTabGroupCommand;
ICommand _defaultMoveToPreviousTabGroupCommand;
protected virtual void InitDefaultCommands()
{
_defaultCloseCommand = new RelayCommand( ( p ) => ExecuteCloseCommand( p ), ( p ) => CanExecuteCloseCommand( p ) );
_defaultFloatCommand = new RelayCommand( ( p ) => ExecuteFloatCommand( p ), ( p ) => CanExecuteFloatCommand( p ) );
_defaultDockAsDocumentCommand = new RelayCommand( ( p ) => ExecuteDockAsDocumentCommand( p ), ( p ) => CanExecuteDockAsDocumentCommand( p ) );
_defaultCloseAllButThisCommand = new RelayCommand( ( p ) => ExecuteCloseAllButThisCommand( p ), ( p ) => CanExecuteCloseAllButThisCommand( p ) );
_defaultCloseAllCommand = new RelayCommand( ( p ) => ExecuteCloseAllCommand( p ), ( p ) => CanExecuteCloseAllCommand( p ) );
_defaultActivateCommand = new RelayCommand( ( p ) => ExecuteActivateCommand( p ), ( p ) => CanExecuteActivateCommand( p ) );
_defaultNewVerticalTabGroupCommand = new RelayCommand( ( p ) => ExecuteNewVerticalTabGroupCommand( p ), ( p ) => CanExecuteNewVerticalTabGroupCommand( p ) );
_defaultNewHorizontalTabGroupCommand = new RelayCommand( ( p ) => ExecuteNewHorizontalTabGroupCommand( p ), ( p ) => CanExecuteNewHorizontalTabGroupCommand( p ) );
_defaultMoveToNextTabGroupCommand = new RelayCommand( ( p ) => ExecuteMoveToNextTabGroupCommand( p ), ( p ) => CanExecuteMoveToNextTabGroupCommand( p ) );
_defaultMoveToPreviousTabGroupCommand = new RelayCommand( ( p ) => ExecuteMoveToPreviousTabGroupCommand( p ), ( p ) => CanExecuteMoveToPreviousTabGroupCommand( p ) );
}
protected virtual void ClearDefaultBindings()
{
if( CloseCommand == _defaultCloseCommand )
BindingOperations.ClearBinding( this, CloseCommandProperty );
if( FloatCommand == _defaultFloatCommand )
BindingOperations.ClearBinding( this, FloatCommandProperty );
if( DockAsDocumentCommand == _defaultDockAsDocumentCommand )
BindingOperations.ClearBinding( this, DockAsDocumentCommandProperty );
if( CloseAllButThisCommand == _defaultCloseAllButThisCommand )
BindingOperations.ClearBinding( this, CloseAllButThisCommandProperty );
if( CloseAllCommand == _defaultCloseAllCommand )
BindingOperations.ClearBinding( this, CloseAllCommandProperty );
if( ActivateCommand == _defaultActivateCommand )
BindingOperations.ClearBinding( this, ActivateCommandProperty );
if( NewVerticalTabGroupCommand == _defaultNewVerticalTabGroupCommand )
BindingOperations.ClearBinding( this, NewVerticalTabGroupCommandProperty );
if( NewHorizontalTabGroupCommand == _defaultNewHorizontalTabGroupCommand )
BindingOperations.ClearBinding( this, NewHorizontalTabGroupCommandProperty );
if( MoveToNextTabGroupCommand == _defaultMoveToNextTabGroupCommand )
BindingOperations.ClearBinding( this, MoveToNextTabGroupCommandProperty );
if( MoveToPreviousTabGroupCommand == _defaultMoveToPreviousTabGroupCommand )
BindingOperations.ClearBinding( this, MoveToPreviousTabGroupCommandProperty );
}
protected virtual void SetDefaultBindings()
{
if( CloseCommand == null )
CloseCommand = _defaultCloseCommand;
if( FloatCommand == null )
FloatCommand = _defaultFloatCommand;
if( DockAsDocumentCommand == null )
DockAsDocumentCommand = _defaultDockAsDocumentCommand;
if( CloseAllButThisCommand == null )
CloseAllButThisCommand = _defaultCloseAllButThisCommand;
if( CloseAllCommand == null )
CloseAllCommand = _defaultCloseAllCommand;
if( ActivateCommand == null )
ActivateCommand = _defaultActivateCommand;
if( NewVerticalTabGroupCommand == null )
NewVerticalTabGroupCommand = _defaultNewVerticalTabGroupCommand;
if( NewHorizontalTabGroupCommand == null )
NewHorizontalTabGroupCommand = _defaultNewHorizontalTabGroupCommand;
if( MoveToNextTabGroupCommand == null )
MoveToNextTabGroupCommand = _defaultMoveToNextTabGroupCommand;
if( MoveToPreviousTabGroupCommand == null )
MoveToPreviousTabGroupCommand = _defaultMoveToPreviousTabGroupCommand;
IsSelected = LayoutElement.IsSelected;
IsActive = LayoutElement.IsActive;
CanClose = LayoutElement.CanClose;
}
internal void _ClearDefaultBindings()
{
ClearDefaultBindings();
}
internal void _SetDefaultBindings()
{
SetDefaultBindings();
}
#endregion
internal bool IsViewExists()
{
return ( _view != null );
}
#region View
ContentPresenter _view = null;
public ContentPresenter View
{
get
@ -220,16 +109,15 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
#endregion
#region Title
/// <summary>
/// Title Dependency Property
/// </summary>
public static readonly DependencyProperty TitleProperty =
DependencyProperty.Register( "Title", typeof( string ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( string )null,
new PropertyChangedCallback( OnTitleChanged ) ) );
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( "Title", typeof( string ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( string )null, new PropertyChangedCallback( OnTitleChanged ) ) );
/// <summary>
/// Gets or sets the Title property. This dependency property
@ -266,28 +154,13 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#region ToolTip
private static void OnToolTipChanged( DependencyObject s, DependencyPropertyChangedEventArgs e )
{
( ( LayoutItem )s ).OnToolTipChanged();
}
private void OnToolTipChanged()
{
if( LayoutElement != null )
LayoutElement.ToolTip = ToolTip;
}
#endregion
#region IconSource
/// <summary>
/// IconSource Dependency Property
/// </summary>
public static readonly DependencyProperty IconSourceProperty =
DependencyProperty.Register( "IconSource", typeof( ImageSource ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ImageSource )null,
new PropertyChangedCallback( OnIconSourceChanged ) ) );
public static readonly DependencyProperty IconSourceProperty = DependencyProperty.Register( "IconSource", typeof( ImageSource ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ImageSource )null, new PropertyChangedCallback( OnIconSourceChanged ) ) );
/// <summary>
/// Gets or sets the IconSource property. This dependency property
@ -324,31 +197,13 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#region Visibility
private static void OnVisibilityChanged( DependencyObject s, DependencyPropertyChangedEventArgs e )
{
( ( LayoutItem )s ).OnVisibilityChanged();
}
protected virtual void OnVisibilityChanged()
{
if( LayoutElement != null &&
Visibility == System.Windows.Visibility.Collapsed )
LayoutElement.Close();
}
#endregion
#region ContentId
/// <summary>
/// ContentId Dependency Property
/// </summary>
public static readonly DependencyProperty ContentIdProperty =
DependencyProperty.Register( "ContentId", typeof( string ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( string )null,
new PropertyChangedCallback( OnContentIdChanged ) ) );
public static readonly DependencyProperty ContentIdProperty = DependencyProperty.Register( "ContentId", typeof( string ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( string )null, new PropertyChangedCallback( OnContentIdChanged ) ) );
/// <summary>
/// Gets or sets the ContentId property. This dependency property
@ -387,15 +242,11 @@ namespace Xceed.Wpf.AvalonDock.Controls
#region IsSelected
ReentrantFlag _isSelectedReentrantFlag = new ReentrantFlag();
/// <summary>
/// IsSelected Dependency Property
/// </summary>
public static readonly DependencyProperty IsSelectedProperty =
DependencyProperty.Register( "IsSelected", typeof( bool ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( bool )false,
new PropertyChangedCallback( OnIsSelectedChanged ) ) );
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register( "IsSelected", typeof( bool ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( bool )false, new PropertyChangedCallback( OnIsSelectedChanged ) ) );
/// <summary>
/// Gets or sets the IsSelected property. This dependency property
@ -438,17 +289,13 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#region IsActive
ReentrantFlag _isActiveReentrantFlag = new ReentrantFlag();
#region IsActive
/// <summary>
/// IsActive Dependency Property
/// </summary>
public static readonly DependencyProperty IsActiveProperty =
DependencyProperty.Register( "IsActive", typeof( bool ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( bool )false,
new PropertyChangedCallback( OnIsActiveChanged ) ) );
public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register( "IsActive", typeof( bool ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( bool )false, new PropertyChangedCallback( OnIsActiveChanged ) ) );
/// <summary>
/// Gets or sets the IsActive property. This dependency property
@ -496,10 +343,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// CanClose Dependency Property
/// </summary>
public static readonly DependencyProperty CanCloseProperty =
DependencyProperty.Register( "CanClose", typeof( bool ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( bool )true,
new PropertyChangedCallback( OnCanCloseChanged ) ) );
public static readonly DependencyProperty CanCloseProperty = DependencyProperty.Register( "CanClose", typeof( bool ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( bool )true, new PropertyChangedCallback( OnCanCloseChanged ) ) );
/// <summary>
/// Gets or sets the CanClose property. This dependency property
@ -541,10 +386,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// CanFloat Dependency Property
/// </summary>
public static readonly DependencyProperty CanFloatProperty =
DependencyProperty.Register( "CanFloat", typeof( bool ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( bool )true,
new PropertyChangedCallback( OnCanFloatChanged ) ) );
public static readonly DependencyProperty CanFloatProperty = DependencyProperty.Register( "CanFloat", typeof( bool ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( bool )true, new PropertyChangedCallback( OnCanFloatChanged ) ) );
/// <summary>
/// Gets or sets the CanFloat property. This dependency property
@ -586,11 +429,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// CloseCommand Dependency Property
/// </summary>
public static readonly DependencyProperty CloseCommandProperty =
DependencyProperty.Register( "CloseCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null,
new PropertyChangedCallback( OnCloseCommandChanged ),
new CoerceValueCallback( CoerceCloseCommandValue ) ) );
public static readonly DependencyProperty CloseCommandProperty = DependencyProperty.Register( "CloseCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnCloseCommandChanged ), new CoerceValueCallback( CoerceCloseCommandValue ) ) );
/// <summary>
/// Gets or sets the CloseCommand property. This dependency property
@ -650,11 +490,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// FloatCommand Dependency Property
/// </summary>
public static readonly DependencyProperty FloatCommandProperty =
DependencyProperty.Register( "FloatCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null,
new PropertyChangedCallback( OnFloatCommandChanged ),
new CoerceValueCallback( CoerceFloatCommandValue ) ) );
public static readonly DependencyProperty FloatCommandProperty = DependencyProperty.Register( "FloatCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnFloatCommandChanged ), new CoerceValueCallback( CoerceFloatCommandValue ) ) );
/// <summary>
/// Gets or sets the FloatCommand property. This dependency property
@ -713,16 +550,20 @@ namespace Xceed.Wpf.AvalonDock.Controls
#endregion
#region DockAsDocumentCommand
/// <summary>
/// DockAsDocumentCommand Dependency Property
/// </summary>
public static readonly DependencyProperty DockAsDocumentCommandProperty =
DependencyProperty.Register( "DockAsDocumentCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null,
new PropertyChangedCallback( OnDockAsDocumentCommandChanged ),
new CoerceValueCallback( CoerceDockAsDocumentCommandValue ) ) );
public static readonly DependencyProperty DockAsDocumentCommandProperty = DependencyProperty.Register( "DockAsDocumentCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnDockAsDocumentCommandChanged ), new CoerceValueCallback( CoerceDockAsDocumentCommandValue ) ) );
/// <summary>
/// Gets or sets the DockAsDocumentCommand property. This dependency property
@ -781,11 +622,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// CloseAllButThisCommand Dependency Property
/// </summary>
public static readonly DependencyProperty CloseAllButThisCommandProperty =
DependencyProperty.Register( "CloseAllButThisCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null,
new PropertyChangedCallback( OnCloseAllButThisCommandChanged ),
new CoerceValueCallback( CoerceCloseAllButThisCommandValue ) ) );
public static readonly DependencyProperty CloseAllButThisCommandProperty = DependencyProperty.Register( "CloseAllButThisCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnCloseAllButThisCommandChanged ), new CoerceValueCallback( CoerceCloseAllButThisCommandValue ) ) );
/// <summary>
/// Gets or sets the CloseAllButThisCommand property. This dependency property
@ -850,11 +688,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// CloseAllCommand Dependency Property
/// </summary>
public static readonly DependencyProperty CloseAllCommandProperty =
DependencyProperty.Register( "CloseAllCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null,
new PropertyChangedCallback( OnCloseAllCommandChanged ),
new CoerceValueCallback( CoerceCloseAllCommandValue ) ) );
public static readonly DependencyProperty CloseAllCommandProperty = DependencyProperty.Register( "CloseAllCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnCloseAllCommandChanged ), new CoerceValueCallback( CoerceCloseAllCommandValue ) ) );
/// <summary>
/// Gets or sets the CloseAllCommand property. This dependency property
@ -919,11 +754,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// ActivateCommand Dependency Property
/// </summary>
public static readonly DependencyProperty ActivateCommandProperty =
DependencyProperty.Register( "ActivateCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null,
new PropertyChangedCallback( OnActivateCommandChanged ),
new CoerceValueCallback( CoerceActivateCommandValue ) ) );
public static readonly DependencyProperty ActivateCommandProperty = DependencyProperty.Register( "ActivateCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnActivateCommandChanged ), new CoerceValueCallback( CoerceActivateCommandValue ) ) );
/// <summary>
/// Gets or sets the ActivateCommand property. This dependency property
@ -981,10 +813,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// NewVerticalTabGroupCommand Dependency Property
/// </summary>
public static readonly DependencyProperty NewVerticalTabGroupCommandProperty =
DependencyProperty.Register( "NewVerticalTabGroupCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ICommand )null,
new PropertyChangedCallback( OnNewVerticalTabGroupCommandChanged ) ) );
public static readonly DependencyProperty NewVerticalTabGroupCommandProperty = DependencyProperty.Register( "NewVerticalTabGroupCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ICommand )null, new PropertyChangedCallback( OnNewVerticalTabGroupCommandChanged ) ) );
/// <summary>
/// Gets or sets the NewVerticalTabGroupCommand property. This dependency property
@ -1057,10 +887,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// NewHorizontalTabGroupCommand Dependency Property
/// </summary>
public static readonly DependencyProperty NewHorizontalTabGroupCommandProperty =
DependencyProperty.Register( "NewHorizontalTabGroupCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ICommand )null,
new PropertyChangedCallback( OnNewHorizontalTabGroupCommandChanged ) ) );
public static readonly DependencyProperty NewHorizontalTabGroupCommandProperty = DependencyProperty.Register( "NewHorizontalTabGroupCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ICommand )null, new PropertyChangedCallback( OnNewHorizontalTabGroupCommandChanged ) ) );
/// <summary>
/// Gets or sets the NewHorizontalTabGroupCommand property. This dependency property
@ -1134,10 +962,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// MoveToNextTabGroupCommand Dependency Property
/// </summary>
public static readonly DependencyProperty MoveToNextTabGroupCommandProperty =
DependencyProperty.Register( "MoveToNextTabGroupCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ICommand )null,
new PropertyChangedCallback( OnMoveToNextTabGroupCommandChanged ) ) );
public static readonly DependencyProperty MoveToNextTabGroupCommandProperty = DependencyProperty.Register( "MoveToNextTabGroupCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ICommand )null, new PropertyChangedCallback( OnMoveToNextTabGroupCommandChanged ) ) );
/// <summary>
/// Gets or sets the MoveToNextTabGroupCommand property. This dependency property
@ -1203,10 +1029,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// MoveToPreviousTabGroupCommand Dependency Property
/// </summary>
public static readonly DependencyProperty MoveToPreviousTabGroupCommandProperty =
DependencyProperty.Register( "MoveToPreviousTabGroupCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ICommand )null,
new PropertyChangedCallback( OnMoveToPreviousTabGroupCommandChanged ) ) );
public static readonly DependencyProperty MoveToPreviousTabGroupCommandProperty = DependencyProperty.Register( "MoveToPreviousTabGroupCommand", typeof( ICommand ), typeof( LayoutItem ),
new FrameworkPropertyMetadata( ( ICommand )null, new PropertyChangedCallback( OnMoveToPreviousTabGroupCommandChanged ) ) );
/// <summary>
/// Gets or sets the MoveToPreviousTabGroupCommand property. This dependency property
@ -1265,7 +1089,164 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
#endregion
#endregion
#region Internal Methods
protected virtual void InitDefaultCommands()
{
_defaultCloseCommand = new RelayCommand( ( p ) => ExecuteCloseCommand( p ), ( p ) => CanExecuteCloseCommand( p ) );
_defaultFloatCommand = new RelayCommand( ( p ) => ExecuteFloatCommand( p ), ( p ) => CanExecuteFloatCommand( p ) );
_defaultDockAsDocumentCommand = new RelayCommand( ( p ) => ExecuteDockAsDocumentCommand( p ), ( p ) => CanExecuteDockAsDocumentCommand( p ) );
_defaultCloseAllButThisCommand = new RelayCommand( ( p ) => ExecuteCloseAllButThisCommand( p ), ( p ) => CanExecuteCloseAllButThisCommand( p ) );
_defaultCloseAllCommand = new RelayCommand( ( p ) => ExecuteCloseAllCommand( p ), ( p ) => CanExecuteCloseAllCommand( p ) );
_defaultActivateCommand = new RelayCommand( ( p ) => ExecuteActivateCommand( p ), ( p ) => CanExecuteActivateCommand( p ) );
_defaultNewVerticalTabGroupCommand = new RelayCommand( ( p ) => ExecuteNewVerticalTabGroupCommand( p ), ( p ) => CanExecuteNewVerticalTabGroupCommand( p ) );
_defaultNewHorizontalTabGroupCommand = new RelayCommand( ( p ) => ExecuteNewHorizontalTabGroupCommand( p ), ( p ) => CanExecuteNewHorizontalTabGroupCommand( p ) );
_defaultMoveToNextTabGroupCommand = new RelayCommand( ( p ) => ExecuteMoveToNextTabGroupCommand( p ), ( p ) => CanExecuteMoveToNextTabGroupCommand( p ) );
_defaultMoveToPreviousTabGroupCommand = new RelayCommand( ( p ) => ExecuteMoveToPreviousTabGroupCommand( p ), ( p ) => CanExecuteMoveToPreviousTabGroupCommand( p ) );
}
protected virtual void ClearDefaultBindings()
{
if( CloseCommand == _defaultCloseCommand )
BindingOperations.ClearBinding( this, CloseCommandProperty );
if( FloatCommand == _defaultFloatCommand )
BindingOperations.ClearBinding( this, FloatCommandProperty );
if( DockAsDocumentCommand == _defaultDockAsDocumentCommand )
BindingOperations.ClearBinding( this, DockAsDocumentCommandProperty );
if( CloseAllButThisCommand == _defaultCloseAllButThisCommand )
BindingOperations.ClearBinding( this, CloseAllButThisCommandProperty );
if( CloseAllCommand == _defaultCloseAllCommand )
BindingOperations.ClearBinding( this, CloseAllCommandProperty );
if( ActivateCommand == _defaultActivateCommand )
BindingOperations.ClearBinding( this, ActivateCommandProperty );
if( NewVerticalTabGroupCommand == _defaultNewVerticalTabGroupCommand )
BindingOperations.ClearBinding( this, NewVerticalTabGroupCommandProperty );
if( NewHorizontalTabGroupCommand == _defaultNewHorizontalTabGroupCommand )
BindingOperations.ClearBinding( this, NewHorizontalTabGroupCommandProperty );
if( MoveToNextTabGroupCommand == _defaultMoveToNextTabGroupCommand )
BindingOperations.ClearBinding( this, MoveToNextTabGroupCommandProperty );
if( MoveToPreviousTabGroupCommand == _defaultMoveToPreviousTabGroupCommand )
BindingOperations.ClearBinding( this, MoveToPreviousTabGroupCommandProperty );
}
protected virtual void SetDefaultBindings()
{
if( CloseCommand == null )
CloseCommand = _defaultCloseCommand;
if( FloatCommand == null )
FloatCommand = _defaultFloatCommand;
if( DockAsDocumentCommand == null )
DockAsDocumentCommand = _defaultDockAsDocumentCommand;
if( CloseAllButThisCommand == null )
CloseAllButThisCommand = _defaultCloseAllButThisCommand;
if( CloseAllCommand == null )
CloseAllCommand = _defaultCloseAllCommand;
if( ActivateCommand == null )
ActivateCommand = _defaultActivateCommand;
if( NewVerticalTabGroupCommand == null )
NewVerticalTabGroupCommand = _defaultNewVerticalTabGroupCommand;
if( NewHorizontalTabGroupCommand == null )
NewHorizontalTabGroupCommand = _defaultNewHorizontalTabGroupCommand;
if( MoveToNextTabGroupCommand == null )
MoveToNextTabGroupCommand = _defaultMoveToNextTabGroupCommand;
if( MoveToPreviousTabGroupCommand == null )
MoveToPreviousTabGroupCommand = _defaultMoveToPreviousTabGroupCommand;
IsSelected = LayoutElement.IsSelected;
IsActive = LayoutElement.IsActive;
CanClose = LayoutElement.CanClose;
}
protected virtual void OnVisibilityChanged()
{
if( LayoutElement != null &&
Visibility == System.Windows.Visibility.Collapsed )
LayoutElement.Close();
}
internal virtual void Attach( LayoutContent model )
{
LayoutElement = model;
Model = model.Content;
InitDefaultCommands();
LayoutElement.IsSelectedChanged += new EventHandler( LayoutElement_IsSelectedChanged );
LayoutElement.IsActiveChanged += new EventHandler( LayoutElement_IsActiveChanged );
DataContext = this;
}
internal virtual void Detach()
{
LayoutElement.IsSelectedChanged -= new EventHandler( LayoutElement_IsSelectedChanged );
LayoutElement.IsActiveChanged -= new EventHandler( LayoutElement_IsActiveChanged );
LayoutElement = null;
Model = null;
}
internal void _ClearDefaultBindings()
{
ClearDefaultBindings();
}
internal void _SetDefaultBindings()
{
SetDefaultBindings();
}
internal bool IsViewExists()
{
return ( _view != null );
}
#endregion
#region Private Methods
private void LayoutElement_IsActiveChanged( object sender, EventArgs e )
{
if( _isActiveReentrantFlag.CanEnter )
{
using( _isActiveReentrantFlag.Enter() )
{
var bnd = BindingOperations.GetBinding( this, IsActiveProperty );
IsActive = LayoutElement.IsActive;
var bnd2 = BindingOperations.GetBinding( this, IsActiveProperty );
}
}
}
private void LayoutElement_IsSelectedChanged( object sender, EventArgs e )
{
if( _isSelectedReentrantFlag.CanEnter )
{
using( _isSelectedReentrantFlag.Enter() )
{
IsSelected = LayoutElement.IsSelected;
}
}
}
private static void OnToolTipChanged( DependencyObject s, DependencyPropertyChangedEventArgs e )
{
( ( LayoutItem )s ).OnToolTipChanged();
}
private void OnToolTipChanged()
{
if( LayoutElement != null )
LayoutElement.ToolTip = ToolTip;
}
private static void OnVisibilityChanged( DependencyObject s, DependencyPropertyChangedEventArgs e )
{
( ( LayoutItem )s ).OnVisibilityChanged();
}
#endregion
}
}

198
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutPanelControl.cs

@ -15,117 +15,125 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class LayoutPanelControl : LayoutGridControl<ILayoutPanelElement>, ILayoutControl
public class LayoutPanelControl : LayoutGridControl<ILayoutPanelElement>, ILayoutControl
{
#region Members
private LayoutPanel _model;
#endregion
#region Constructors
internal LayoutPanelControl( LayoutPanel model )
: base( model, model.Orientation )
{
internal LayoutPanelControl(LayoutPanel model)
:base(model, model.Orientation)
{
_model = model;
_model = model;
}
}
LayoutPanel _model;
#endregion
protected override void OnFixChildrenDockLengths()
{
if (ActualWidth == 0.0 ||
ActualHeight == 0.0)
return;
#region Overrides
var modelAsPositionableElement = _model as ILayoutPositionableElementWithActualSize;
#region Setup DockWidth/Height for children
if (_model.Orientation == Orientation.Horizontal)
protected override void OnFixChildrenDockLengths()
{
if( ActualWidth == 0.0 ||
ActualHeight == 0.0 )
return;
var modelAsPositionableElement = _model as ILayoutPositionableElementWithActualSize;
#region Setup DockWidth/Height for children
if( _model.Orientation == Orientation.Horizontal )
{
if( _model.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() )
{
for( int i = 0; i < _model.Children.Count; i++ )
{
var childContainerModel = _model.Children[ i ] as ILayoutContainer;
var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement;
if( childContainerModel != null &&
( childContainerModel.IsOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ||
childContainerModel.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ) )
{
if (_model.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>())
{
for (int i = 0; i < _model.Children.Count; i++)
{
var childContainerModel = _model.Children[i] as ILayoutContainer;
var childPositionableModel = _model.Children[i] as ILayoutPositionableElement;
if (childContainerModel != null &&
(childContainerModel.IsOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ||
childContainerModel.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>()))
{
childPositionableModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
}
else if (childPositionableModel != null && childPositionableModel.DockWidth.IsStar)
{
var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize;
var widthToSet = Math.Max(childPositionableModelWidthActualSize.ActualWidth, childPositionableModel.DockMinWidth);
widthToSet = Math.Min(widthToSet, ActualWidth / 2.0);
widthToSet = Math.Max(widthToSet, childPositionableModel.DockMinWidth);
childPositionableModel.DockWidth = new GridLength(
widthToSet,
GridUnitType.Pixel);
}
}
}
else
{
for (int i = 0; i < _model.Children.Count; i++)
{
var childPositionableModel = _model.Children[i] as ILayoutPositionableElement;
if (!childPositionableModel.DockWidth.IsStar)
{
childPositionableModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
}
}
}
childPositionableModel.DockWidth = new GridLength( 1.0, GridUnitType.Star );
}
else
else if( childPositionableModel != null && childPositionableModel.DockWidth.IsStar )
{
if (_model.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>())
{
for (int i = 0; i < _model.Children.Count; i++)
{
var childContainerModel = _model.Children[i] as ILayoutContainer;
var childPositionableModel = _model.Children[i] as ILayoutPositionableElement;
if (childContainerModel != null &&
(childContainerModel.IsOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ||
childContainerModel.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>()))
{
childPositionableModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
}
else if (childPositionableModel != null && childPositionableModel.DockHeight.IsStar)
{
var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize;
var heightToSet = Math.Max(childPositionableModelWidthActualSize.ActualHeight, childPositionableModel.DockMinHeight);
heightToSet = Math.Min(heightToSet, ActualHeight / 2.0);
heightToSet = Math.Max(heightToSet, childPositionableModel.DockMinHeight);
childPositionableModel.DockHeight = new GridLength(heightToSet, GridUnitType.Pixel);
}
}
}
else
{
for (int i = 0; i < _model.Children.Count; i++)
{
var childPositionableModel = _model.Children[i] as ILayoutPositionableElement;
if (!childPositionableModel.DockHeight.IsStar)
{
childPositionableModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
}
}
}
var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize;
var widthToSet = Math.Max( childPositionableModelWidthActualSize.ActualWidth, childPositionableModel.DockMinWidth );
widthToSet = Math.Min( widthToSet, ActualWidth / 2.0 );
widthToSet = Math.Max( widthToSet, childPositionableModel.DockMinWidth );
childPositionableModel.DockWidth = new GridLength(
widthToSet,
GridUnitType.Pixel );
}
#endregion
}
}
else
{
for( int i = 0; i < _model.Children.Count; i++ )
{
var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement;
if( !childPositionableModel.DockWidth.IsStar )
{
childPositionableModel.DockWidth = new GridLength( 1.0, GridUnitType.Star );
}
}
}
}
else
{
if( _model.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() )
{
for( int i = 0; i < _model.Children.Count; i++ )
{
var childContainerModel = _model.Children[ i ] as ILayoutContainer;
var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement;
if( childContainerModel != null &&
( childContainerModel.IsOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ||
childContainerModel.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ) )
{
childPositionableModel.DockHeight = new GridLength( 1.0, GridUnitType.Star );
}
else if( childPositionableModel != null && childPositionableModel.DockHeight.IsStar )
{
var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize;
var heightToSet = Math.Max( childPositionableModelWidthActualSize.ActualHeight, childPositionableModel.DockMinHeight );
heightToSet = Math.Min( heightToSet, ActualHeight / 2.0 );
heightToSet = Math.Max( heightToSet, childPositionableModel.DockMinHeight );
childPositionableModel.DockHeight = new GridLength( heightToSet, GridUnitType.Pixel );
}
}
}
else
{
for( int i = 0; i < _model.Children.Count; i++ )
{
var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement;
if( !childPositionableModel.DockHeight.IsStar )
{
childPositionableModel.DockHeight = new GridLength( 1.0, GridUnitType.Star );
}
}
}
}
#endregion
}
#endregion
}
}

250
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/MenuItemEx.cs

@ -14,126 +14,146 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class MenuItemEx : MenuItem
public class MenuItemEx : MenuItem
{
#region Members
private bool _reentrantFlag = false;
#endregion
#region Constructors
static MenuItemEx()
{
IconProperty.OverrideMetadata( typeof( MenuItemEx ), new FrameworkPropertyMetadata( new PropertyChangedCallback( OnIconPropertyChanged ) ) );
}
public MenuItemEx()
{
}
#endregion
#region Properties
#region IconTemplate
/// <summary>
/// IconTemplate Dependency Property
/// </summary>
public static readonly DependencyProperty IconTemplateProperty = DependencyProperty.Register( "IconTemplate", typeof( DataTemplate ), typeof( MenuItemEx ),
new FrameworkPropertyMetadata( ( DataTemplate )null, new PropertyChangedCallback( OnIconTemplateChanged ) ) );
/// <summary>
/// Gets or sets the IconTemplate property. This dependency property
/// indicates the data template for the icon.
/// </summary>
public DataTemplate IconTemplate
{
get
{
return ( DataTemplate )GetValue( IconTemplateProperty );
}
set
{
SetValue( IconTemplateProperty, value );
}
}
/// <summary>
/// Handles changes to the IconTemplate property.
/// </summary>
private static void OnIconTemplateChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( MenuItemEx )d ).OnIconTemplateChanged( e );
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the IconTemplate property.
/// </summary>
protected virtual void OnIconTemplateChanged( DependencyPropertyChangedEventArgs e )
{
UpdateIcon();
}
#endregion
#region IconTemplateSelector
/// <summary>
/// IconTemplateSelector Dependency Property
/// </summary>
public static readonly DependencyProperty IconTemplateSelectorProperty = DependencyProperty.Register( "IconTemplateSelector", typeof( DataTemplateSelector ), typeof( MenuItemEx ),
new FrameworkPropertyMetadata( ( DataTemplateSelector )null, new PropertyChangedCallback( OnIconTemplateSelectorChanged ) ) );
/// <summary>
/// Gets or sets the IconTemplateSelector property. This dependency property
/// indicates the DataTemplateSelector for the Icon.
/// </summary>
public DataTemplateSelector IconTemplateSelector
{
get
{
return ( DataTemplateSelector )GetValue( IconTemplateSelectorProperty );
}
set
{
SetValue( IconTemplateSelectorProperty, value );
}
}
/// <summary>
/// Handles changes to the IconTemplateSelector property.
/// </summary>
private static void OnIconTemplateSelectorChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
{
( ( MenuItemEx )d ).OnIconTemplateSelectorChanged( e );
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the IconTemplateSelector property.
/// </summary>
protected virtual void OnIconTemplateSelectorChanged( DependencyPropertyChangedEventArgs e )
{
static MenuItemEx()
{
IconProperty.OverrideMetadata(typeof(MenuItemEx), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnIconPropertyChanged)));
}
public MenuItemEx()
{
}
#region IconTemplate
/// <summary>
/// IconTemplate Dependency Property
/// </summary>
public static readonly DependencyProperty IconTemplateProperty =
DependencyProperty.Register("IconTemplate", typeof(DataTemplate), typeof(MenuItemEx),
new FrameworkPropertyMetadata((DataTemplate)null,
new PropertyChangedCallback(OnIconTemplateChanged)));
/// <summary>
/// Gets or sets the IconTemplate property. This dependency property
/// indicates the data template for the icon.
/// </summary>
public DataTemplate IconTemplate
{
get { return (DataTemplate)GetValue(IconTemplateProperty); }
set { SetValue(IconTemplateProperty, value); }
}
/// <summary>
/// Handles changes to the IconTemplate property.
/// </summary>
private static void OnIconTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((MenuItemEx)d).OnIconTemplateChanged(e);
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the IconTemplate property.
/// </summary>
protected virtual void OnIconTemplateChanged(DependencyPropertyChangedEventArgs e)
{
UpdateIcon();
}
#endregion
#region IconTemplateSelector
/// <summary>
/// IconTemplateSelector Dependency Property
/// </summary>
public static readonly DependencyProperty IconTemplateSelectorProperty =
DependencyProperty.Register("IconTemplateSelector", typeof(DataTemplateSelector), typeof(MenuItemEx),
new FrameworkPropertyMetadata((DataTemplateSelector)null,
new PropertyChangedCallback(OnIconTemplateSelectorChanged)));
/// <summary>
/// Gets or sets the IconTemplateSelector property. This dependency property
/// indicates the DataTemplateSelector for the Icon.
/// </summary>
public DataTemplateSelector IconTemplateSelector
{
get { return (DataTemplateSelector)GetValue(IconTemplateSelectorProperty); }
set { SetValue(IconTemplateSelectorProperty, value); }
}
/// <summary>
/// Handles changes to the IconTemplateSelector property.
/// </summary>
private static void OnIconTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((MenuItemEx)d).OnIconTemplateSelectorChanged(e);
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the IconTemplateSelector property.
/// </summary>
protected virtual void OnIconTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
{
UpdateIcon();
}
#endregion
static void OnIconPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != null)
{
((MenuItemEx)sender).UpdateIcon();
}
}
bool _reentrantFlag = false;
void UpdateIcon()
{
if (_reentrantFlag)
return;
_reentrantFlag = true;
if (IconTemplateSelector != null)
{
var dataTemplateToUse = IconTemplateSelector.SelectTemplate(Icon, this);
if (dataTemplateToUse != null)
Icon = dataTemplateToUse.LoadContent();
}
else if (IconTemplate != null)
Icon = IconTemplate.LoadContent();
_reentrantFlag = false;
}
UpdateIcon();
}
#endregion
#endregion
#region Private Mehods
private static void OnIconPropertyChanged( DependencyObject sender, DependencyPropertyChangedEventArgs e )
{
if( e.NewValue != null )
{
( ( MenuItemEx )sender ).UpdateIcon();
}
}
private void UpdateIcon()
{
if( _reentrantFlag )
return;
_reentrantFlag = true;
if( IconTemplateSelector != null )
{
var dataTemplateToUse = IconTemplateSelector.SelectTemplate( Icon, this );
if( dataTemplateToUse != null )
Icon = dataTemplateToUse.LoadContent();
}
else if( IconTemplate != null )
Icon = IconTemplate.LoadContent();
_reentrantFlag = false;
}
#endregion
}
}

448
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/NavigatorWindow.cs

@ -19,12 +19,30 @@ using System.Linq;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
using Xceed.Wpf.AvalonDock.Themes;
using System.Windows.Controls;
namespace Xceed.Wpf.AvalonDock.Controls
{
[TemplatePart( Name = PART_AnchorableListBox, Type = typeof( ListBox ) )]
[TemplatePart( Name = PART_DocumentListBox, Type = typeof( ListBox ) )]
public class NavigatorWindow : Window
{
#region Members
private const string PART_AnchorableListBox = "PART_AnchorableListBox";
private const string PART_DocumentListBox = "PART_DocumentListBox";
private ResourceDictionary currentThemeResourceDictionary; // = null
private DockingManager _manager;
private bool _isSelectingDocument;
private ListBox _anchorableListBox;
private ListBox _documentListBox;
private bool _internalSetSelectedDocument = false;
private bool _internalSetSelectedAnchorable = false;
#endregion
#region Constructors
static NavigatorWindow()
{
@ -33,124 +51,47 @@ namespace Xceed.Wpf.AvalonDock.Controls
ShowInTaskbarProperty.OverrideMetadata( typeof( NavigatorWindow ), new FrameworkPropertyMetadata( false ) );
}
DockingManager _manager;
internal NavigatorWindow( DockingManager manager )
{
_manager = manager;
_internalSetSelectedDocument = true;
SetAnchorables( _manager.Layout.Descendents().OfType<LayoutAnchorable>().Where( a => a.IsVisible ).Select( d => ( LayoutAnchorableItem )_manager.GetLayoutItemFromModel( d ) ).ToArray() );
SetDocuments( _manager.Layout.Descendents().OfType<LayoutDocument>().OrderByDescending( d => d.LastActivationTimeStamp.GetValueOrDefault() ).Select( d => ( LayoutDocumentItem )_manager.GetLayoutItemFromModel( d ) ).ToArray() );
this.SetAnchorables( _manager.Layout.Descendents().OfType<LayoutAnchorable>().Where( a => a.IsVisible ).Select( d => ( LayoutAnchorableItem )_manager.GetLayoutItemFromModel( d ) ).ToArray() );
this.SetDocuments( _manager.Layout.Descendents().OfType<LayoutDocument>().OrderByDescending( d => d.LastActivationTimeStamp.GetValueOrDefault() ).Select( d => ( LayoutDocumentItem )_manager.GetLayoutItemFromModel( d ) ).ToArray() );
_internalSetSelectedDocument = false;
if( Documents.Length > 1 )
InternalSetSelectedDocument( Documents[ 1 ] );
this.DataContext = this;
this.Loaded += new RoutedEventHandler( OnLoaded );
this.Unloaded += new RoutedEventHandler( OnUnloaded );
UpdateThemeResources();
}
internal void UpdateThemeResources( Theme oldTheme = null )
{
if( oldTheme != null )
if( this.Documents.Length > 1 )
{
if( oldTheme is DictionaryTheme )
{
if( currentThemeResourceDictionary != null )
{
Resources.MergedDictionaries.Remove( currentThemeResourceDictionary );
currentThemeResourceDictionary = null;
}
}
else
{
var resourceDictionaryToRemove =
Resources.MergedDictionaries.FirstOrDefault( r => r.Source == oldTheme.GetResourceUri() );
if( resourceDictionaryToRemove != null )
Resources.MergedDictionaries.Remove(
resourceDictionaryToRemove );
}
this.InternalSetSelectedDocument( this.Documents[ 1 ] );
_isSelectingDocument = true;
}
if( _manager.Theme != null )
else if( this.Anchorables.Count() > 1 )
{
if( _manager.Theme is DictionaryTheme )
{
currentThemeResourceDictionary = ( ( DictionaryTheme )_manager.Theme ).ThemeResourceDictionary;
Resources.MergedDictionaries.Add( currentThemeResourceDictionary );
}
else
{
Resources.MergedDictionaries.Add( new ResourceDictionary() { Source = _manager.Theme.GetResourceUri() } );
}
this.InternalSetSelectedAnchorable( this.Anchorables.ToArray()[ 1 ] );
_isSelectingDocument = false;
}
}
void OnLoaded( object sender, RoutedEventArgs e )
{
this.Loaded -= new RoutedEventHandler( OnLoaded );
this.Focus();
//this.SetParentToMainWindowOf(_manager);
WindowStartupLocation = WindowStartupLocation.CenterOwner;
}
this.DataContext = this;
void OnUnloaded( object sender, RoutedEventArgs e )
{
this.Unloaded -= new RoutedEventHandler( OnUnloaded );
this.Loaded += new RoutedEventHandler( OnLoaded );
this.Unloaded += new RoutedEventHandler( OnUnloaded );
//_hwndSrc.RemoveHook(_hwndSrcHook);
//_hwndSrc.Dispose();
//_hwndSrc = null;
this.UpdateThemeResources();
}
//protected virtual IntPtr FilterMessage(
// IntPtr hwnd,
// int msg,
// IntPtr wParam,
// IntPtr lParam,
// ref bool handled
// )
//{
// handled = false;
// switch (msg)
// {
// case Win32Helper.WM_ACTIVATE:
// if (((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE)
// {
// if (lParam == new WindowInteropHelper(this.Owner).Handle)
// {
// Win32Helper.SetActiveWindow(_hwndSrc.Handle);
// handled = true;
// }
// }
// break;
// }
// return IntPtr.Zero;
//}
#endregion
#region Properties
#region Documents
/// <summary>
/// Documents Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey DocumentsPropertyKey
= DependencyProperty.RegisterReadOnly( "Documents", typeof( IEnumerable<LayoutDocumentItem> ), typeof( NavigatorWindow ),
private static readonly DependencyPropertyKey DocumentsPropertyKey = DependencyProperty.RegisterReadOnly( "Documents", typeof( IEnumerable<LayoutDocumentItem> ), typeof( NavigatorWindow ),
new FrameworkPropertyMetadata( null ) );
public static readonly DependencyProperty DocumentsProperty
= DocumentsPropertyKey.DependencyProperty;
public static readonly DependencyProperty DocumentsProperty = DocumentsPropertyKey.DependencyProperty;
/// <summary>
/// Gets the Documents property. This dependency property
@ -164,16 +105,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
/// <summary>
/// Provides a secure method for setting the Documents property.
/// This dependency property indicates the list of documents.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetDocuments( LayoutDocumentItem[] value )
{
SetValue( DocumentsPropertyKey, value );
}
#endregion
#region Anchorables
@ -181,12 +112,10 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// Anchorables Read-Only Dependency Property
/// </summary>
private static readonly DependencyPropertyKey AnchorablesPropertyKey
= DependencyProperty.RegisterReadOnly( "Anchorables", typeof( IEnumerable<LayoutAnchorableItem> ), typeof( NavigatorWindow ),
private static readonly DependencyPropertyKey AnchorablesPropertyKey = DependencyProperty.RegisterReadOnly( "Anchorables", typeof( IEnumerable<LayoutAnchorableItem> ), typeof( NavigatorWindow ),
new FrameworkPropertyMetadata( ( IEnumerable<LayoutAnchorableItem> )null ) );
public static readonly DependencyProperty AnchorablesProperty
= AnchorablesPropertyKey.DependencyProperty;
public static readonly DependencyProperty AnchorablesProperty = AnchorablesPropertyKey.DependencyProperty;
/// <summary>
/// Gets the Anchorables property. This dependency property
@ -200,16 +129,6 @@ namespace Xceed.Wpf.AvalonDock.Controls
}
}
/// <summary>
/// Provides a secure method for setting the Anchorables property.
/// This dependency property indicates the list of anchorables.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetAnchorables( IEnumerable<LayoutAnchorableItem> value )
{
SetValue( AnchorablesPropertyKey, value );
}
#endregion
#region SelectedDocument
@ -217,10 +136,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// SelectedDocument Dependency Property
/// </summary>
public static readonly DependencyProperty SelectedDocumentProperty =
DependencyProperty.Register( "SelectedDocument", typeof( LayoutDocumentItem ), typeof( NavigatorWindow ),
new FrameworkPropertyMetadata( ( LayoutDocumentItem )null,
new PropertyChangedCallback( OnSelectedDocumentChanged ) ) );
public static readonly DependencyProperty SelectedDocumentProperty = DependencyProperty.Register( "SelectedDocument", typeof( LayoutDocumentItem ), typeof( NavigatorWindow ),
new FrameworkPropertyMetadata( ( LayoutDocumentItem )null, new PropertyChangedCallback( OnSelectedDocumentChanged ) ) );
/// <summary>
/// Gets or sets the SelectedDocument property. This dependency property
@ -254,21 +171,12 @@ namespace Xceed.Wpf.AvalonDock.Controls
if( _internalSetSelectedDocument )
return;
if( SelectedDocument != null &&
SelectedDocument.ActivateCommand.CanExecute( null ) )
if( this.SelectedDocument != null &&
this.SelectedDocument.ActivateCommand.CanExecute( null ) )
{
SelectedDocument.ActivateCommand.Execute( null );
Hide();
this.Hide();
this.SelectedDocument.ActivateCommand.Execute( null );
}
}
bool _internalSetSelectedDocument = false;
void InternalSetSelectedDocument( LayoutDocumentItem documentToSelect )
{
_internalSetSelectedDocument = true;
SelectedDocument = documentToSelect;
_internalSetSelectedDocument = false;
}
#endregion
@ -278,10 +186,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// <summary>
/// SelectedAnchorable Dependency Property
/// </summary>
public static readonly DependencyProperty SelectedAnchorableProperty =
DependencyProperty.Register( "SelectedAnchorable", typeof( LayoutAnchorableItem ), typeof( NavigatorWindow ),
new FrameworkPropertyMetadata( ( LayoutAnchorableItem )null,
new PropertyChangedCallback( OnSelectedAnchorableChanged ) ) );
public static readonly DependencyProperty SelectedAnchorableProperty = DependencyProperty.Register( "SelectedAnchorable", typeof( LayoutAnchorableItem ), typeof( NavigatorWindow ),
new FrameworkPropertyMetadata( ( LayoutAnchorableItem )null, new PropertyChangedCallback( OnSelectedAnchorableChanged ) ) );
/// <summary>
/// Gets or sets the SelectedAnchorable property. This dependency property
@ -312,68 +218,274 @@ namespace Xceed.Wpf.AvalonDock.Controls
/// </summary>
protected virtual void OnSelectedAnchorableChanged( DependencyPropertyChangedEventArgs e )
{
if( _internalSetSelectedAnchorable )
return;
var selectedAnchorable = e.NewValue as LayoutAnchorableItem;
if( SelectedAnchorable != null &&
SelectedAnchorable.ActivateCommand.CanExecute( null ) )
if( this.SelectedAnchorable != null &&
this.SelectedAnchorable.ActivateCommand.CanExecute( null ) )
{
this.Close();
this.SelectedAnchorable.ActivateCommand.Execute( null );
}
}
#endregion
#endregion
#region Overrides
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_anchorableListBox = this.GetTemplateChild( PART_AnchorableListBox ) as ListBox;
_documentListBox = this.GetTemplateChild( PART_DocumentListBox ) as ListBox;
}
protected override void OnPreviewKeyDown( System.Windows.Input.KeyEventArgs e )
{
bool shouldHandle = false;
// Press Tab to switch Selected LayoutContent.
if( e.Key == System.Windows.Input.Key.Tab)
{
// Selecting LayoutDocuments
if( _isSelectingDocument )
{
if( this.SelectedDocument != null )
{
// Jump to next LayoutDocument
var docIndex = this.Documents.IndexOf<LayoutDocumentItem>( this.SelectedDocument );
if( docIndex < (this.Documents.Length - 1) )
{
this.SelectNextDocument();
shouldHandle = true;
}
// Jump to first LayoutAnchorable
else if( this.Anchorables.Count() > 0 )
{
_isSelectingDocument = false;
this.InternalSetSelectedDocument( null );
this.InternalSetSelectedAnchorable( this.Anchorables.First() );
shouldHandle = true;
}
}
// There is no SelectedDocument, select the first one.
else
{
if( this.Documents.Length > 0 )
{
this.InternalSetSelectedDocument( this.Documents[ 0 ] );
shouldHandle = true;
}
}
}
// Selecting LayoutAnchorables
else
{
if( this.SelectedAnchorable != null )
{
// Jump to next LayoutAnchorable
var anchorableIndex = this.Anchorables.ToArray().IndexOf<LayoutAnchorableItem>( this.SelectedAnchorable );
if( anchorableIndex < (this.Anchorables.Count() - 1) )
{
this.SelectNextAnchorable();
shouldHandle = true;
}
// Jump to first LayoutDocument
else if( this.Documents.Length > 0 )
{
_isSelectingDocument = true;
this.InternalSetSelectedAnchorable( null );
this.InternalSetSelectedDocument( this.Documents[ 0 ] );
shouldHandle = true;
}
}
// There is no SelectedAnchorable, select the first one.
else
{
if( this.Anchorables.Count() > 0 )
{
this.InternalSetSelectedAnchorable( this.Anchorables.ToArray()[ 0 ] );
shouldHandle = true;
}
}
}
}
if( shouldHandle )
{
SelectedAnchorable.ActivateCommand.Execute( null );
Close();
e.Handled = true;
}
base.OnPreviewKeyDown( e );
}
protected override void OnPreviewKeyUp( System.Windows.Input.KeyEventArgs e )
{
if( e.Key != System.Windows.Input.Key.Tab )
{
this.Close();
if( this.SelectedDocument != null &&
this.SelectedDocument.ActivateCommand.CanExecute( null ) )
{
this.SelectedDocument.ActivateCommand.Execute( null );
}
if( this.SelectedDocument == null &&
this.SelectedAnchorable != null &&
this.SelectedAnchorable.ActivateCommand.CanExecute( null ) )
{
this.SelectedAnchorable.ActivateCommand.Execute( null );
}
e.Handled = true;
}
base.OnPreviewKeyUp( e );
}
#endregion
#region Internal Methods
/// <summary>
/// Provides a secure method for setting the Anchorables property.
/// This dependency property indicates the list of anchorables.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetAnchorables( IEnumerable<LayoutAnchorableItem> value )
{
this.SetValue( AnchorablesPropertyKey, value );
}
/// <summary>
/// Provides a secure method for setting the Documents property.
/// This dependency property indicates the list of documents.
/// </summary>
/// <param name="value">The new value for the property.</param>
protected void SetDocuments( LayoutDocumentItem[] value )
{
this.SetValue( DocumentsPropertyKey, value );
}
internal void UpdateThemeResources( Theme oldTheme = null )
{
if( oldTheme != null )
{
if( oldTheme is DictionaryTheme )
{
if( currentThemeResourceDictionary != null )
{
this.Resources.MergedDictionaries.Remove( currentThemeResourceDictionary );
currentThemeResourceDictionary = null;
}
}
else
{
var resourceDictionaryToRemove = this.Resources.MergedDictionaries.FirstOrDefault( r => r.Source == oldTheme.GetResourceUri() );
if( resourceDictionaryToRemove != null )
{
this.Resources.MergedDictionaries.Remove( resourceDictionaryToRemove );
}
}
}
if( _manager.Theme != null )
{
if( _manager.Theme is DictionaryTheme )
{
currentThemeResourceDictionary = ( ( DictionaryTheme )_manager.Theme ).ThemeResourceDictionary;
this.Resources.MergedDictionaries.Add( currentThemeResourceDictionary );
}
else
{
this.Resources.MergedDictionaries.Add( new ResourceDictionary() { Source = _manager.Theme.GetResourceUri() } );
}
}
}
internal void SelectNextDocument()
{
if( SelectedDocument != null )
if( this.SelectedDocument != null )
{
int docIndex = Documents.IndexOf<LayoutDocumentItem>( SelectedDocument );
int docIndex = this.Documents.IndexOf<LayoutDocumentItem>( this.SelectedDocument );
docIndex++;
if( docIndex == Documents.Length )
if( docIndex == this.Documents.Length )
{
docIndex = 0;
InternalSetSelectedDocument( Documents[ docIndex ] );
}
this.InternalSetSelectedDocument( this.Documents[ docIndex ] );
}
}
protected override void OnKeyDown( System.Windows.Input.KeyEventArgs e )
internal void SelectNextAnchorable()
{
base.OnKeyDown( e );
if( this.SelectedAnchorable != null )
{
var anchorablesArray = this.Anchorables.ToArray();
int anchorableIndex = anchorablesArray.IndexOf<LayoutAnchorableItem>( this.SelectedAnchorable );
anchorableIndex++;
if( anchorableIndex == this.Anchorables.Count() )
{
anchorableIndex = 0;
}
this.InternalSetSelectedAnchorable( anchorablesArray[ anchorableIndex ] );
}
}
protected override void OnPreviewKeyDown( System.Windows.Input.KeyEventArgs e )
#endregion
#region Private Methods
private void InternalSetSelectedAnchorable( LayoutAnchorableItem anchorableToSelect )
{
if( e.Key == System.Windows.Input.Key.Tab )
_internalSetSelectedAnchorable = true;
this.SelectedAnchorable = anchorableToSelect;
_internalSetSelectedAnchorable = false;
if( _anchorableListBox != null )
{
SelectNextDocument();
e.Handled = true;
_anchorableListBox.Focus();
}
}
private void InternalSetSelectedDocument( LayoutDocumentItem documentToSelect )
{
_internalSetSelectedDocument = true;
this.SelectedDocument = documentToSelect;
_internalSetSelectedDocument = false;
base.OnPreviewKeyDown( e );
if( ( _documentListBox != null ) && ( documentToSelect != null ) )
{
_documentListBox.Focus();
}
}
protected override void OnPreviewKeyUp( System.Windows.Input.KeyEventArgs e )
private void OnLoaded( object sender, RoutedEventArgs e )
{
if( e.Key != System.Windows.Input.Key.Tab )
this.Loaded -= new RoutedEventHandler( OnLoaded );
if( ( _documentListBox != null ) && (this.SelectedDocument != null) )
{
if( SelectedAnchorable != null &&
SelectedAnchorable.ActivateCommand.CanExecute( null ) )
SelectedAnchorable.ActivateCommand.Execute( null );
if( SelectedAnchorable == null &&
SelectedDocument != null &&
SelectedDocument.ActivateCommand.CanExecute( null ) )
SelectedDocument.ActivateCommand.Execute( null );
Close();
e.Handled = true;
_documentListBox.Focus();
}
else if( ( _anchorableListBox != null ) && (this.SelectedAnchorable != null) )
{
_anchorableListBox.Focus();
}
base.OnPreviewKeyUp( e );
WindowStartupLocation = WindowStartupLocation.CenterOwner;
}
private void OnUnloaded( object sender, RoutedEventArgs e )
{
this.Unloaded -= new RoutedEventHandler( OnUnloaded );
}
#endregion
}
}

56
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayArea.cs

@ -14,41 +14,47 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
namespace Xceed.Wpf.AvalonDock.Controls
{
public abstract class OverlayArea : IOverlayWindowArea
{
internal OverlayArea(IOverlayWindow overlayWindow)
{
_overlayWindow = overlayWindow;
}
public abstract class OverlayArea : IOverlayWindowArea
{
#region Members
private IOverlayWindow _overlayWindow;
private Rect? _screenDetectionArea;
#endregion
IOverlayWindow _overlayWindow;
#region Constructors
internal OverlayArea( IOverlayWindow overlayWindow )
{
_overlayWindow = overlayWindow;
}
Rect? _screenDetectionArea;
Rect IOverlayWindowArea.ScreenDetectionArea
{
get
{
return _screenDetectionArea.Value;
}
}
#endregion
protected void SetScreenDetectionArea(Rect rect)
{
_screenDetectionArea = rect;
}
#region Internal Methods
protected void SetScreenDetectionArea( Rect rect )
{
_screenDetectionArea = rect;
}
#endregion
#region IOverlayWindowArea
Rect IOverlayWindowArea.ScreenDetectionArea
{
get
{
return _screenDetectionArea.Value;
}
}
#endregion
}
}

1244
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindow.cs

File diff suppressed because it is too large

61
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindowDropTarget.cs

@ -14,42 +14,51 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
namespace Xceed.Wpf.AvalonDock.Controls
{
public class OverlayWindowDropTarget : IOverlayWindowDropTarget
public class OverlayWindowDropTarget : IOverlayWindowDropTarget
{
#region Members
private IOverlayWindowArea _overlayArea;
private Rect _screenDetectionArea;
private OverlayWindowDropTargetType _type;
#endregion
#region Constructors
internal OverlayWindowDropTarget( IOverlayWindowArea overlayArea, OverlayWindowDropTargetType targetType, FrameworkElement element )
{
internal OverlayWindowDropTarget(IOverlayWindowArea overlayArea, OverlayWindowDropTargetType targetType, FrameworkElement element)
{
_overlayArea = overlayArea;
_type = targetType;
_screenDetectionArea = new Rect(element.TransformToDeviceDPI(new Point()), element.TransformActualSizeToAncestor());
}
_overlayArea = overlayArea;
_type = targetType;
_screenDetectionArea = new Rect( element.TransformToDeviceDPI( new Point() ), element.TransformActualSizeToAncestor() );
}
IOverlayWindowArea _overlayArea;
#endregion
Rect _screenDetectionArea;
Rect IOverlayWindowDropTarget.ScreenDetectionArea
{
get
{
return _screenDetectionArea;
}
}
#region IOverlayWindowDropTarget
OverlayWindowDropTargetType _type;
OverlayWindowDropTargetType IOverlayWindowDropTarget.Type
{
get { return _type; }
}
Rect IOverlayWindowDropTarget.ScreenDetectionArea
{
get
{
return _screenDetectionArea;
}
}
OverlayWindowDropTargetType IOverlayWindowDropTarget.Type
{
get
{
return _type;
}
}
#endregion
}
}

45
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/OverlayWindowDropTargetType.cs

@ -14,31 +14,26 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Xceed.Wpf.AvalonDock.Controls
{
public enum OverlayWindowDropTargetType
{
DockingManagerDockLeft,
DockingManagerDockTop,
DockingManagerDockRight,
DockingManagerDockBottom,
DocumentPaneDockLeft,
DocumentPaneDockTop,
DocumentPaneDockRight,
DocumentPaneDockBottom,
DocumentPaneDockInside,
AnchorablePaneDockLeft,
AnchorablePaneDockTop,
AnchorablePaneDockRight,
AnchorablePaneDockBottom,
AnchorablePaneDockInside,
}
public enum OverlayWindowDropTargetType
{
DockingManagerDockLeft,
DockingManagerDockTop,
DockingManagerDockRight,
DockingManagerDockBottom,
DocumentPaneDockLeft,
DocumentPaneDockTop,
DocumentPaneDockRight,
DocumentPaneDockBottom,
DocumentPaneDockInside,
AnchorablePaneDockLeft,
AnchorablePaneDockTop,
AnchorablePaneDockRight,
AnchorablePaneDockBottom,
AnchorablePaneDockInside,
}
}

79
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/ReentrantFlag.cs

@ -15,42 +15,57 @@
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Xceed.Wpf.AvalonDock.Controls
{
class ReentrantFlag
internal class ReentrantFlag
{
#region Members
private bool _flag = false;
#endregion
#region Properties
public bool CanEnter
{
public class _ReentrantFlagHandler : IDisposable
{
ReentrantFlag _owner;
public _ReentrantFlagHandler(ReentrantFlag owner)
{
_owner = owner;
_owner._flag = true;
}
public void Dispose()
{
_owner._flag = false;
}
}
bool _flag = false;
public _ReentrantFlagHandler Enter()
{
if (_flag)
throw new InvalidOperationException();
return new _ReentrantFlagHandler(this);
}
public bool CanEnter
{
get { return !_flag; }
}
get
{
return !_flag;
}
}
#endregion
#region Public Methods
public _ReentrantFlagHandler Enter()
{
if( _flag )
throw new InvalidOperationException();
return new _ReentrantFlagHandler( this );
}
#endregion
#region Internal Classes
public class _ReentrantFlagHandler : IDisposable
{
private ReentrantFlag _owner;
public _ReentrantFlagHandler( ReentrantFlag owner )
{
_owner = owner;
_owner._flag = true;
}
public void Dispose()
{
_owner._flag = false;
}
}
#endregion
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save