-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMainView.axaml
More file actions
213 lines (213 loc) · 10.6 KB
/
MainView.axaml
File metadata and controls
213 lines (213 loc) · 10.6 KB
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<UserControl
d:DesignHeight="550"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="Lemon.ModuleNavigation.Sample.Views.MainView"
x:DataType="vm:MainViewModel"
xmlns="https://github.com/avaloniaui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:lm="https://github.com/NeverMorewd/Lemon.ModuleNavigation"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Lemon.ModuleNavigation.Sample.ViewModels"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Styles>
<Style Selector="StackPanel.ForContainerShow">
<Setter Property="Spacing" Value="5" />
<Setter Property="Orientation" Value="Vertical" />
</Style>
<Style Selector="Border.HSeparator">
<Setter Property="Background" Value="Gray" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Height" Value="2" />
<Setter Property="Margin" Value="5,0,5,0" />
</Style>
<Style Selector="Button.ViewNavigation">
<Setter Property="Height" Value="30" />
<Setter Property="Width" Value="200" />
<Setter Property="Command" Value="{Binding ToViewCommand}" />
<Setter Property="CommandParameter" Value="{Binding $self.Content}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style Selector="Button.DialogShow">
<Setter Property="Height" Value="30" />
<Setter Property="Width" Value="300" />
<Setter Property="Command" Value="{Binding ShowCommand}" />
<Setter Property="CommandParameter" Value="{Binding $self.Tag}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style Selector="Button.DialogShowDialog">
<Setter Property="Height" Value="30" />
<Setter Property="Width" Value="300" />
<Setter Property="Command" Value="{Binding ShowDialogCommand}" />
<Setter Property="CommandParameter" Value="{Binding $self.Tag}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style Selector="Button.DialogShowDialogSync">
<Setter Property="Height" Value="30" />
<Setter Property="Width" Value="300" />
<Setter Property="Command" Value="{Binding ShowDialogSyncCommand}" />
<Setter Property="CommandParameter" Value="{Binding $self.Tag}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</UserControl.Styles>
<TabControl>
<TabItem Header="View">
<Grid ColumnDefinitions="auto,*,*,*,*" ShowGridLines="True">
<StackPanel Orientation="Vertical" Spacing="5">
<Label Content="Views" />
<Button Classes="ViewNavigation" Content="ViewAlpha" />
<Button Classes="ViewNavigation" Content="ViewBeta" />
<Button Classes="ViewNavigation" Content="ViewAlpha.RequestNew" />
<Button Classes="ViewNavigation" Content="ViewBeta.RequestNew" />
</StackPanel>
<StackPanel Classes="ForContainerShow" Grid.Column="1">
<Label Content="ContentControl" />
<Border Classes="HSeparator" />
<ContentControl lm:NavigationExtension.RegionName="ContentRegion" />
</StackPanel>
<StackPanel Classes="ForContainerShow" Grid.Column="2">
<Label Content="TabControl" />
<Border Classes="HSeparator" />
<TabControl lm:NavigationExtension.RegionName="TabRegion">
<TabControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Spacing="2">
<TextBlock Text="{Binding Alias}" />
<Button
Content="X"
FontSize="11"
Height="20"
HorizontalContentAlignment="Center"
Padding="-1,0,0,0"
VerticalContentAlignment="Center"
Width="20"
Command="{Binding DataContext.UnloadViewCommand, RelativeSource={RelativeSource AncestorType=TabControl}}"
CommandParameter="{Binding}" />
</StackPanel>
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
</StackPanel>
<StackPanel Classes="ForContainerShow" Grid.Column="3">
<Label Content="ItemsControl" />
<Border Classes="HSeparator" />
<ListBox
Background="Transparent"
BorderBrush="LemonChiffon"
BorderThickness="1"
Margin="2"
MaxHeight="600"
lm:NavigationExtension.RegionName="ItemsRegion" />
</StackPanel>
<StackPanel Classes="ForContainerShow" Grid.Column="4">
<Label Content="TransitioningContentControl" />
<Border Classes="HSeparator" />
<TransitioningContentControl lm:NavigationExtension.RegionName="TransitioningContentRegion" />
</StackPanel>
</Grid>
</TabItem>
<TabItem Header="Dialog">
<StackPanel
Orientation="Vertical"
Spacing="5"
Width="300">
<Label Content="Dialogs" />
<Button
Classes="DialogShow"
Content="ViewAlpha.Show"
Tag="ViewAlpha" />
<Button
Classes="DialogShow"
Content="ViewBeta.Show"
Tag="ViewBeta" />
<Button
Classes="DialogShowDialog"
Content="ViewAlpha.ShowDialog"
Tag="ViewAlpha" />
<Button
Classes="DialogShowDialog"
Content="ViewBeta.ShowDialog"
Tag="ViewBeta" />
<Button
Classes="DialogShowDialogSync"
Content="ViewAlpha.ShowDialogSync"
Tag="ViewAlpha" />
<Button
Classes="DialogShowDialogSync"
Content="ViewBeta.ShowDialogSync"
Tag="ViewBeta" />
</StackPanel>
</TabItem>
<TabItem Header="Module">
<Grid ColumnDefinitions="auto,*,*,*,*" ShowGridLines="True">
<StackPanel
Margin="0,0,2,0"
Orientation="Vertical"
Spacing="5">
<Label Content="Modules" Target="{Binding ElementName=ModuleLists}" />
<ListBox
Grid.Column="0"
ItemsSource="{Binding Modules}"
Name="ModuleLists"
SelectedItem="{Binding SelectedModule, Mode=TwoWay}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Alias}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
<StackPanel Classes="ForContainerShow" Grid.Column="1">
<Label Content="ContentControl" />
<Border Classes="HSeparator" />
<ContentControl lm:NavigationExtension.ModuleContainerName="NContentControl" />
</StackPanel>
<StackPanel Classes="ForContainerShow" Grid.Column="2">
<Label Content="TabControl" />
<Border Classes="HSeparator" />
<TabControl lm:NavigationExtension.ModuleContainerName="NTabControl">
<TabControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Spacing="2">
<TextBlock Text="{Binding Alias}" />
<Button
Content="X"
FontSize="11"
Height="20"
HorizontalContentAlignment="Center"
Padding="-1,0,0,0"
VerticalContentAlignment="Center"
Width="20"
lm:NavigationExtension.CanUnload="{Binding CanUnload}" />
</StackPanel>
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
</StackPanel>
<StackPanel Classes="ForContainerShow" Grid.Column="3">
<Label Content="ListBox" />
<Border Classes="HSeparator" />
<ListBox
Background="Transparent"
BorderBrush="LemonChiffon"
BorderThickness="1"
Margin="2"
MaxHeight="600"
lm:NavigationExtension.ModuleContainerName="NListBox">
<!-- https://github.com/AvaloniaUI/Avalonia/issues/17349 -->
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</StackPanel>
<StackPanel Classes="ForContainerShow" Grid.Column="4">
<Label Content="TransitioningContentControl" />
<Border Classes="HSeparator" />
<TransitioningContentControl lm:NavigationExtension.ModuleContainerName="NTransitioningContentControl" />
</StackPanel>
</Grid>
</TabItem>
</TabControl>
</UserControl>