Skip to content

Commit 44a4e6d

Browse files
Merge pull request #59 from WPFDevelopersOrg/dev
dev pull requese master
2 parents 3a6b1ad + 45b1866 commit 44a4e6d

File tree

100 files changed

+3676
-1903
lines changed

Some content is hidden

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

100 files changed

+3676
-1903
lines changed

src/WPFDevelopers.Net40/Themes/Generic.xaml

Lines changed: 109 additions & 110 deletions
Large diffs are not rendered by default.

src/WPFDevelopers.Net40/Themes/Theme.xaml

Lines changed: 502 additions & 332 deletions
Large diffs are not rendered by default.

src/WPFDevelopers.Net40/Window.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
using System;
1+
using Microsoft.Windows.Shell;
2+
using System;
23
using System.Runtime.InteropServices;
34
using System.Windows;
4-
using System.Windows.Controls;
55
using System.Windows.Input;
66
using System.Windows.Interop;
77
using System.Windows.Media;
8-
using Microsoft.Windows.Shell;
98
using WPFDevelopers.Helpers;
109

1110
namespace WPFDevelopers.Net40
@@ -23,6 +22,9 @@ public class Window : System.Windows.Window
2322
public static readonly DependencyProperty TitleBarProperty =
2423
DependencyProperty.Register("TitleBar", typeof(object), typeof(Window), new PropertyMetadata(null));
2524

25+
public static readonly DependencyProperty TitleBackgroundProperty =
26+
DependencyProperty.Register("TitleBackground", typeof(Brush), typeof(Window), new PropertyMetadata(ControlsHelper.PrimaryNormalBrush));
27+
2628
static Window()
2729
{
2830
DefaultStyleKeyProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata(typeof(Window)));
@@ -63,6 +65,12 @@ public object TitleBar
6365
set => SetValue(TitleBarProperty, value);
6466
}
6567

68+
public Brush TitleBackground
69+
{
70+
get => (Brush)GetValue(TitleBarProperty);
71+
set => SetValue(TitleBarProperty, value);
72+
}
73+
6674
private void Window_Loaded(object sender, RoutedEventArgs e)
6775
{
6876
hWnd = new WindowInteropHelper(this).Handle;
@@ -142,7 +150,6 @@ private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, re
142150
handled = true;
143151
}
144152
}
145-
146153
return IntPtr.Zero;
147154
}
148155

src/WPFDevelopers.Net45x/Themes/Generic.xaml

Lines changed: 109 additions & 110 deletions
Large diffs are not rendered by default.

src/WPFDevelopers.Net45x/Themes/Theme.xaml

Lines changed: 502 additions & 332 deletions
Large diffs are not rendered by default.

src/WPFDevelopers.Net45x/Window.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Windows;
44
using System.Windows.Input;
55
using System.Windows.Interop;
6+
using System.Windows.Media;
67
using WPFDevelopers.Helpers;
78

89
namespace WPFDevelopers.Net45x
@@ -20,6 +21,9 @@ public class Window : System.Windows.Window
2021
public static readonly DependencyProperty TitleBarProperty =
2122
DependencyProperty.Register("TitleBar", typeof(object), typeof(Window), new PropertyMetadata(null));
2223

