forked from stride3d/stride
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommonResources.xaml
328 lines (316 loc) · 19 KB
/
CommonResources.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
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:sd="http://schemas.stride3d.net/xaml/presentation"
xmlns:view="clr-namespace:Stride.Core.Assets.Editor.View"
xmlns:viewModel="clr-namespace:Stride.Core.Assets.Editor.ViewModel"
xmlns:behaviors="clr-namespace:Stride.Core.Assets.Editor.View.Behaviors"
mc:Ignorable="d">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Stride.Core.Presentation;component/Themes/ThemeSelector.xaml" />
<ResourceDictionary Source="ImageDictionary.xaml" />
<ResourceDictionary Source="../Themes/ThemeSelector.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="view:DataGridEx">
<Setter Property="Background" Value="{StaticResource NormalBrush}" />
</Style>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="{StaticResource NormalBrush}" />
</Style>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="{StaticResource NormalBrush}" />
</Style>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="{StaticResource WindowBackgroundBrush}" />
</Style>
<SolidColorBrush x:Key="EmphasisColorBrush" Color="#316B8F"/>
<!-- STYLE USED FOR TOOLBAR BUTTONS -->
<Style x:Key="ToolBarIconMenuItemStyle" TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="MinWidth" Value="20"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="2,0"/>
<Setter Property="Padding" Value="2"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="17" Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.ColumnSpan="2" Background="{DynamicResource ToolBarToggleButtonHoverBackground}" Opacity="0" x:Name="HoverBorder"/>
<ContentPresenter Grid.Column="0" Margin="{TemplateBinding Padding}"
Width="{Binding Path=Content.(Image.Source).(BitmapSource.PixelWidth), RelativeSource={RelativeSource Self}, FallbackValue=Auto}"
Height="{Binding Path=Content.(Image.Source).(BitmapSource.PixelHeight), RelativeSource={RelativeSource Self}, FallbackValue=Auto}"
x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon" />
<ContentPresenter Grid.Column="1" x:Name="HeaderHost" RecognizesAccessKey="True" ContentSource="Header" Margin="2,1" VerticalAlignment="Center" HorizontalAlignment="Stretch" SnapsToDevicePixels="True"/>
<Popup Grid.Column="0" Grid.ColumnSpan="2" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" x:Name="SubMenuPopup" Focusable="false" AllowsTransparency="true" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
<Grid x:Name="SubMenu">
<Border x:Name="SubMenuBorder" Background="{DynamicResource MenuBackgroundBrush}" BorderBrush="{DynamicResource MenuBorderBrush}" BorderThickness="1"/>
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
</Grid>
</Popup>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
<Setter Property="PopupAnimation" Value="None" TargetName="SubMenuPopup" />
</Trigger>
<Trigger Property="Header" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="HeaderHost" />
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Opacity" TargetName="HoverBorder" Value="1"/>
<Setter Property="Foreground" Value="Black" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="Gray" />
<Setter TargetName="Icon" Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ToolBarDropDownMenuItemStyle" TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="MinWidth" Value="0"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="2,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Border Background="{DynamicResource ToolBarToggleButtonHoverBackground}" Opacity="0" x:Name="HoverBorder"/>
<Path x:Name="Path" Margin="{TemplateBinding Padding}" HorizontalAlignment="Stretch" Width="6" Height="4" Fill="{DynamicResource GlyphBrush}" Stretch="Fill" Stroke="{DynamicResource GlyphBrush}" StrokeThickness="1" Data="M5.2422477,11.132184 L11.5544,11.132184 8.6412958,4.4969033 z" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<RotateTransform Angle="180"/>
</Path.RenderTransform>
</Path>
<Popup IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" x:Name="SubMenuPopup" Focusable="false" AllowsTransparency="true" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
<Grid x:Name="SubMenu">
<Border x:Name="SubMenuBorder" Background="{DynamicResource MenuBackgroundBrush}" BorderBrush="{DynamicResource MenuBorderBrush}" BorderThickness="1"/>
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
</Grid>
</Popup>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
<Setter Property="PopupAnimation" Value="None" TargetName="SubMenuPopup" />
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Opacity" TargetName="HoverBorder" Value="1"/>
<Setter Property="Foreground" Value="Black" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="Gray" />
<Setter TargetName="Path" Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="DragVisualTemplate" DataType="behaviors:DragContainer">
<Border Background="{StaticResource BackgroundBrush}" BorderBrush="{StaticResource NormalBorderBrush}"
BorderThickness="1" Padding="4" SnapsToDevicePixels="True">
<StackPanel>
<ItemsControl ItemsSource="{Binding PreviewItems}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{StaticResource ImageFolder}" Margin="0,0,5,0"/>
<!-- ReSharper disable Xaml.BindingWithContextNotResolved - This is why we use a PriorityBinding, we don't know what object is bound. -->
<TextBlock Text="{sd:PriorityBinding {Binding DisplayName, Mode=OneWay}, {Binding Name, Mode=OneWay}, {Binding Mode=OneWay}}"/>
<!-- ReSharper restore Xaml.BindingWithContextNotResolved -->
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<StackPanel Orientation="Horizontal">
<Image Source="{StaticResource ImageAcceptingDrop}" Margin="0,0,5,0" Visibility="{Binding IsAccepted, Converter={sd:VisibleOrCollapsed}}"/>
<Image Source="{StaticResource ImageRejectingDrop}" Margin="0,0,5,0" Visibility="{Binding IsRejected, Converter={sd:VisibleOrCollapsed}}"/>
<TextBlock Text="{Binding Message, Mode=OneWay}"/>
</StackPanel>
</StackPanel>
</Border>
</DataTemplate>
<Style x:Key="ImageButtonStyle" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Margin" Value="2,0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Width" Value="16"/>
<Setter Property="Height" Value="16"/>
</Style>
<Style x:Key="MenuGroupSeparatorStyle" TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Margin" Value="0"/>
<!-- IsEnabled=False is necessary for proper navigation in the menu (this separator will be skipped). -->
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Grid Background="{StaticResource BackgroundBrush}" MinHeight="20">
<ContentPresenter ContentSource="Header" Margin="8,2" TextBlock.FontWeight="Bold" VerticalAlignment="Center">
<ContentPresenter.Resources>
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<!-- Do not change the text color. -->
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
</Trigger>
</Style.Triggers>
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MenuGroupWithItemsStyle" TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Margin" Value="0" />
<!-- IsCheckable=True is a hack to prevent WPF from clearing the selected sub menu item -->
<Setter Property="IsCheckable" Value="True" />
<Setter Property="StaysOpenOnClick" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<StackPanel>
<Grid Background="{StaticResource BackgroundBrush}" MinHeight="20">
<ContentPresenter ContentSource="Header" Margin="8,2" TextBlock.FontWeight="Bold" VerticalAlignment="Center"/>
</Grid>
<StackPanel IsItemsHost="True" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<view:TreeViewTemplateSelector x:Key="SolutionTreeViewTemplate">
<view:TreeViewTemplateSelector.PackageTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Content}" DataType="viewModel:PackageViewModel">
<StackPanel Orientation="Horizontal" ToolTip="{Binding PackagePath, Converter={sd:UDirectoryToString}}">
<Image Source="{StaticResource ImagePackage}" Margin="0,0,5,0"/>
<TextBlock x:Name="PackageText">
<Run Text="{Binding Name, Mode=OneWay}"/><Run Text="{Binding IsDirty, Mode=OneWay, Converter={sd:BoolToParam}, ConverterParameter=*}"/>
<Run Text="{Binding IsLoaded, Mode=OneWay, Converter={sd:Chained {sd:InvertBool}, {sd:BoolToParam}, Parameter2=(Errors)}}"/>
</TextBlock>
</StackPanel>
<HierarchicalDataTemplate.Triggers>
<DataTrigger Binding="{Binding IsCurrentPackage}" Value="True">
<Setter TargetName="PackageText" Property="FontWeight" Value="UltraBold"/>
</DataTrigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.PackageTemplate>
<view:TreeViewTemplateSelector.AssetMountPointTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding SubDirectories}" DataType="viewModel:AssetMountPointViewModel">
<StackPanel Orientation="Horizontal">
<Image x:Name="DirectoryImage" Source="{StaticResource ImageRootFolder}" Margin="0,0,5,0"/>
<TextBlock>
<Run Text="{Binding Name, Mode=OneWay}"/><Run Text="{Binding IsDirty, Mode=OneWay, Converter={sd:BoolToParam}, ConverterParameter=*}"/>
</TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.AssetMountPointTemplate>
<view:TreeViewTemplateSelector.DirectoryTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding SubDirectories}" DataType="viewModel:DirectoryViewModel">
<StackPanel Orientation="Horizontal">
<Image x:Name="DirectoryImage" Source="{StaticResource ImageFolder}" Margin="0,0,5,0"/>
<TextBlock>
<Run Text="{Binding Name, Mode=OneWay}"/><Run Text="{Binding IsDirty, Mode=OneWay, Converter={sd:BoolToParam}, ConverterParameter=*}"/>
</TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.DirectoryTemplate>
<view:TreeViewTemplateSelector.DependencyCategoryTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Content}" DataType="viewModel:ICategoryViewModel">
<StackPanel Orientation="Horizontal">
<Image Source="{StaticResource ImageDepsRoot}" Margin="0,0,5,0"/>
<TextBlock>
<Run Text="{Binding Name, Mode=OneWay}"/><Run Text="{Binding IsDirty, Mode=OneWay, Converter={sd:BoolToParam}, ConverterParameter=*}"/>
</TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.DependencyCategoryTemplate>
<view:TreeViewTemplateSelector.ProjectTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Content}" DataType="viewModel:ProjectViewModel">
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Source="{Binding GenericType, Converter={sd:StaticResourceConverter}}" Margin="0,0,5,0"/>
<TextBlock x:Name="ProjectText">
<Run Text="{Binding Name, Mode=OneWay}"/><Run Text="{Binding IsDirty, Mode=OneWay, Converter={sd:BoolToParam}, ConverterParameter=*}"/>
</TextBlock>
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsCurrentProject, Mode=OneWay}" Value="True">
<Setter TargetName="ProjectText" Property="FontWeight" Value="UltraBold"/>
</DataTrigger>
</DataTemplate.Triggers>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.ProjectTemplate>
<view:TreeViewTemplateSelector.ProjectCodeTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding SubDirectories}" DataType="viewModel:ProjectCodeViewModel">
<StackPanel Orientation="Horizontal">
<Image x:Name="DirectoryImage" Source="{StaticResource ImageRootFolder}" Margin="0,0,5,0"/>
<TextBlock>
<Run Text="{Binding Name, Mode=OneWay}"/><Run Text="{Binding IsDirty, Mode=OneWay, Converter={sd:BoolToParam}, ConverterParameter=*}"/>
</TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.ProjectCodeTemplate>
<view:TreeViewTemplateSelector.PackageReferenceTemplate>
<DataTemplate DataType="viewModel:PackageReferenceViewModel">
<StackPanel Orientation="Horizontal">
<Image Source="{StaticResource ImagePackageReference}" Margin="0,0,5,0"/>
<TextBlock Text="{Binding Name, Mode=OneWay}"/>
</StackPanel>
</DataTemplate>
</view:TreeViewTemplateSelector.PackageReferenceTemplate>
</view:TreeViewTemplateSelector>
<view:TreeViewTemplateSelector x:Key="SolutionTreeViewEditTemplate">
<view:TreeViewTemplateSelector.PackageTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding AssetMountPoint.SubDirectories}" DataType="viewModel:PackageViewModel">
<StackPanel Orientation="Horizontal" Margin="0,2">
<Image Source="{StaticResource ImagePackage}" Margin="0,0,5,0"/>
<sd:TextBox Text="{Binding Name}" GetFocusOnLoad="True" SelectAllOnFocus="True" ValidateOnLostFocus="True"/>
</StackPanel>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.PackageTemplate>
<view:TreeViewTemplateSelector.AssetMountPointTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding SubDirectories}" DataType="viewModel:AssetMountPointViewModel">
<StackPanel Orientation="Horizontal" Margin="0,2">
<Image Source="{StaticResource ImageRootFolder}" Margin="0,0,5,0"/>
<sd:TextBox Text="{Binding Name}" GetFocusOnLoad="True" SelectAllOnFocus="True" ValidateOnLostFocus="True"/>
</StackPanel>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.AssetMountPointTemplate>
<view:TreeViewTemplateSelector.DirectoryTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding SubDirectories}" DataType="viewModel:DirectoryViewModel">
<StackPanel Orientation="Horizontal" Margin="0,2">
<Image Source="{StaticResource ImageFolder}" Margin="0,0,5,0"/>
<sd:TextBox Text="{Binding Name}" GetFocusOnLoad="True" SelectAllOnFocus="True" ValidateOnLostFocus="True"/>
</StackPanel>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.DirectoryTemplate>
<view:TreeViewTemplateSelector.DependencyCategoryTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Content}" DataType="viewModel:ICategoryViewModel">
<StackPanel Orientation="Horizontal" Margin="0,2">
<Image Source="{StaticResource ImageDepsRoot}" Margin="0,0,5,0"/>
<sd:TextBox Text="{Binding Name}" GetFocusOnLoad="True" SelectAllOnFocus="True" ValidateOnLostFocus="True"/>
</StackPanel>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.DependencyCategoryTemplate>
<view:TreeViewTemplateSelector.ProjectTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding SubDirectories}" DataType="viewModel:ProjectViewModel">
<StackPanel Orientation="Horizontal" Margin="0,2">
<Image Width="16" Height="16" Source="{Binding GenericType, Converter={sd:StaticResourceConverter}}" Margin="0,0,5,0"/>
<sd:TextBox Text="{Binding Name}" GetFocusOnLoad="True" SelectAllOnFocus="True" ValidateOnLostFocus="True"/>
</StackPanel>
</HierarchicalDataTemplate>
</view:TreeViewTemplateSelector.ProjectTemplate>
</view:TreeViewTemplateSelector>
</ResourceDictionary>