Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 475c8fa

Browse files
committed
Add close glyph to GitHub dialogs
1 parent 6ef0a19 commit 475c8fa

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed
539 KB
Binary file not shown.

src/GitHub.VisualStudio.UI/GitHub.VisualStudio.UI.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<Import Project="$(SolutionDir)\src\common\signing.props" />
1010

1111
<ItemGroup>
12+
<Reference Include="Microsoft.VisualStudio.Shell.ViewManager">
13+
<HintPath>..\..\lib\14.0\Microsoft.VisualStudio.Shell.ViewManager.dll</HintPath>
14+
</Reference>
1215
<Reference Include="System.ComponentModel.Composition" />
1316
<Reference Include="System.Windows.Forms" />
1417
<Reference Include="System.Xaml" />

src/GitHub.VisualStudio.UI/Views/Dialog/GitHubDialogWindow.xaml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<pfui:DialogWindow x:Class="GitHub.VisualStudio.Views.Dialog.GitHubDialogWindow"
1+
<ui:DialogWindow x:Class="GitHub.VisualStudio.Views.Dialog.GitHubDialogWindow"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6-
xmlns:pfui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.14.0"
6+
xmlns:ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.14.0"
7+
xmlns:shellControls="clr-namespace:Microsoft.VisualStudio.PlatformUI.Shell.Controls;assembly=Microsoft.VisualStudio.Shell.ViewManager"
78
xmlns:local="clr-namespace:GitHub.VisualStudio.Views"
89
xmlns:ghfvs="https://github.com/github/VisualStudio"
910
mc:Ignorable="d"
@@ -39,9 +40,38 @@
3940
<local:ViewLocator x:Key="viewLocator"/>
4041
<DataTemplate DataType="{x:Type ghfvs:ViewModelBase}">
4142
<Border BorderThickness="1" BorderBrush="{DynamicResource {x:Static vs:EnvironmentColors.ToolWindowBorderBrushKey}}">
42-
<ContentControl Content="{Binding Converter={StaticResource viewLocator}}"/>
43+
<DockPanel>
44+
<!-- close button and padding -->
45+
<shellControls:GlyphButton x:Uid="button_Close"
46+
x:Name="CloseButton"
47+
DockPanel.Dock="Top"
48+
Width="46"
49+
Height="33"
50+
HorizontalAlignment="Right"
51+
VerticalAlignment="Top"
52+
BorderBrush="Transparent"
53+
BorderThickness="0"
54+
Background="{DynamicResource {x:Static ui:ThemedDialogColors.WindowButtonBrushKey}}"
55+
GlyphForeground="{DynamicResource {x:Static ui:ThemedDialogColors.WindowButtonGlyphBrushKey}}"
56+
HoverBackground="{DynamicResource {x:Static ui:ThemedDialogColors.WindowButtonHoverBrushKey}}"
57+
HoverForeground="{DynamicResource {x:Static ui:ThemedDialogColors.WindowButtonHoverGlyphBrushKey}}"
58+
HoverBorderBrush="{DynamicResource {x:Static ui:ThemedDialogColors.WindowButtonHoverBorderBrushKey}}"
59+
PressedBackground="{DynamicResource {x:Static ui:ThemedDialogColors.WindowButtonDownBrushKey}}"
60+
PressedForeground="{DynamicResource {x:Static ui:ThemedDialogColors.WindowButtonDownGlyphBrushKey}}"
61+
PressedBorderBrush="{DynamicResource {x:Static ui:ThemedDialogColors.WindowButtonDownBorderBrushKey}}"
62+
Click="CloseButton_Click">
63+
<Path x:Uid="path_CloseButton"
64+
Width="16"
65+
Height="16"
66+
Fill="{Binding Path=(TextElement.Foreground), RelativeSource={RelativeSource Self}}"
67+
Data="F1M8.583,8L13,12.424 12.424,13 8,8.583 3.576,13 3,12.424 7.417,8 3,3.576 3.576,3 8,7.417 12.424,3 13,3.576z"/>
68+
</shellControls:GlyphButton>
69+
70+
<!-- content -->
71+
<ContentControl Content="{Binding Converter={StaticResource viewLocator}}"/>
72+
</DockPanel>
4373
</Border>
4474
</DataTemplate>
4575
</ResourceDictionary>
4676
</Window.Resources>
47-
</pfui:DialogWindow>
77+
</ui:DialogWindow>

src/GitHub.VisualStudio.UI/Views/Dialog/GitHubDialogWindow.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@ public GitHubDialogWindow(IGitHubDialogWindowViewModel viewModel)
1515
viewModel.Done.Subscribe(_ => Close());
1616
InitializeComponent();
1717
}
18+
19+
void CloseButton_Click(object sender, System.Windows.RoutedEventArgs e)
20+
{
21+
Close();
22+
}
1823
}
1924
}

0 commit comments

Comments
 (0)