WorkspacesEditorPage.xaml
1 <Page 2 x:Class="WorkspacesEditor.ProjectEditor" 3 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 4 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 5 xmlns:controls="clr-namespace:WorkspacesEditor.Controls" 6 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 7 xmlns:local="clr-namespace:WorkspacesEditor" 8 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 9 xmlns:models="clr-namespace:WorkspacesEditor.Models" 10 xmlns:props="clr-namespace:WorkspacesEditor.Properties" 11 Title="Workspaces Editor" 12 Background="{DynamicResource PrimaryBackgroundBrush}" 13 mc:Ignorable="d"> 14 <Page.Resources> 15 <BooleanToVisibilityConverter x:Key="BoolToVis" /> 16 17 <Style x:Key="TextBlockEnabledStyle" TargetType="TextBlock"> 18 <Setter Property="Foreground" Value="{DynamicResource PrimaryForegroundBrush}" /> 19 <Style.Triggers> 20 <Trigger Property="IsEnabled" Value="False"> 21 <Setter Property="Foreground" Value="{DynamicResource SecondaryForegroundBrush}" /> 22 </Trigger> 23 </Style.Triggers> 24 </Style> 25 <Style x:Key="ButtonEnabledStyle" TargetType="Button"> 26 <Setter Property="Foreground" Value="{DynamicResource PrimaryForegroundBrush}" /> 27 <Style.Triggers> 28 <Trigger Property="IsEnabled" Value="False"> 29 <Setter Property="Foreground" Value="{DynamicResource SecondaryForegroundBrush}" /> 30 </Trigger> 31 </Style.Triggers> 32 </Style> 33 34 <DataTemplate x:Key="headerTemplate"> 35 <Border HorizontalAlignment="Stretch"> 36 <TextBlock 37 Margin="0,0,20,0" 38 VerticalAlignment="Center" 39 DockPanel.Dock="Left" 40 FontSize="14" 41 FontWeight="Normal" 42 Foreground="{DynamicResource PrimaryForegroundBrush}" 43 Text="{Binding MonitorName}" /> 44 </Border> 45 </DataTemplate> 46 <DataTemplate x:Key="appTemplate"> 47 <Border 48 Margin="1" 49 Background="{DynamicResource SecondaryBackgroundBrush}" 50 MouseEnter="AppBorder_MouseEnter" 51 MouseLeave="AppBorder_MouseLeave"> 52 <Expander 53 Margin="0,0,20,0" 54 AutomationProperties.AutomationId="{Binding AppName}" 55 AutomationProperties.Name="{Binding AppName}" 56 FlowDirection="RightToLeft" 57 IsEnabled="{Binding IsIncluded, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 58 IsExpanded="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> 59 <Expander.Header> 60 <Grid HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource AncestorType=ContentPresenter}, Mode=OneWayToSource}" FlowDirection="LeftToRight"> 61 <Grid.ColumnDefinitions> 62 <ColumnDefinition Width="20" /> 63 <ColumnDefinition Width="60" /> 64 <ColumnDefinition Width="20" /> 65 <ColumnDefinition Width="*" /> 66 <ColumnDefinition Width="Auto" /> 67 </Grid.ColumnDefinitions> 68 <TextBlock 69 Margin="5,0,0,0" 70 VerticalAlignment="Center" 71 FontFamily="{DynamicResource SymbolThemeFontFamily}" 72 FontSize="14" 73 FontWeight="Normal" 74 Foreground="#EED202" 75 Text="" 76 ToolTip="{x:Static props:Resources.NotFoundTooltip}" 77 Visibility="{Binding IsNotFound, Converter={StaticResource BoolToVis}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" /> 78 <Image 79 Grid.Column="1" 80 Width="20" 81 Height="20" 82 Margin="10" 83 HorizontalAlignment="Center" 84 VerticalAlignment="Center" 85 Source="{Binding IconBitmapImage, UpdateSourceTrigger=PropertyChanged}" /> 86 <TextBlock 87 Grid.Column="2" 88 Width="20" 89 VerticalAlignment="Center" 90 FontSize="14" 91 FontWeight="Normal" 92 Foreground="{DynamicResource PrimaryForegroundBrush}" 93 Text="{Binding RepeatIndexString, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" /> 94 <StackPanel Grid.Column="3" VerticalAlignment="Center"> 95 <TextBlock 96 FontSize="14" 97 FontWeight="Normal" 98 Foreground="{DynamicResource PrimaryForegroundBrush}" 99 Text="{Binding AppName}" /> 100 <TextBlock 101 FontSize="12" 102 FontWeight="Normal" 103 Foreground="{DynamicResource SecondaryForegroundBrush}" 104 Text="{Binding AppMainParams, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 105 Visibility="{Binding IsAppMainParamVisible, Converter={StaticResource BoolToVis}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" /> 106 </StackPanel> 107 <controls:ResetIsEnabled Grid.Column="4"> 108 <Button 109 Width="Auto" 110 Margin="10,5" 111 Padding="24,6" 112 AutomationProperties.Name="{x:Static props:Resources.Delete}" 113 Background="{DynamicResource TertiaryBackgroundBrush}" 114 BorderBrush="{DynamicResource SecondaryBorderBrush}" 115 BorderThickness="2" 116 Click="DeleteButtonClicked" 117 Content="{Binding DeleteButtonContent, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 118 IsEnabled="True" /> 119 </controls:ResetIsEnabled> 120 </Grid> 121 </Expander.Header> 122 <Grid 123 Margin="-20,0,0,0" 124 HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource AncestorType=ContentPresenter}, Mode=OneWayToSource}" 125 Background="{DynamicResource QuaternaryBackgroundBrush}" 126 FlowDirection="LeftToRight"> 127 <Grid.RowDefinitions> 128 <RowDefinition Height="*" /> 129 <RowDefinition Height="*" /> 130 <RowDefinition Height="*" /> 131 </Grid.RowDefinitions> 132 <DockPanel Margin="100,5,0,0"> 133 <TextBlock 134 VerticalAlignment="Center" 135 FontSize="14" 136 FontWeight="Normal" 137 Foreground="{DynamicResource PrimaryForegroundBrush}" 138 Text="{x:Static props:Resources.CliArguments}" /> 139 <TextBox 140 x:Name="CommandLineTextBox" 141 Margin="15,0,50,0" 142 HorizontalAlignment="Stretch" 143 VerticalContentAlignment="Center" 144 Background="{DynamicResource TertiaryBackgroundBrush}" 145 BorderThickness="0" 146 FontSize="14" 147 FontWeight="Normal" 148 Foreground="{DynamicResource PrimaryForegroundBrush}" 149 Text="{Binding CommandLineArguments, Mode=TwoWay}" 150 TextChanged="CommandLineTextBox_TextChanged" /> 151 </DockPanel> 152 <StackPanel 153 Grid.Row="1" 154 Margin="100,5,0,0" 155 Orientation="Horizontal"> 156 <CheckBox 157 MinWidth="10" 158 Content="{x:Static props:Resources.LaunchAsAdmin}" 159 IsChecked="{Binding IsElevated, Mode=TwoWay}" 160 IsEnabled="{Binding CanLaunchElevated, Mode=OneWay}" /> 161 </StackPanel> 162 <StackPanel 163 Grid.Row="2" 164 Margin="100,5,0,0" 165 Orientation="Horizontal"> 166 <TextBlock 167 VerticalAlignment="Center" 168 FontSize="14" 169 FontWeight="Normal" 170 IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 171 Style="{StaticResource TextBlockEnabledStyle}" 172 Text="{x:Static props:Resources.WindowPosition}" /> 173 <ComboBox 174 Margin="15,0,0,0" 175 VerticalAlignment="Center" 176 Background="{DynamicResource SecondaryBackgroundBrush}" 177 BorderBrush="{DynamicResource PrimaryBorderBrush}" 178 BorderThickness="2" 179 FontSize="14" 180 FontWeight="Normal" 181 SelectedIndex="{Binding PositionComboboxIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> 182 <ComboBoxItem Content="{x:Static props:Resources.Custom}" /> 183 <ComboBoxItem Content="{x:Static props:Resources.Maximized}" /> 184 <ComboBoxItem Content="{x:Static props:Resources.Minimized}" /> 185 </ComboBox> 186 <TextBlock 187 Margin="15,0,0,0" 188 VerticalAlignment="Center" 189 FontSize="14" 190 FontWeight="Normal" 191 IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 192 Style="{StaticResource TextBlockEnabledStyle}" 193 Text="{x:Static props:Resources.Left}" /> 194 <TextBox 195 x:Name="LeftTextBox" 196 Margin="15,0,0,0" 197 HorizontalAlignment="Stretch" 198 VerticalContentAlignment="Center" 199 Background="{DynamicResource TertiaryBackgroundBrush}" 200 BorderThickness="0" 201 FontSize="14" 202 FontWeight="Normal" 203 IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 204 Text="{Binding Position.X, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 205 TextChanged="LeftTextBox_TextChanged" /> 206 <TextBlock 207 Margin="15,0,0,0" 208 VerticalAlignment="Center" 209 FontSize="14" 210 FontWeight="Normal" 211 IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 212 Style="{StaticResource TextBlockEnabledStyle}" 213 Text="{x:Static props:Resources.Top}" /> 214 <TextBox 215 x:Name="TopTextBox" 216 Margin="15,0,0,0" 217 HorizontalAlignment="Stretch" 218 VerticalContentAlignment="Center" 219 Background="{DynamicResource TertiaryBackgroundBrush}" 220 BorderThickness="0" 221 FontSize="14" 222 FontWeight="Normal" 223 IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 224 Text="{Binding Position.Y, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 225 TextChanged="TopTextBox_TextChanged" /> 226 <TextBlock 227 Margin="15,0,0,0" 228 VerticalAlignment="Center" 229 FontSize="14" 230 FontWeight="Normal" 231 IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 232 Style="{StaticResource TextBlockEnabledStyle}" 233 Text="{x:Static props:Resources.Width}" /> 234 <TextBox 235 x:Name="WidthTextBox" 236 Margin="15,0,0,0" 237 HorizontalAlignment="Stretch" 238 VerticalContentAlignment="Center" 239 Background="{DynamicResource TertiaryBackgroundBrush}" 240 BorderThickness="0" 241 FontSize="14" 242 FontWeight="Normal" 243 IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 244 Text="{Binding Position.Width, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 245 TextChanged="WidthTextBox_TextChanged" /> 246 <TextBlock 247 Margin="15,0,0,0" 248 VerticalAlignment="Center" 249 FontSize="14" 250 FontWeight="Normal" 251 IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 252 Style="{StaticResource TextBlockEnabledStyle}" 253 Text="{x:Static props:Resources.Height}" /> 254 <TextBox 255 x:Name="HeightTextBox" 256 Margin="15,0,0,0" 257 HorizontalAlignment="Stretch" 258 VerticalContentAlignment="Center" 259 Background="{DynamicResource TertiaryBackgroundBrush}" 260 BorderThickness="0" 261 FontSize="14" 262 FontWeight="Normal" 263 IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 264 Text="{Binding Position.Height, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 265 TextChanged="HeightTextBox_TextChanged" /> 266 </StackPanel> 267 </Grid> 268 </Expander> 269 </Border> 270 </DataTemplate> 271 <models:AppListDataTemplateSelector 272 x:Key="AppListDataTemplateSelector" 273 AppTemplate="{StaticResource appTemplate}" 274 HeaderTemplate="{StaticResource headerTemplate}" /> 275 </Page.Resources> 276 <Grid Margin="40,0,40,40"> 277 <Grid.RowDefinitions> 278 <RowDefinition Height="Auto" /> 279 <RowDefinition Height="Auto" /> 280 <RowDefinition Height="Auto" /> 281 <RowDefinition Height="*" /> 282 <RowDefinition Height="Auto" /> 283 </Grid.RowDefinitions> 284 <StackPanel Grid.Row="0" Orientation="Horizontal"> 285 <Button 286 Margin="0,10,0,20" 287 VerticalAlignment="Center" 288 Background="Transparent" 289 Click="CancelButtonClicked"> 290 <TextBlock 291 VerticalAlignment="Center" 292 FontSize="24" 293 FontWeight="Normal" 294 Foreground="{DynamicResource PrimaryForegroundBrush}" 295 Text="{x:Static props:Resources.Workspaces}" /> 296 </Button> 297 <TextBlock 298 Margin="10,0,0,0" 299 VerticalAlignment="Center" 300 FontFamily="{DynamicResource SymbolThemeFontFamily}" 301 FontSize="16" 302 Foreground="{DynamicResource PrimaryForegroundBrush}" 303 Text="" /> 304 <TextBlock 305 Margin="10,0,0,0" 306 VerticalAlignment="Center" 307 FontSize="24" 308 FontWeight="SemiBold" 309 Foreground="{DynamicResource PrimaryForegroundBrush}" 310 Text="{Binding EditorWindowTitle}" /> 311 </StackPanel> 312 <Border 313 Grid.Row="1" 314 HorizontalAlignment="Stretch" 315 Background="{DynamicResource MonitorViewBackgroundBrush}" 316 CornerRadius="5"> 317 <DockPanel> 318 <Image 319 Width="{Binding PreviewImageWidth, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 320 Height="200" 321 Margin="2" 322 DockPanel.Dock="Top" 323 Source="{Binding PreviewImage, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 324 Stretch="Fill" /> 325 <Button 326 x:Name="RevertButton" 327 Height="36" 328 Margin="0,0,20,10" 329 Padding="24,0,24,0" 330 HorizontalAlignment="Right" 331 AutomationProperties.Name="{x:Static props:Resources.Revert}" 332 Background="{DynamicResource SecondaryBackgroundBrush}" 333 BorderBrush="{DynamicResource PrimaryBorderBrush}" 334 BorderThickness="2" 335 Click="RevertButtonClicked" 336 Content="{x:Static props:Resources.Revert}" 337 DockPanel.Dock="Right" 338 IsEnabled="{Binding IsRevertEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" /> 339 <Button 340 x:Name="LaunchEditButton" 341 Height="36" 342 Margin="0,0,10,10" 343 Padding="24,0,24,0" 344 HorizontalAlignment="Right" 345 AutomationProperties.Name="{x:Static props:Resources.LaunchEdit}" 346 Background="{DynamicResource SecondaryBackgroundBrush}" 347 BorderBrush="{DynamicResource PrimaryBorderBrush}" 348 BorderThickness="2" 349 Click="LaunchEditButtonClicked" 350 Content="{x:Static props:Resources.LaunchEdit}" 351 DockPanel.Dock="Right" /> 352 </DockPanel> 353 </Border> 354 <DockPanel Grid.Row="2" HorizontalAlignment="Stretch"> 355 <StackPanel Orientation="Vertical"> 356 <TextBlock 357 Margin="0,10,0,0" 358 FontSize="14" 359 FontWeight="Normal" 360 Foreground="{DynamicResource PrimaryForegroundBrush}" 361 Text="{x:Static props:Resources.WorkspaceName}" /> 362 <TextBox 363 x:Name="EditNameTextBox" 364 Width="300" 365 Margin="0,6,0,6" 366 HorizontalAlignment="Left" 367 Background="{DynamicResource SecondaryBackgroundBrush}" 368 BorderBrush="{DynamicResource PrimaryBorderBrush}" 369 BorderThickness="2" 370 GotFocus="EditNameTextBox_GotFocus" 371 KeyDown="EditNameTextBoxKeyDown" 372 Text="{Binding Name, Mode=TwoWay}" 373 TextChanged="EditNameTextBox_TextChanged" /> 374 </StackPanel> 375 <StackPanel 376 HorizontalAlignment="Right" 377 DockPanel.Dock="Right" 378 Orientation="Horizontal"> 379 <CheckBox 380 Margin="20,0,0,0" 381 VerticalAlignment="Bottom" 382 Content="{x:Static props:Resources.CreateShortcut}" 383 FontSize="14" 384 IsChecked="{Binding IsShortcutNeeded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> 385 <CheckBox 386 Margin="20,0,0,0" 387 VerticalAlignment="Bottom" 388 Content="{x:Static props:Resources.MoveIfExist}" 389 FontSize="14" 390 IsChecked="{Binding MoveExistingWindows, Mode=TwoWay}" /> 391 </StackPanel> 392 </DockPanel> 393 <ScrollViewer 394 Grid.Row="3" 395 Margin="0,10,0,0" 396 PreviewMouseWheel="ScrollViewer_PreviewMouseWheel" 397 VerticalScrollBarVisibility="Auto"> 398 <StackPanel Orientation="Vertical"> 399 <Grid> 400 <Grid.RowDefinitions> 401 <RowDefinition Height="Auto" /> 402 <RowDefinition Height="*" /> 403 </Grid.RowDefinitions> 404 <ItemsControl 405 x:Name="CapturedAppList" 406 AutomationProperties.Name="Captured Application List" 407 ItemTemplateSelector="{StaticResource AppListDataTemplateSelector}" 408 ItemsSource="{Binding ApplicationsListed, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" /> 409 </Grid> 410 </StackPanel> 411 </ScrollViewer> 412 <StackPanel 413 Grid.Row="4" 414 Margin="40,20,0,0" 415 HorizontalAlignment="Right" 416 Orientation="Horizontal"> 417 <Button 418 x:Name="CancelButton" 419 Height="36" 420 Margin="20,0,0,0" 421 Padding="24,0,24,0" 422 AutomationProperties.Name="{x:Static props:Resources.Cancel}" 423 Background="{DynamicResource SecondaryBackgroundBrush}" 424 BorderBrush="{DynamicResource PrimaryBorderBrush}" 425 BorderThickness="2" 426 Click="CancelButtonClicked" 427 Content="{x:Static props:Resources.Cancel}" /> 428 <Button 429 x:Name="SaveButton" 430 Height="36" 431 Margin="20,0,0,0" 432 Padding="24,0,24,0" 433 AutomationProperties.Name="{x:Static props:Resources.Save_Workspace}" 434 Click="SaveButtonClicked" 435 Content="{x:Static props:Resources.Save_Workspace}" 436 IsEnabled="{Binding CanBeSaved, UpdateSourceTrigger=PropertyChanged}" 437 Style="{StaticResource AccentButtonStyle}" /> 438 </StackPanel> 439 </Grid> 440 </Page>