24+
public static readonly DependencyProperty TitleBackgroundProperty =
25+
DependencyProperty.Register("TitleBackground", typeof(Brush), typeof(Window), new PropertyMetadata(ControlsHelper.PrimaryNormalBrush));
26+
2327
static Window()
2428
{
2529
StyleProperty.OverrideMetadata(typeof(Window),
@@ -57,6 +61,12 @@ public object TitleBar
5761
get => (object)GetValue(TitleBarProperty);
5862
set => SetValue(TitleBarProperty, value);
5963
}
64+
public Brush TitleBackground
65+
{
66+
get => (Brush)GetValue(TitleBarProperty);
67+
set => SetValue(TitleBarProperty, value);
68+
}
69+
6070
private static T GetResourceKey<T>(string key)
6171
{
6272
if (Application.Current.TryFindResource(key) is T resource) return resource;

src/WPFDevelopers.Samples.Shared/Controls/CodeViewer/CodeViewer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public override void OnApplyTemplate()
3030
foreach (var item in SourceCodes)
3131
{
3232
var tabItem = CreateTabItem(item);
33+
tabItem.Height = 38;
34+
tabItem.Padding = new Thickness(20,0,20,0);
3335
_tabControl.Items.Add(tabItem);
3436
}
3537
}

src/WPFDevelopers.Samples.Shared/Controls/CodeViewer/CodeViewer.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
</TabControl.Resources>
1616
<TabItem
1717
x:Name="PART_TabItemContent"
18+
Height="38"
19+
Padding="20,0"
1820
Content="{TemplateBinding Content}"
1921
Header="Sample" />
2022

Lines changed: 99 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,114 @@
1-
<Window x:Class="WPFDevelopers.Samples.ExampleViews.AboutWindow"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6-
xmlns:ws="https://github.com/WPFDevelopersOrg/WPFDevelopers"
7-
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
8-
SnapsToDevicePixels="True" WindowStyle="None"
9-
TextOptions.TextFormattingMode="Display"
10-
ResizeMode="NoResize"
11-
Height="400" Width="300"
12-
Background="{DynamicResource WD.BackgroundSolidColorBrush}"
13-
Title="关于" >
1+
<wd:Window
2+
x:Class="WPFDevelopers.Samples.ExampleViews.AboutWindow"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
8+
Title="关于"
9+
Width="300"
10+
Height="400"
11+
BorderBrush="Transparent"
12+
BorderThickness="0"
13+
NoChrome="True"
14+
ResizeMode="NoResize"
15+
TitleBackground="{DynamicResource WD.WindowBorderBrushSolidColorBrush}"
16+
TitleHeight="30"
17+
WindowStartupLocation="CenterScreen"
18+
WindowStyle="ToolWindow"
19+
mc:Ignorable="d">
20+
<wd:Window.TitleBar>
21+
<Grid Height="30" VerticalAlignment="Center">
22+
<Grid.ColumnDefinitions>
23+
<ColumnDefinition Width="Auto" />
24+
<ColumnDefinition Width="*" />
25+
<ColumnDefinition Width="Auto" MinWidth="30" />
26+
</Grid.ColumnDefinitions>
27+
<TextBlock
28+
Margin="10,0"
29+
VerticalAlignment="Center"
30+
FontSize="14"
31+
Foreground="{DynamicResource WD.WindowForegroundColorBrush}"
32+
IsHitTestVisible="False"
33+
Text="关于" />
34+
<Button
35+
x:Name="CloseButton"
36+
Grid.Column="2"
37+
Width="25"
38+
Height="25"
39+
Margin="0,2,4,0"
40+
HorizontalAlignment="Right"
41+
wd:ElementHelper.IsRound="True"
42+
Click="CloseButton_Click"
43+
Style="{StaticResource WD.NormalButton}"
44+
ToolTip="关闭">
45+
<wd:PathIcon
46+
Width="10"
47+
Height="10"
48+
Foreground="{DynamicResource WD.WindowForegroundColorBrush}"
49+
Kind="WindowClose" />
50+
</Button>
51+
</Grid>
52+
</wd:Window.TitleBar>
1453
<Grid>
1554
<Grid.RowDefinitions>
16-
<RowDefinition Height="4*"/>
17-
<RowDefinition Height="6*"/>
55+
<RowDefinition Height="4*" />
56+
<RowDefinition Height="6*" />
1857
</Grid.RowDefinitions>
19-
<Rectangle Fill="{DynamicResource WD.WindowBorderBrushSolidColorBrush}"/>
20-
<TextBlock Text="关于"
21-
Foreground="{DynamicResource WD.WindowForegroundColorBrush}"
22-
Margin="10,4"/>
23-
58+
<Rectangle Fill="{DynamicResource WD.WindowBorderBrushSolidColorBrush}" />
2459
<Rectangle Width="120">
2560
<Rectangle.Fill>
26-
<ImageBrush ImageSource="pack://application:,,,/WPFDevelopers.Samples;component/WPFDevelopers.ico" Stretch="Uniform"/>
61+
<ImageBrush ImageSource="pack://application:,,,/WPFDevelopers.Samples;component/WPFDevelopers.ico" Stretch="Uniform" />
2762
</Rectangle.Fill>
2863
</Rectangle>
29-
<Button x:Name="CloseButton" Width="30" Height="30"
30-
HorizontalAlignment="Right"
31-
VerticalAlignment="Top"
32-
Style="{StaticResource WD.WindowButtonStyle}"
33-
ToolTip="关闭"
34-
Click="CloseButton_Click">
35-
<Path Data="{StaticResource WD.WindowCloseGeometry}"
36-
Fill="{DynamicResource WD.WindowForegroundColorBrush}"
37-
Height="10"
38-
Width="10"
39-
Stretch="UniformToFill"/>
40-
</Button>
64+
4165
<Grid Grid.Row="1" Margin="0,10">
4266
<Grid.RowDefinitions>
43-
<RowDefinition/>
44-
<RowDefinition/>
45-
<RowDefinition Height="Auto"/>
46-
<RowDefinition Height="Auto"/>
47-
<RowDefinition Height="Auto"/>
67+
<RowDefinition />
68+
<RowDefinition />
69+
<RowDefinition Height="Auto" />
70+
<RowDefinition Height="Auto" />
71+
<RowDefinition Height="Auto" />
4872
</Grid.RowDefinitions>
49-
<TextBlock Text="WPFDevelopers" FontSize="20"
50-
HorizontalAlignment="Center"
51-
VerticalAlignment="Bottom"
52-
Padding="0,4"/>
53-
<TextBlock Text="微信号公众号:WPFDevelopers"
54-
HorizontalAlignment="Center"
55-
VerticalAlignment="Top"
56-
Padding="0,4"
57-
Grid.Row="1"/>
58-
<TextBlock FontSize="11"
59-
HorizontalAlignment="Center"
60-
VerticalAlignment="Bottom"
61-
Foreground="{DynamicResource WD.PrimaryNormalSolidColorBrush}"
62-
Grid.Row="2">
63-
<Hyperlink NavigateUri="https://github.com/yanjinhuagood/WPFDevelopers.git"
64-
RequestNavigate="GithubHyperlink_RequestNavigate"> Github 源码</Hyperlink>
65-
<Run/>
66-
<Run/>
67-
<Run/>
68-
<Hyperlink NavigateUri="https://gitee.com/WPFDevelopersOrg/WPFDevelopers.git"
69-
RequestNavigate="GiteeHyperlink_RequestNavigate"> 码云源码</Hyperlink>
73+
<TextBlock
74+
Padding="0,4"
75+
HorizontalAlignment="Center"
76+
VerticalAlignment="Bottom"
77+
FontSize="20"
78+
Text="WPFDevelopers" />
79+
<TextBlock
80+
Grid.Row="1"
81+
Padding="0,4"
82+
HorizontalAlignment="Center"
83+
VerticalAlignment="Top"
84+
Text="微信号公众号:WPFDevelopers" />
85+
<TextBlock
86+
Grid.Row="2"
87+
HorizontalAlignment="Center"
88+
VerticalAlignment="Bottom"
89+
FontSize="11"
90+
Foreground="{DynamicResource WD.PrimaryNormalSolidColorBrush}">
91+
<Hyperlink NavigateUri="https://github.com/yanjinhuagood/WPFDevelopers.git" RequestNavigate="GithubHyperlink_RequestNavigate">Github 源码</Hyperlink>
92+
<Run />
93+
<Run />
94+
<Run />
95+
<Hyperlink NavigateUri="https://gitee.com/WPFDevelopersOrg/WPFDevelopers.git" RequestNavigate="GiteeHyperlink_RequestNavigate">码云源码</Hyperlink>
7096

7197
</TextBlock>
72-
<TextBlock FontSize="11"
73-
HorizontalAlignment="Center"
74-
Grid.Row="3"
75-
VerticalAlignment="Bottom">
76-
<Hyperlink NavigateUri="https://gitee.com/yanjinhua/WPFDevelopers.git"
77-
RequestNavigate="QQHyperlink_RequestNavigate"> QQ群:340500857 | QQ群:458041663</Hyperlink>
98+
<TextBlock
99+
Grid.Row="3"
100+
HorizontalAlignment="Center"
101+
VerticalAlignment="Bottom"
102+
FontSize="11">
103+
<Hyperlink NavigateUri="https://gitee.com/yanjinhua/WPFDevelopers.git" RequestNavigate="QQHyperlink_RequestNavigate">QQ群:340500857 | QQ群:458041663</Hyperlink>
78104
</TextBlock>
79-
<TextBlock Text="Copyright © 2022 WPFDevelopers. All rights reserved."
80-
HorizontalAlignment="Center" FontSize="11"
81-
VerticalAlignment="Bottom"
82-
Padding="0,10"
83-
Grid.Row="4"/>
105+
<TextBlock
106+
Grid.Row="4"
107+
Padding="0,10"
108+
HorizontalAlignment="Center"
109+
VerticalAlignment="Bottom"
110+
FontSize="11"
111+
Text="Copyright © 2022 WPFDevelopers. All rights reserved." />
84112
</Grid>
85113
</Grid>
86-
</Window>
114+
</wd:Window>

src/WPFDevelopers.Samples.Shared/ExampleViews/AboutWindow.xaml.cs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,18 @@
1-
#if NET40
2-
using Microsoft.Windows.Shell;
3-
#else
4-
using System.Windows.Shell;
5-
# endif
6-
using System;
1+
using System;
72
using System.Diagnostics;
83
using System.Windows;
9-
using System.Windows.Controls;
104
using System.Windows.Navigation;
115

126
namespace WPFDevelopers.Samples.ExampleViews
137
{
148
/// <summary>
159
/// Window1.xaml 的交互逻辑
1610
/// </summary>
17-
public partial class AboutWindow : Window
11+
public partial class AboutWindow
1812
{
1913
public AboutWindow()
2014
{
2115
InitializeComponent();
22-
#if NET40
23-
var windowChrome = new WindowChrome
24-
{
25-
CaptionHeight = 160,
26-
GlassFrameThickness = new Thickness(1)
27-
};
28-
WindowChrome.SetIsHitTestVisibleInChrome(CloseButton, true);
29-
#else
30-
var windowChrome = new WindowChrome
31-
{
32-
CaptionHeight = 160,
33-
GlassFrameThickness = new Thickness(1),
34-
UseAeroCaptionButtons = false
35-
};
36-
WindowChrome.SetIsHitTestVisibleInChrome(CloseButton, true);
37-
#endif
3816
}
3917

4018
private void GithubHyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)

0 commit comments

Comments
 (0)