/
MainWindow.xaml
165 lines (158 loc) · 10.9 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<ui:DockWindow x:Class="AstoundingApplications.AstoundingDock.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
xmlns:ui="clr-namespace:AstoundingApplications.AstoundingDock.Ui"
xmlns:conv="clr-namespace:AstoundingApplications.AstoundingDock.Converters"
xmlns:vm="clr-namespace:AstoundingApplications.AstoundingDock.ViewModels"
xmlns:utils="clr-namespace:AstoundingApplications.AstoundingDock.Utils"
mc:Ignorable="d"
AllowsTransparency="True"
Background="Transparent"
Title="AstoundingDock"
Height="0"
Width="0">
<ui:DockWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Themes/AppDockTheme.xaml"/>
</ResourceDictionary.MergedDictionaries>
<conv:ImagePathToImageSourceConverter x:Key="ImagePathToImageSource"/>
<conv:ImagePathToImageConverter x:Key="ImagePathToImage"/>
<conv:IconSizeToIntConverter x:Key="IconSizeToInt"/>
<!-- Standard context menus-->
<ContextMenu x:Key="MainContextMenu">
<MenuItem Command="{Binding AddTabCommand}" Header="Add New Tab"/>
<MenuItem Command="{Binding AddApplicationCommand}" Header="Add New Application"/>
<MenuItem Command="{Binding ViewApplicationsCommand}" Header="View Applications"/>
<MenuItem Command="{Binding OpenSettingsWindowCommand}" Header="Settings"/>
<MenuItem Command="{Binding OpenAboutCommand}" Header="About"/>
<MenuItem Command="{Binding CloseCommand}" Header="Close"/>
</ContextMenu>
<ContextMenu x:Key="TabContextMenu">
<MenuItem Command="{Binding IncreaseTabOrderCommand}" Header="{Binding IncreaseTabOrderCommandHeader}"/>
<MenuItem Command="{Binding DecreaseTabOrderCommand}" Header="{Binding DecreaseTabOrderCommandHeader}"/>
<MenuItem Command="{Binding EditCommand}" Header="Edit Tab"/>
<MenuItem Command="{Binding RemoveCommand}" Header="Remove Tab"/>
<MenuItem Header="Main Menu">
<MenuItem Command="{Binding AddTabCommand}" Header="Add New Tab"/>
<MenuItem Command="{Binding AddApplicationCommand}" Header="Add New Application"/>
<MenuItem Command="{Binding ViewApplicationsCommand}" Header="View Applications"/>
<MenuItem Command="{Binding OpenSettingsCommand}" Header="Settings"/>
<MenuItem Command="{Binding OpenAboutCommand}" Header="About"/>
<MenuItem Command="{Binding CloseCommand}" Header="Close"/>
</MenuItem>
</ContextMenu>
<ContextMenu x:Key="ApplicationContextMenu">
<MenuItem Command="{Binding EditCommand}" Header="Edit Dock Entry"/>
<MenuItem Command="{Binding RemoveCommand}" Header="Remove Dock Entry"/>
</ContextMenu>
</ResourceDictionary>
</ui:DockWindow.Resources>
<Canvas Background="Transparent" ui:DragDropBehaviour.CanDrop="True">
<Grid x:Name="mainGrid"
Height="0"
Width="0"
Background="{StaticResource WindowBackgroundBrush}"
ContextMenu="{StaticResource MainContextMenu}">
<ListBox x:Name="horizontalListBox"
ItemsSource="{Binding Tabs}"
ContextMenu="{StaticResource MainContextMenu}"
Visibility="Collapsed"
SelectedItem="{Binding ExpandedTab}"
VirtualizingStackPanel.IsVirtualizing="False"
ItemContainerStyle="{StaticResource BorderlessListBoxItem}"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<ui:NoRightClickExpander ToolTip="{Binding Title}"
ui:DragDropBehaviour.CanDrop="True"
IsExpanded="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}"
ContextMenu="{StaticResource TabContextMenu}">
<Expander.Style>
<Style TargetType="{x:Type Expander}" BasedOn="{StaticResource {x:Type Expander}}"/>
</Expander.Style>
<Expander.Header>
<TextBlock Text="{Binding Title}"
Width="{Binding Path=ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"/>
</Expander.Header>
<ItemsControl ItemsSource="{Binding ApplicationsView}"
ui:DragDropBehaviour.CanDrop="True"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button ContextMenu="{StaticResource ApplicationContextMenu}"
ui:DragDropBehaviour.CanDrag="True"
ui:DragDropBehaviour.CanDrop="True"
Style="{StaticResource AppButton}"
Margin="3,3,3,3"
Command="{Binding RunCommand}"
ToolTip="{Binding Title}"
ui:ShellContextMenuBehaviour.OpenShellContextMenu="True">
<Image Source="{Binding Path=ImagePath,
Converter={StaticResource ImagePathToImageSource},
ConverterParameter=Medium}"
Width="32" Height="32"/>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ui:NoRightClickExpander>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Menu x:Name="verticalMenu"
ItemsSource="{Binding Tabs}"
ContextMenu="{StaticResource MainContextMenu}"
Visibility="Collapsed"
VirtualizingStackPanel.IsVirtualizing="False"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<Menu.ItemContainerStyle>
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Header" Value="{Binding Title}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="ItemsSource" Value="{Binding Applications}"/>
<Setter Property="ContextMenu" Value="{StaticResource TabContextMenu}"/>
<Setter Property="StaysOpenOnClick" Value="True"/>
<Setter Property="ui:DragDropBehaviour.CanDrop" Value="True"/>
<Setter Property="ui:AppMenuItemBehaviour.DoNotHideIfOpen" Value="True"/>
<Setter Property="ui:PreloadingMenuBehaviour.EnabledPreloading" Value="True"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="Header" Value="{Binding Title}"/>
<Setter Property="Command" Value="{Binding RunCommand}"/>
<Setter Property="ContextMenu" Value="{StaticResource ApplicationContextMenu}"/>
<Setter Property="StaysOpenOnClick" Value="False"/>
<Setter Property="ui:DragDropBehaviour.CanDrag" Value="True"/>
<Setter Property="ui:DragDropBehaviour.CanDrop" Value="True"/>
<Setter Property="ui:ShellContextMenuBehaviour.OpenShellContextMenu" Value="True"/>
<Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Standard"/>
<Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="False"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Icon" Value="{Binding Path=ImagePath,
IsAsync=True,
Converter={StaticResource ImagePathToImage},
ConverterParameter=Medium}"/>
</Style>
</Setter.Value>
</Setter>
</Style>
</Menu.ItemContainerStyle>
</Menu>
</Grid>
</Canvas>
</ui:DockWindow>