Skip to content

Commit 4bfb9bc

Browse files
Merge pull request #81 from atc-net/feature/Style-ContextMenu
Feature/style context menu
2 parents 1efa44f + 8982373 commit 4bfb9bc

File tree

12 files changed

+91
-52
lines changed

12 files changed

+91
-52
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,11 @@ dotnet_diagnostic.MA0131.severity = none # ArgumentNullException.Throw
514514
dotnet_diagnostic.S1144.severity = none # Remove the unused internal class
515515
dotnet_diagnostic.S2094.severity = none # Remove this empty class, write its code or make it an "interface"
516516
dotnet_diagnostic.S2445.severity = none # Do not lock on writable field 'items', use a readonly field instead
517+
dotnet_diagnostic.S2583.severity = none # https://rules.sonarsource.com/csharp/RSPEC-2583
518+
dotnet_diagnostic.S2589.severity = none # https://rules.sonarsource.com/csharp/RSPEC-2589
517519
dotnet_diagnostic.S3267.severity = none # Loops should be simplified with "LINQ" expressions
518520
dotnet_diagnostic.S6602.severity = none # "Find" method should be used instead of the "FirstOrDefault" extension method
519521
dotnet_diagnostic.S6603.severity = none # The collection-specific "TrueForAll" method should be used instead of the "All" extension
520522
dotnet_diagnostic.S6605.severity = none # Collection-specific "Exists" method should be used instead of the "Any" extension
521523
dotnet_diagnostic.S6608.severity = none # Indexing at Count-1 should be used instead of the "Enumerable" extension method "Last"
524+

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
<ItemGroup Label="Code Analyzers">
4848
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
4949
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
50-
<PackageReference Include="Meziantou.Analyzer" Version="2.0.81" PrivateAssets="All" />
50+
<PackageReference Include="Meziantou.Analyzer" Version="2.0.84" PrivateAssets="All" />
5151
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="All" />
5252
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507" PrivateAssets="All" />
53-
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.7.0.75501" PrivateAssets="All" />
53+
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.9.0.77355" PrivateAssets="All" />
5454
</ItemGroup>
5555

5656
</Project>

sample/Atc.Wpf.Sample/SamplesWpfFontIcons/FontIconStaticImageView.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
</WrapPanel>
5353

5454
</GroupBox>
55+
5556
</atc:AutoGrid>
5657

5758
</UserControl>

sample/Atc.Wpf.Sample/SamplesWpfFontIcons/FontIconView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@
124124
</GroupBox>
125125

126126
<GroupBox Header="Usage">
127-
128127
<WrapPanel Orientation="Horizontal">
129128

130129
<fontIcons:FontAwesomeBrand
@@ -283,6 +282,7 @@
283282

284283
</WrapPanel>
285284
</GroupBox>
285+
286286
</atc:AutoGrid>
287287

288288
</UserControl>

sample/Atc.Wpf.Sample/SamplesWpfFontIcons/FontIconViewerView.xaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@
109109
<GroupBox Header="Usage">
110110

111111
<atc:BusyOverlay IsBusy="{Binding ElementName=UcFontIconViewerView, Path=IsBusy, Mode=OneWay}">
112-
<atc:AutoGrid Rows="*,Auto">
113-
<ScrollViewer>
114-
<WrapPanel
115-
x:Name="ListOfIcons"
116-
VirtualizingStackPanel.IsVirtualizing="True"
117-
VirtualizingStackPanel.VirtualizationMode="Recycling" />
118-
</ScrollViewer>
119-
</atc:AutoGrid>
112+
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
113+
<WrapPanel
114+
x:Name="ListOfIcons"
115+
VirtualizingStackPanel.IsVirtualizing="True"
116+
VirtualizingStackPanel.VirtualizationMode="Recycling" />
117+
</ScrollViewer>
120118
</atc:BusyOverlay>
121119

122120
</GroupBox>
121+
123122
</atc:AutoGrid>
123+
124124
</UserControl>

sample/Atc.Wpf.Sample/SamplesWpfTheming/Misc/MenuView.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,28 @@
7070
</Menu>
7171

