terminal/src/cascadia/TerminalApp/TabRowControl.xaml
Daniel599 b05a557f48
implement drag&drop path in '+' button (#10073) (#10160)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request
This PR implements the ability to drop directories/files on the '+' button which in turn will open the tab/pane/window in the given starting path.
In order to do this, I refactored the click's lambda into a method and re-used it
Sadly I wasn't able to add note about the alt/shift feature (any ideas how to do this?)
Also most of the code is "look-a-like" from other places within the project, as I don't have much experience in windows development.
 
<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> 
## References
implements #10073

## PR Checklist
* [ ] Closes #10073
* [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
** tests were done manually both of the old feature (alt/shift+click) on the '+' and on the profiles
* [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
** no idea what to add there, if any.
* [ ] Schema updated.
* [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

## Detailed Description of the Pull Request / Additional comments

## Validation Steps Performed
tested manually.
2021-07-20 14:26:35 +00:00

107 lines
6.7 KiB
XML

<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<ContentPresenter x:Class="TerminalApp.TabRowControl"
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:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<mux:TabView x:Name="TabView"
VerticalAlignment="Bottom"
HorizontalContentAlignment="Stretch"
AllowDropTabs="True"
CanDragTabs="True"
CanReorderTabs="True"
IsAddTabButtonVisible="false"
TabWidthMode="Equal">
<mux:TabView.TabStripFooter>
<mux:SplitButton x:Name="NewTabButton"
x:Uid="NewTabSplitButton"
HorizontalAlignment="Left"
VerticalAlignment="Stretch"
AllowDrop="True"
AutomationProperties.AccessibilityView="Control"
BorderThickness="0"
Click="OnNewTabButtonClick"
Content="&#xE710;"
CornerRadius="{Binding Source={ThemeResource OverlayCornerRadius}, Converter={StaticResource TopCornerRadiusFilterConverter}}"
DragOver="OnNewTabButtonDragOver"
Drop="OnNewTabButtonDrop"
FontFamily="Segoe MDL2 Assets"
FontSize="12"
FontWeight="SemiLight"
UseLayoutRounding="true">
<ToolTipService.ToolTip>
<ToolTip Placement="Mouse">
<TextBlock IsTextSelectionEnabled="False">
<Run x:Uid="NewTabRun" /> <LineBreak />
<Run x:Uid="NewPaneRun"
FontStyle="Italic" /> <LineBreak />
<Run x:Uid="NewWindowRun"
FontStyle="Italic" />
</TextBlock>
</ToolTip>
</ToolTipService.ToolTip>
<!-- U+E710 is the fancy plus icon. -->
<mux:SplitButton.Resources>
<!-- Override the SplitButton* resources to match the tab view's button's styles. -->
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<StaticResource x:Key="SplitButtonBackground"
ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground"
ResourceKey="TabViewButtonForeground" />
<StaticResource x:Key="SplitButtonBackgroundPressed"
ResourceKey="TabViewItemHeaderBackgroundPressed" />
<StaticResource x:Key="SplitButtonForegroundPressed"
ResourceKey="TabViewItemHeaderForegroundPressed" />
<StaticResource x:Key="SplitButtonBackgroundPointerOver"
ResourceKey="TabViewItemHeaderBackgroundPointerOver" />
<StaticResource x:Key="SplitButtonForegroundPointerOver"
ResourceKey="TabViewItemHeaderForegroundPointerOver" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<StaticResource x:Key="SplitButtonBackground"
ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground"
ResourceKey="TabViewButtonForeground" />
<StaticResource x:Key="SplitButtonBackgroundPressed"
ResourceKey="TabViewItemHeaderBackgroundPressed" />
<StaticResource x:Key="SplitButtonForegroundPressed"
ResourceKey="TabViewItemHeaderForegroundPressed" />
<StaticResource x:Key="SplitButtonBackgroundPointerOver"
ResourceKey="TabViewItemHeaderBackgroundPointerOver" />
<StaticResource x:Key="SplitButtonForegroundPointerOver"
ResourceKey="TabViewItemHeaderForegroundPointerOver" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="SplitButtonBackground"
ResourceKey="TabViewButtonBackground" />
<StaticResource x:Key="SplitButtonForeground"
ResourceKey="TabViewButtonForeground" />
<StaticResource x:Key="SplitButtonBackgroundPressed"
ResourceKey="TabViewItemHeaderBackgroundPressed" />
<StaticResource x:Key="SplitButtonForegroundPressed"
ResourceKey="TabViewItemHeaderForegroundPressed" />
<StaticResource x:Key="SplitButtonBackgroundPointerOver"
ResourceKey="TabViewItemHeaderBackgroundPointerOver" />
<StaticResource x:Key="SplitButtonForegroundPointerOver"
ResourceKey="TabViewItemHeaderForegroundPointerOver" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</mux:SplitButton.Resources>
</mux:SplitButton>
</mux:TabView.TabStripFooter>
</mux:TabView>
</ContentPresenter>