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

Commit 2d348d1

Browse files
committed
Preview UI with VS themes
1 parent a87979f commit 2d348d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+13810
-8
lines changed
Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
<Application x:Class="GitHub.VisualStudio.TestApp.App"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:local="clr-namespace:GitHub.VisualStudio.TestApp"
4+
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
55
StartupUri="MainWindow.xaml">
66
<Application.Resources>
7-
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Themes/Common/VsFonts.xaml" />
10+
<ResourceDictionary Source="Themes/FontScalingLabelStyle.xaml" />
11+
<ResourceDictionary Source="Themes/FontScalingTextBlockStyle.xaml" />
12+
<ResourceDictionary Source="Themes/CommonControlsButtonStyle.xaml" />
13+
<ResourceDictionary Source="Themes/CommonControlsCheckboxStyle.xaml" />
14+
<ResourceDictionary Source="Themes/CommonControlsComboboxStyle.xaml" />
15+
<ResourceDictionary Source="Themes/CommonControlsTextboxStyle.xaml" />
16+
<ResourceDictionary Source="Themes/ThemedDialogStyles.xaml" />
17+
<ResourceDictionary Source="Themes/HighContrast/Theme.xaml" />
18+
</ResourceDictionary.MergedDictionaries>
19+
20+
<ResourceDictionary x:Key="{x:Static vsfx:VsResourceKeys.ThemedDialogDefaultStylesKey}" Source="Themes/ThemedDialogDefaultStyles.xaml" />
21+
</ResourceDictionary>
822
</Application.Resources>
923
</Application>

