mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Changes
This commit is contained in:
171
src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/DockEditor.xaml
Normal file
171
src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/DockEditor.xaml
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<UserControl
|
||||||
|
x:Class="Microsoft.CmdPal.UI.Controls.DockEditor"
|
||||||
|
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:dockVm="using:Microsoft.CmdPal.UI.ViewModels.Dock"
|
||||||
|
xmlns:local="using:Microsoft.CmdPal.UI.Controls"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.Resources>
|
||||||
|
<Flyout x:Key="AddItemsFlyout">
|
||||||
|
<Grid Width="300" Height="400">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,0,0,12"
|
||||||
|
FontSize="16"
|
||||||
|
FontWeight="SemiBold"
|
||||||
|
Text="Add Dock Item" />
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
Grid.Row="1"
|
||||||
|
IsItemClickEnabled="True"
|
||||||
|
ItemClick="AvailableItemsListView_ItemClick"
|
||||||
|
ItemsSource="{x:Bind DockBands, Mode=OneWay}"
|
||||||
|
SelectionMode="None">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="dockVm:DockBandSettingsViewModel">
|
||||||
|
<Grid Height="48" Padding="8">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="32" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<!--<Image
|
||||||
|
Width="24"
|
||||||
|
Height="24"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Source="{x:Bind Icon}" />-->
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="8,0,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{x:Bind Title}" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</Grid>
|
||||||
|
</Flyout>
|
||||||
|
|
||||||
|
<Flyout x:Key="DockItemOptionsFlyout">
|
||||||
|
<Grid Width="250">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,0,0,16"
|
||||||
|
FontSize="16"
|
||||||
|
FontWeight="SemiBold"
|
||||||
|
Text="Dock Item Options" />
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1" Margin="0,0,0,12">
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,0,0,4"
|
||||||
|
FontSize="12"
|
||||||
|
Text="Mode" />
|
||||||
|
<ComboBox HorizontalAlignment="Stretch" SelectedIndex="0">
|
||||||
|
<ComboBoxItem Content="Icon only" />
|
||||||
|
<ComboBoxItem Content="Expanded" />
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--<ToggleSwitch
|
||||||
|
Grid.Row="2"
|
||||||
|
Margin="0,0,0,16"
|
||||||
|
Header="Show text label"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Border
|
||||||
|
Grid.Row="3"
|
||||||
|
Height="1"
|
||||||
|
Margin="0,0,0,16"
|
||||||
|
Background="{ThemeResource DividerStrokeColorDefaultBrush}" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Grid.Row="4"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Click="UnpinButton_Click"
|
||||||
|
Content="Unpin from dock"
|
||||||
|
Style="{StaticResource AccentButtonStyle}" />-->
|
||||||
|
</Grid>
|
||||||
|
</Flyout>
|
||||||
|
</Grid.Resources>
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
Height="48"
|
||||||
|
Margin="64"
|
||||||
|
Padding="8,0,8,0"
|
||||||
|
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||||
|
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||||
|
BorderThickness="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
|
<ListView
|
||||||
|
x:Name="LeftListView"
|
||||||
|
AllowDrop="True"
|
||||||
|
CanDragItems="True"
|
||||||
|
CanReorderItems="True"
|
||||||
|
DragItemsStarting="LeftListView_DragItemsStarting"
|
||||||
|
DragOver="LeftListView_DragOver"
|
||||||
|
Drop="LeftListView_Drop"
|
||||||
|
IsItemClickEnabled="True"
|
||||||
|
ItemClick="LeftListView_ItemClick"
|
||||||
|
SelectionMode="None">
|
||||||
|
<ListView.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="8" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ListView.ItemsPanel>
|
||||||
|
<ListView.ItemContainerStyle>
|
||||||
|
<Style BasedOn="{StaticResource DefaultListViewItemStyle}" TargetType="ListViewItem">
|
||||||
|
<Setter Property="MinWidth" Value="0" />
|
||||||
|
<Setter Property="Padding" Value="4" />
|
||||||
|
</Style>
|
||||||
|
</ListView.ItemContainerStyle>
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="local:DockItem">
|
||||||
|
<StackPanel Orientation="Vertical" Spacing="4">
|
||||||
|
<Image
|
||||||
|
Width="24"
|
||||||
|
Height="24"
|
||||||
|
Source="{x:Bind IconPath}" />
|
||||||
|
<TextBlock
|
||||||
|
MaxWidth="60"
|
||||||
|
FontSize="10"
|
||||||
|
Text="{x:Bind Name}"
|
||||||
|
TextAlignment="Center"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
Visibility="{x:Bind ShowTextLabel, Mode=OneWay}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
<Button
|
||||||
|
x:Name="LeftAddButton"
|
||||||
|
Click="LeftAddButton_Click"
|
||||||
|
Flyout="{StaticResource AddItemsFlyout}"
|
||||||
|
Style="{StaticResource SubtleButtonStyle}">
|
||||||
|
<FontIcon Glyph="" />
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Microsoft.CmdPal.UI.ViewModels.Dock;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||||
|
using Microsoft.UI.Xaml.Data;
|
||||||
|
using Microsoft.UI.Xaml.Input;
|
||||||
|
using Microsoft.UI.Xaml.Media;
|
||||||
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
|
||||||
|
namespace Microsoft.CmdPal.UI.Controls;
|
||||||
|
|
||||||
|
public sealed partial class DockEditor : UserControl
|
||||||
|
{
|
||||||
|
public ObservableCollection<DockBandSettingsViewModel> DockBands
|
||||||
|
{
|
||||||
|
get => (ObservableCollection<DockBandSettingsViewModel>)GetValue(DockBandsProperty);
|
||||||
|
set => SetValue(DockBandsProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty DockBandsProperty = DependencyProperty.Register(nameof(DockBands), typeof(ObservableCollection<DockBandSettingsViewModel>), typeof(DockEditor), new PropertyMetadata(new ObservableCollection<DockBandSettingsViewModel>()));
|
||||||
|
|
||||||
|
public DockEditor()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.5.2.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.CmdPal.UI", "Microsoft.CmdPal.UI.csproj", "{B2E61206-8E5C-BAB9-830A-6C3B7C28C519}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{B2E61206-8E5C-BAB9-830A-6C3B7C28C519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B2E61206-8E5C-BAB9-830A-6C3B7C28C519}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B2E61206-8E5C-BAB9-830A-6C3B7C28C519}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B2E61206-8E5C-BAB9-830A-6C3B7C28C519}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {83BE4CC2-3723-4E87-882E-5FAAE040F5DC}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
Reference in New Issue
Block a user