Skip to content

Commit 867bee0

Browse files
Minor UI improvements (#31)
Add mnemonics for dialogs and context menus. Add ellipsis on menus where a window follows. Use capitalization for abbreviations. Localize missing resources. Add KeyTips for ribbon.
1 parent bf2272f commit 867bee0

8 files changed

Lines changed: 955 additions & 842 deletions

File tree

CSharpCodeAnalyst/Common/ErrorWarningDialog.xaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Window x:Class="CSharpCodeAnalyst.Common.ErrorWarningDialog"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Title="Errors and Warnings"
4+
xmlns:resources="clr-namespace:CSharpCodeAnalyst.Resources"
5+
Title="{x:Static resources:Strings.ErrorsAndWarnings_Title}"
56
WindowStartupLocation="CenterOwner"
67
Width="600" Height="400"
78
MinWidth="400" MinHeight="250"
@@ -14,12 +15,12 @@
1415
<DockPanel>
1516
<!-- Buttons -->
1617
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
17-
<Button Width="100" Height="30" Margin="5,0" Content="OK" IsDefault="True" Click="OkButton_Click" />
18+
<Button Width="100" Height="30" Margin="5,0" Content="{x:Static resources:Strings.Ok}" IsDefault="True" Click="OkButton_Click" />
1819
</StackPanel>
1920

2021
<!-- Content -->
2122
<TabControl x:Name="Tabs" Margin="0,0,0,10">
22-
<TabItem x:Name="ErrorTab" Header="❌ Errors">
23+
<TabItem x:Name="ErrorTab" Header="{x:Static resources:Strings.ErrorsAndWarnings_Errors}">
2324
<ScrollViewer VerticalScrollBarVisibility="Auto">
2425
<ItemsControl x:Name="ErrorList">
2526
<ItemsControl.ItemTemplate>
@@ -34,7 +35,7 @@
3435
</ScrollViewer>
3536
</TabItem>
3637

37-
<TabItem x:Name="WarningTab" Header="⚠️ Warnings">
38+
<TabItem x:Name="WarningTab" Header="{x:Static resources:Strings.ErrorsAndWarnings_Warnings}">
3839
<ScrollViewer VerticalScrollBarVisibility="Auto">
3940
<ItemsControl x:Name="WarningList">
4041
<ItemsControl.ItemTemplate>

CSharpCodeAnalyst/Configuration/SettingsDialog.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040

4141
<GroupBox Header="{x:Static resources:Strings.Settings_Performance}" Margin="5,0,0,0">
4242
<StackPanel Margin="10">
43-
<TextBlock Margin="0 0 0 3"
44-
Text="{x:Static resources:Strings.Settings_CodeElementWarningLimit}" />
43+
<Label Margin="0 0 0 3"
44+
Content="{x:Static resources:Strings.Settings_CodeElementWarningLimit}" />
4545
<TextBox x:Name="WarningLimitTextBox"
4646
Width="100"
4747
HorizontalAlignment="Left"
@@ -52,7 +52,7 @@
5252

5353
<GroupBox Header="{x:Static resources:Strings.Settings_ProjectFilters}" Margin="5,0,0,0">
5454
<StackPanel Margin="10">
55-
<TextBlock Margin="0 0 0 3" Text="{x:Static resources:Strings.Settings_ProjectFilters_Text}" />
55+
<Label Margin="0 0 0 3" Content="{x:Static resources:Strings.Settings_ProjectFilters_Text}" />
5656
<TextBox x:Name="ProjectExcludeFilterTextBox"
5757
Height="80"
5858

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Window x:Class="CSharpCodeAnalyst.Filter.FilterDialog"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Title="Set Project Exclusion Filters" Height="300" Width="400"
4+
xmlns:resources="clr-namespace:CSharpCodeAnalyst.Resources"
5+
Title="{x:Static resources:Strings.FilterDialog_Title}" Height="300" Width="400"
56
WindowStartupLocation="CenterOwner">
67
<Grid Margin="10">
78
<Grid.RowDefinitions>
@@ -10,11 +11,13 @@
1011
</Grid.RowDefinitions>
1112

1213
<TextBox x:Name="FiltersTextBox" AcceptsReturn="True" TextWrapping="Wrap"
13-
VerticalScrollBarVisibility="Auto" />
14+
VerticalScrollBarVisibility="Auto"
15+
ToolTip="{x:Static resources:Strings.FilterDialog_ProjectFilters_Tooltip}"
16+
/>
1417

1518
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
16-
<Button Content="OK" Width="75" Click="OkButton_Click" Margin="0,0,10,0" />
17-
<Button Content="Cancel" Width="75" Click="CancelButton_Click" />
19+
<Button Content="{x:Static resources:Strings.Ok}" Width="75" Click="OkButton_Click" Margin="0,0,10,0" />
20+
<Button Content="{x:Static resources:Strings.Cancel}" Width="75" Click="CancelButton_Click" />
1821
</StackPanel>
1922
</Grid>
2023
</Window>

CSharpCodeAnalyst/Gallery/GalleryEditor.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
<DockPanel Grid.Row="0" Margin="0,0,0,10">
5757

58-
<Button DockPanel.Dock="Right" Content="Add" Command="{Binding AddItemCommand}" Width="80" />
58+
<Button DockPanel.Dock="Right" Content="{x:Static resources:Strings.Gallery_Add}" Command="{Binding AddItemCommand}" Width="80" />
5959

6060
<TextBox DockPanel.Dock="Left" Text="{Binding NewItemName, UpdateSourceTrigger=PropertyChanged}"
6161
Margin="0,0,10,0" HorizontalAlignment="Stretch" x:Name="NameBox">
@@ -112,7 +112,7 @@
112112
Margin="0,0,10,0"
113113
FontStyle="Italic"
114114
Foreground="Gray" />
115-
<Button Content="Close" Width="80" Click="CloseButton_Click" IsCancel="True"/>
115+
<Button Content="{x:Static resources:Strings.Gallery_Close}" Width="80" Click="CloseButton_Click" IsCancel="True"/>
116116
</StackPanel>
117117
</Grid>
118118
</Window>

CSharpCodeAnalyst/MainWindow.xaml

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<Window x:Class="CSharpCodeAnalyst.MainWindow"
1+
<ribbon:RibbonWindow x:Class="CSharpCodeAnalyst.MainWindow"
2+
xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon"
23
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
34
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
45
xmlns:analyst="clr-namespace:CSharpCodeAnalyst"
@@ -37,35 +38,36 @@
3738

3839
<Ribbon>
3940
<Ribbon.ApplicationMenu>
40-
<RibbonApplicationMenu>
41+
<RibbonApplicationMenu KeyTip="F">
4142

4243
<RibbonApplicationMenuItem Header="{x:Static resources:Strings.Settings_Header}"
4344
Command="{Binding OpenSettingsDialogCommand}"
44-
ToolTip="Open application settings dialog"
45-
ImageSource="/Resources/slider.png" />
45+
ToolTip="{x:Static resources:Strings.Settings_Header_Tooltip}"
46+
ImageSource="/Resources/slider.png" KeyTip="S"/>
4647

47-
<RibbonApplicationMenuItem Header="{x:Static resources:Strings.Exit_Header}" Click="Exit_Click" />
48+
<RibbonApplicationMenuItem Header="{x:Static resources:Strings.Exit_Header}" Click="Exit_Click" KeyTip="X"/>
4849

4950

5051
</RibbonApplicationMenu>
5152
</Ribbon.ApplicationMenu>
52-
<RibbonTab Header="Home">
53+
<RibbonTab Header="{x:Static resources:Strings.Home_Header}" KeyTip="H">
5354
<RibbonGroup Header="{x:Static resources:Strings.File_Header}"
5455
LargeImageSource="/Resources/save_project.png">
55-
<RibbonSplitButton Label="Import"
56+
<RibbonSplitButton Label="{x:Static resources:Strings.Import_Label}"
5657
LargeImageSource="/Resources/import_solution.png"
57-
Command="{Binding LoadSolutionCommand}">
58+
Command="{Binding LoadSolutionCommand}"
59+
KeyTip="I">
5860
<RibbonMenuItem Header="{x:Static resources:Strings.ImportSolution_Label}"
5961
ImageSource="/Resources/import_solution.png"
6062
Command="{Binding LoadSolutionCommand}" />
61-
<RibbonMenuItem Header="Import from jdeps"
63+
<RibbonMenuItem Header="{x:Static resources:Strings.ImportJdeps_Label}"
6264
ImageSource="/Resources/import_solution.png"
6365
Command="{Binding ImportJdepsCommand}" />
6466
</RibbonSplitButton>
6567

6668
<RibbonButton Label="{x:Static resources:Strings.ProjectFilter_Label}"
6769
LargeImageSource="/Resources/filter_32.png"
68-
Command="{Binding OpenFilterDialogCommand}">
70+
Command="{Binding OpenFilterDialogCommand}" KeyTip="P">
6971
<RibbonButton.ToolTip>
7072
<ToolTip Content="{x:Static resources:Strings.ProjectFilter_Tooltip}" />
7173
</RibbonButton.ToolTip>
@@ -75,7 +77,8 @@
7577
<RibbonSplitButton Label="{x:Static resources:Strings.LoadProject_Label}"
7678
LargeImageSource="/Resources/load_project.png"
7779
Command="{Binding LoadProjectCommand}"
78-
ItemsSource="{Binding RecentFiles}">
80+
ItemsSource="{Binding RecentFiles}"
81+
KeyTip="L">
7982

8083
<RibbonSplitButton.ItemContainerStyle>
8184
<Style TargetType="RibbonMenuItem">
@@ -89,18 +92,18 @@
8992

9093
<RibbonButton Label="{x:Static resources:Strings.SaveProject_Label}"
9194
LargeImageSource="/Resources/save_project.png"
92-
Command="{Binding SaveProjectCommand}" />
95+
Command="{Binding SaveProjectCommand}" KeyTip="S"/>
9396

9497
</RibbonGroup>
9598

9699
<RibbonGroup Header="Tools" LargeImageSource="/Resources/cycle_32.png">
97100
<RibbonButton Label="{x:Static resources:Strings.Find_Cycles_Label}"
98101
LargeImageSource="/Resources/cycle_32.png"
99-
Command="{Binding FindCyclesCommand}" />
102+
Command="{Binding FindCyclesCommand}" KeyTip="Y"/>
100103

101104
<RibbonSplitButton Label="{x:Static resources:Strings.Analyzers_Label}"
102105
LargeImageSource="/Resources/analysis_32.png"
103-
ItemsSource="{Binding Analyzers}">
106+
ItemsSource="{Binding Analyzers}" KeyTip="A">
104107

105108
<!-- Integrate analyzers -->
106109
<RibbonSplitButton.ItemContainerStyle>
@@ -122,23 +125,23 @@
122125
LargeImageSource="/Resources/four-arrows_32.png">
123126
<RibbonButton Label="{x:Static resources:Strings.Clear_Label}"
124127
LargeImageSource="/Resources/trash-can_32.png"
125-
Command="{Binding GraphClearCommand}">
128+
Command="{Binding GraphClearCommand}" KeyTip="C">
126129
<RibbonButton.ToolTip>
127130
<ToolTip Content="{x:Static resources:Strings.Clear_Tooltip}" />
128131
</RibbonButton.ToolTip>
129132
</RibbonButton>
130133

131134
<RibbonButton Label="{x:Static resources:Strings.HideFilter_Label}"
132135
LargeImageSource="/Resources/filter_32.png"
133-
Command="{Binding GraphViewModel.OpenGraphHideDialogCommand}">
136+
Command="{Binding GraphViewModel.OpenGraphHideDialogCommand}" KeyTip="H">
134137
<RibbonButton.ToolTip>
135138
<ToolTip Content="{x:Static resources:Strings.HideFilter_Tooltip}" />
136139
</RibbonButton.ToolTip>
137140
</RibbonButton>
138141

139142
<RibbonButton Label="{x:Static resources:Strings.Layout_Label}"
140143
LargeImageSource="/Resources/four-arrows_32.png"
141-
Command="{Binding GraphLayoutCommand}">
144+
Command="{Binding GraphLayoutCommand}" KeyTip="O">
142145
<RibbonButton.ToolTip>
143146
<ToolTip Content="{x:Static resources:Strings.Layout_Tooltip}" />
144147
</RibbonButton.ToolTip>
@@ -147,7 +150,7 @@
147150

148151
<RibbonSplitButton Label="Export"
149152
LargeImageSource="/Resources/document-xml_32.png"
150-
Command="{Binding ExportToDgmlCommand}">
153+
Command="{Binding ExportToDgmlCommand}" KeyTip="E">
151154

152155
<RibbonMenuItem Header="{x:Static resources:Strings.ExportDgml_Label}"
153156
ImageSource="/Resources/document-xml_32.png"
@@ -188,15 +191,15 @@
188191

189192
<RibbonButton Label="{x:Static resources:Strings.Undo_Label}"
190193
LargeImageSource="/Resources/undo_32.png"
191-
Command="{Binding GraphViewModel.UndoCommand}">
194+
Command="{Binding GraphViewModel.UndoCommand}" KeyTip="U">
192195
<RibbonButton.ToolTip>
193196
<ToolTip Content="{x:Static resources:Strings.Undo_Tooltip}" />
194197
</RibbonButton.ToolTip>
195198
</RibbonButton>
196199

197200
<RibbonButton Label="{x:Static resources:Strings.Gallery_Label}"
198201
LargeImageSource="/Resources/document_graph_32.png"
199-
Command="{Binding ShowGalleryCommand}">
202+
Command="{Binding ShowGalleryCommand}" KeyTip="FG">
200203
<RibbonButton.ToolTip>
201204
<ToolTip Content="{x:Static resources:Strings.Gallery_Tooltip}" />
202205
</RibbonButton.ToolTip>
@@ -230,7 +233,7 @@
230233
Grid.Row="0" Grid.Column="0"
231234
Label="{x:Static resources:Strings.Flow_Label}"
232235
SmallImageSource="/Resources/guidepost_small.png"
233-
IsChecked="{Binding GraphViewModel.ShowDataFlow, Mode=TwoWay}">
236+
IsChecked="{Binding GraphViewModel.ShowDataFlow, Mode=TwoWay}" KeyTip="SF">
234237
<RibbonToggleButton.ToolTip>
235238
<ToolTip Content="{x:Static resources:Strings.Flow_Tooltip}" />
236239
</RibbonToggleButton.ToolTip>
@@ -240,7 +243,7 @@
240243
<RibbonToggleButton Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left"
241244
Label="{x:Static resources:Strings.FlatGraph_Label}"
242245
SmallImageSource="/Resources/left-right_small.png"
243-
IsChecked="{Binding GraphViewModel.ShowFlatGraph, Mode=TwoWay}">
246+
IsChecked="{Binding GraphViewModel.ShowFlatGraph, Mode=TwoWay}" KeyTip="G">
244247
<RibbonToggleButton.ToolTip>
245248
<ToolTip Content="{x:Static resources:Strings.FlatGraph_Tooltip}" />
246249
</RibbonToggleButton.ToolTip>
@@ -274,7 +277,7 @@
274277
<RibbonButton Label="{x:Static resources:Strings.Legend_Label}"
275278
LargeImageSource="/Resources/legend_32.png"
276279

277-
Command="{Binding ShowLegendCommand}">
280+
Command="{Binding ShowLegendCommand}" KeyTip="LG">
278281
<RibbonButton.ToolTip>
279282
<ToolTip Content="{x:Static resources:Strings.Legend_Tooltip}" />
280283
</RibbonButton.ToolTip>
@@ -379,4 +382,4 @@
379382
</StackPanel>
380383
</Grid>
381384
</Grid>
382-
</Window>
385+
</ribbon:RibbonWindow>

CSharpCodeAnalyst/MainWindow.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Windows;
33
using System.Windows.Controls;
44
using System.Windows.Controls.Primitives;
5+
using System.Windows.Controls.Ribbon;
56
using System.Windows.Input;
67
using System.Windows.Threading;
78
using CSharpCodeAnalyst.Areas.GraphArea;

0 commit comments

Comments
 (0)