src/GitHub.VisualStudio.TestApp/GitHub.VisualStudio.TestApp.csproj

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
<SubType>Designer</SubType>
9999
</ApplicationDefinition>
100100
<Compile Include="Services\ShowDialogService.cs" />
101+
<Compile Include="ThemeControl.xaml.cs">
102+
<DependentUpon>ThemeControl.xaml</DependentUpon>
103+
</Compile>
101104
<Compile Include="Views\GitHubDialogWindow.xaml.cs">
102105
<DependentUpon>GitHubDialogWindow.xaml</DependentUpon>
103106
</Compile>
@@ -113,6 +116,158 @@
113116
<DependentUpon>MainWindow.xaml</DependentUpon>
114117
<SubType>Code</SubType>
115118
</Compile>
119+
<Page Include="ThemeControl.xaml">
120+
<Generator>MSBuild:Compile</Generator>
121+
<SubType>Designer</SubType>
122+
</Page>
123+
<Page Include="Themes\Blue\CommonControlsColors.xaml">
124+
<Generator>MSBuild:Compile</Generator>
125+
<SubType>Designer</SubType>
126+
</Page>
127+
<Page Include="Themes\Blue\EnvironmentColors.xaml">
128+
<Generator>MSBuild:Compile</Generator>
129+
<SubType>Designer</SubType>
130+
</Page>
131+
<Page Include="Themes\Blue\Theme.xaml">
132+
<Generator>MSBuild:Compile</Generator>
133+
<SubType>Designer</SubType>
134+
</Page>
135+
<Page Include="Themes\Blue\ThemedDialogColors.xaml">
136+
<Generator>MSBuild:Compile</Generator>
137+
<SubType>Designer</SubType>
138+
</Page>
139+
<Page Include="Themes\Blue\TreeViewColors.xaml">
140+
<Generator>MSBuild:Compile</Generator>
141+
<SubType>Designer</SubType>
142+
</Page>
143+
<Page Include="Themes\Blue\VsBrushes.xaml">
144+
<Generator>MSBuild:Compile</Generator>
145+
<SubType>Designer</SubType>
146+
</Page>
147+
<Page Include="Themes\Blue\VsColors.xaml">
148+
<Generator>MSBuild:Compile</Generator>
149+
<SubType>Designer</SubType>
150+
</Page>
151+
<Page Include="Themes\CommonControlsButtonStyle.xaml">
152+
<Generator>MSBuild:Compile</Generator>
153+
<SubType>Designer</SubType>
154+
</Page>
155+
<Page Include="Themes\CommonControlsCheckBoxStyle.xaml">
156+
<Generator>MSBuild:Compile</Generator>
157+
<SubType>Designer</SubType>
158+
</Page>
159+
<Page Include="Themes\CommonControlsComboBoxStyle.xaml">
160+
<Generator>MSBuild:Compile</Generator>
161+
<SubType>Designer</SubType>
162+
</Page>
163+
<Page Include="Themes\CommonControlsTextBoxStyle.xaml">
164+
<Generator>MSBuild:Compile</Generator>
165+
<SubType>Designer</SubType>
166+
</Page>
167+
<Page Include="Themes\Common\VsFonts.xaml">
168+
<Generator>MSBuild:Compile</Generator>
169+
<SubType>Designer</SubType>
170+
</Page>
171+
<Page Include="Themes\Dark\CommonControlsColors.xaml">
172+
<Generator>MSBuild:Compile</Generator>
173+
<SubType>Designer</SubType>
174+
</Page>
175+
<Page Include="Themes\Dark\EnvironmentColors.xaml">
176+
<Generator>MSBuild:Compile</Generator>
177+
<SubType>Designer</SubType>
178+
</Page>
179+
<Page Include="Themes\Dark\Theme.xaml">
180+
<Generator>MSBuild:Compile</Generator>
181+
<SubType>Designer</SubType>
182+
</Page>
183+
<Page Include="Themes\Dark\ThemedDialogColors.xaml">
184+
<Generator>MSBuild:Compile</Generator>
185+
<SubType>Designer</SubType>
186+
</Page>
187+
<Page Include="Themes\Dark\TreeViewColors.xaml">
188+
<Generator>MSBuild:Compile</Generator>
189+
<SubType>Designer</SubType>
190+
</Page>
191+
<Page Include="Themes\Dark\VsBrushes.xaml">
192+
<Generator>MSBuild:Compile</Generator>
193+
<SubType>Designer</SubType>
194+
</Page>
195+
<Page Include="Themes\Dark\VsColors.xaml">
196+
<Generator>MSBuild:Compile</Generator>
197+
<SubType>Designer</SubType>
198+
</Page>
199+
<Page Include="Themes\FontScalingLabelStyle.xaml">
200+
<Generator>MSBuild:Compile</Generator>
201+
<SubType>Designer</SubType>
202+
</Page>
203+
<Page Include="Themes\FontScalingTextBlockStyle.xaml">
204+
<Generator>MSBuild:Compile</Generator>
205+
<SubType>Designer</SubType>
206+
</Page>
207+
<Page Include="Themes\HighContrast\CommonControlsColors.xaml">
208+
<Generator>MSBuild:Compile</Generator>
209+
<SubType>Designer</SubType>
210+
</Page>
211+
<Page Include="Themes\HighContrast\EnvironmentColors.xaml">
212+
<Generator>MSBuild:Compile</Generator>
213+
<SubType>Designer</SubType>
214+
</Page>
215+
<Page Include="Themes\HighContrast\Theme.xaml">
216+
<Generator>MSBuild:Compile</Generator>
217+
<SubType>Designer</SubType>
218+
</Page>
219+
<Page Include="Themes\HighContrast\ThemedDialogColors.xaml">
220+
<Generator>MSBuild:Compile</Generator>
221+
<SubType>Designer</SubType>
222+
</Page>
223+
<Page Include="Themes\HighContrast\TreeViewColors.xaml">
224+
<Generator>MSBuild:Compile</Generator>
225+
<SubType>Designer</SubType>
226+
</Page>
227+
<Page Include="Themes\HighContrast\VsBrushes.xaml">
228+
<Generator>MSBuild:Compile</Generator>
229+
<SubType>Designer</SubType>
230+
</Page>
231+
<Page Include="Themes\HighContrast\VsColors.xaml">
232+
<Generator>MSBuild:Compile</Generator>
233+
<SubType>Designer</SubType>
234+
</Page>
235+
<Page Include="Themes\Light\CommonControlsColors.xaml">
236+
<Generator>MSBuild:Compile</Generator>
237+
<SubType>Designer</SubType>
238+
</Page>
239+
<Page Include="Themes\Light\EnvironmentColors.xaml">
240+
<Generator>MSBuild:Compile</Generator>
241+
<SubType>Designer</SubType>
242+
</Page>
243+
<Page Include="Themes\Light\Theme.xaml">
244+
<Generator>MSBuild:Compile</Generator>
245+
<SubType>Designer</SubType>
246+
</Page>
247+
<Page Include="Themes\Light\ThemedDialogColors.xaml">
248+
<Generator>MSBuild:Compile</Generator>
249+
<SubType>Designer</SubType>
250+
</Page>
251+
<Page Include="Themes\Light\TreeViewColors.xaml">
252+
<Generator>MSBuild:Compile</Generator>
253+
<SubType>Designer</SubType>
254+
</Page>
255+
<Page Include="Themes\Light\VsBrushes.xaml">
256+
<Generator>MSBuild:Compile</Generator>
257+
<SubType>Designer</SubType>
258+
</Page>
259+
<Page Include="Themes\Light\VsColors.xaml">
260+
<Generator>MSBuild:Compile</Generator>
261+
<SubType>Designer</SubType>
262+
</Page>
263+
<Page Include="Themes\ThemedDialogDefaultStyles.xaml">
264+
<Generator>MSBuild:Compile</Generator>
265+
<SubType>Designer</SubType>
266+
</Page>
267+
<Page Include="Themes\ThemedDialogStyles.xaml">
268+
<Generator>MSBuild:Compile</Generator>
269+
<SubType>Designer</SubType>
270+
</Page>
116271
<Page Include="Views\GitHubDialogWindow.xaml">
117272
<Generator>MSBuild:Compile</Generator>
118273
<SubType>Designer</SubType>
Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1-
<Window x:Class="GitHub.VisualStudio.TestApp.MainWindow"
1+
<Window
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:local="clr-namespace:GitHub.VisualStudio.TestApp"
6+
xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.15.0"
7+
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
8+
xmlns:UI="clr-namespace:ThemedDialog.UI" x:Class="GitHub.VisualStudio.TestApp.MainWindow"
79
mc:Ignorable="d"
8-
Title="MainWindow" Height="450" Width="800">
10+
Background="{DynamicResource {x:Static vs:EnvironmentColors.ToolWindowBackgroundBrushKey}}"
11+
Foreground="{DynamicResource {x:Static vs:EnvironmentColors.ToolWindowTextBrushKey}}"
12+
Title="MainWindow" Height="241.5" Width="399">
13+
<Window.Resources>
14+
<ResourceDictionary>
15+
<ResourceDictionary.MergedDictionaries>
16+
<StaticResource ResourceKey="{x:Static vsfx:VsResourceKeys.ThemedDialogDefaultStylesKey}" />
17+
</ResourceDictionary.MergedDictionaries>
18+
</ResourceDictionary>
19+
</Window.Resources>
920
<Grid>
10-
<Button Content="Login" HorizontalAlignment="Left" Margin="57,30,0,0" VerticalAlignment="Top" Width="133" Click="Login_Click" />
11-
<Button Content="Open from GitHub" HorizontalAlignment="Left" Margin="57,55,0,0" VerticalAlignment="Top" Width="133" Click="CloneOrOpenRepository_Click" />
12-
<Button Content="Create Repository" HorizontalAlignment="Left" Margin="57,80,0,0" VerticalAlignment="Top" Width="133" Click="CreateRepository_Click" />
21+
<Button Content="Login" HorizontalAlignment="Left" Margin="200,77,0,0" VerticalAlignment="Top" Width="132" Click="Login_Click" />
22+
<Button Content="Open from GitHub" HorizontalAlignment="Left" Margin="200,105,0,0" VerticalAlignment="Top" Width="132" Click="CloneOrOpenRepository_Click" />
23+
<Button Content="Create Repository" HorizontalAlignment="Left" Margin="200,133,0,0" VerticalAlignment="Top" Width="132" Click="CreateRepository_Click" />
24+
<UI:ThemeControl HorizontalAlignment="Left" Height="146" Margin="21,32,0,0" VerticalAlignment="Top" Width="153"/>
1325
</Grid>
1426
</Window>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<UserControl x:Class="ThemedDialog.UI.ThemeControl"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
7+
mc:Ignorable="d"
8+
d:DesignHeight="450" d:DesignWidth="800">
9+
<UserControl.Resources>
10+
<ResourceDictionary>
11+
<ResourceDictionary.MergedDictionaries>
12+
<StaticResource ResourceKey="{x:Static vsfx:VsResourceKeys.ThemedDialogDefaultStylesKey}" />
13+
</ResourceDictionary.MergedDictionaries>
14+
15+
<ResourceDictionary x:Key="Themes/Dark" Source="Themes/Dark/Theme.xaml" />
16+
<ResourceDictionary x:Key="Themes/Light" Source="Themes/Light/Theme.xaml" />
17+
<ResourceDictionary x:Key="Themes/Blue" Source="Themes/Blue/Theme.xaml" />
18+
<ResourceDictionary x:Key="Themes/HighContrast" Source="Themes/HighContrast/Theme.xaml" />
19+
</ResourceDictionary>
20+
</UserControl.Resources>
21+
<ListBox x:Name="ThemeListBox" DockPanel.Dock="Top" SelectionChanged="ThemeListBox_SelectionChanged">
22+
<Label>Light</Label>
23+
<Label>Blue</Label>
24+
<Label>Dark</Label>
25+
<Label>HighContrast</Label>
26+
</ListBox>
27+
</UserControl>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Windows;
3+
using System.Windows.Controls;
4+
5+
namespace ThemedDialog.UI
6+
{
7+
/// <summary>
8+
/// Interaction logic for ThemeControl.xaml
9+
/// </summary>
10+
public partial class ThemeControl : UserControl
11+
{
12+
public ThemeControl()
13+
{
14+
InitializeComponent();
15+
}
16+
17+
void ThemeListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
18+
{
19+
if (ThemeListBox.SelectedItem is Label label)
20+
{
21+
if (label.Content is string theme)
22+
{
23+
if (TryFindResource($"Themes/{theme}") is ResourceDictionary themeResources)
24+
{
25+
Application.Current.Resources.MergedDictionaries.Add(themeResources);
26+
}
27+
}
28+
}
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)