7272
</atc:UniformSpacingPanel>
73+
7374
<atc:UniformSpacingPanel
7475
Grid.Column="2"
7576
Margin="10"
7677
Orientation="Vertical"
7778
Spacing="10" />
79+
80+
<atc:GridEx.ContextMenu>
81+
<ContextMenu>
82+
<MenuItem Header="Item1" />
83+
<MenuItem Header="Item2" />
84+
<Separator />
85+
<MenuItem Header="Item3">
86+
<MenuItem Header="Item1.a" />
87+
<MenuItem Header="Item2.b" />
88+
</MenuItem>
89+
</ContextMenu>
90+
</atc:GridEx.ContextMenu>
7891
</atc:GridEx>
7992
</ScrollViewer>
8093
</GroupBox>
94+
8195
</atc:AutoGrid>
8296

8397
</UserControl>

src/Atc.Wpf.Theming/Styles/BaseControls/Calendar.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
Stretch="Fill" />
188188
<Rectangle
189189
x:Name="DayButtonFocusVisual"
190-
IsHitTestVisible="false"
190+
IsHitTestVisible="False"
191191
RadiusX="5"
192192
RadiusY="5"
193193
Visibility="Collapsed">
@@ -393,7 +393,7 @@
393393
</ContentPresenter>
394394
<Rectangle
395395
x:Name="CalendarButtonFocusVisual"
396-
IsHitTestVisible="false"
396+
IsHitTestVisible="False"
397397
RadiusX="5"
398398
RadiusY="5"
399399
Visibility="Collapsed">
Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
22

3-
<Style x:Key="AtcApps.Styles.ContextMenu" TargetType="{x:Type ContextMenu}" />
3+
<!-- Base -->
4+
<Style x:Key="AtcApps.Styles.ContextMenu" TargetType="{x:Type ContextMenu}">
5+
<Setter Property="Background" Value="{DynamicResource AtcApps.Brushes.ThemeBackground2}" />
6+
<Setter Property="BorderBrush" Value="{DynamicResource AtcApps.Brushes.ThemeForeground1}" />
7+
<Setter Property="BorderThickness" Value="1" />
8+
<Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}" />
9+
<Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}" />
10+
<Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}" />
11+
<Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}" />
12+
<Setter Property="Foreground" Value="{DynamicResource AtcApps.Brushes.ThemeForeground1}" />
13+
<Setter Property="HorizontalContentAlignment" Value="Left" />
14+
<Setter Property="VerticalContentAlignment" Value="Center" />
15+
<Setter Property="Template">
16+
<Setter.Value>
17+
<ControlTemplate TargetType="{x:Type ContextMenu}">
18+
<Border
19+
Padding="{TemplateBinding Padding}"
20+
Background="{TemplateBinding Background}"
21+
BorderBrush="{TemplateBinding BorderBrush}"
22+
BorderThickness="{TemplateBinding BorderThickness}"
23+
SnapsToDevicePixels="True">
24+
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
25+
</Border>
26+
</ControlTemplate>
27+
</Setter.Value>
28+
</Setter>
29+
</Style>
430

531
<ContextMenu
632
x:Key="AtcApps.TextBox.ContextMenu"
733
x:Shared="False"
834
Style="{StaticResource AtcApps.Styles.ContextMenu}">
9-
<MenuItem Command="ApplicationCommands.Cut" Style="{DynamicResource AtcApps.Styles.MenuItem}" />
10-
<MenuItem Command="ApplicationCommands.Copy" Style="{DynamicResource AtcApps.Styles.MenuItem}" />
11-
<MenuItem Command="ApplicationCommands.Paste" Style="{DynamicResource AtcApps.Styles.MenuItem}" />
35+
<MenuItem Command="ApplicationCommands.Cut" />
36+
<MenuItem Command="ApplicationCommands.Copy" />
37+
<MenuItem Command="ApplicationCommands.Paste" />
1238
</ContextMenu>
1339

1440
</ResourceDictionary>

0 commit comments

Comments
 (0)