add AboutWindow

This commit is contained in:
NaBian committed 2018-12-27 17:05:05 +08:00
1 parent bb94944991
commit bce4cacf11
16 files changed
+151 -71

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
<controls:Window x:Class="HandyControlDemo.Window.AboutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
mc:Ignorable="d"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Title="{x:Static langs:Lang.About}"
ShowTitle="True"
BorderThickness="1"
BorderBrush="#262e2f"
NonClientAreaBackground="White"
NonClientAreaForeground="{StaticResource PrimaryTextBrush}"
CloseButtonForeground="{StaticResource PrimaryTextBrush}"
OtherButtonForeground="{StaticResource PrimaryTextBrush}"
OtherButtonHoverBackground="#e5e5e5"
Style="{StaticResource WindowWin10}"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStartupLocation="CenterOwner"
Width="340"
Height="220">
<Grid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,30,0,0">
<TextBlock Text="HandyControl" FontSize="30" Foreground="{StaticResource PrimaryBrush}" VerticalAlignment="Top" HorizontalAlignment="Center"/>
<TextBlock Text="{Binding Version}" HorizontalAlignment="Center" Margin="0,10,0,0" Foreground="{StaticResource PrimaryBrush}"/>
</StackPanel>
<TextBlock Text="{Binding CopyRight}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,14" Foreground="{StaticResource ThirdlyTextBrush}"/>
</Grid>
</controls:Window>
@@ -0,0 +1,38 @@
using System.Diagnostics;
using System.Reflection;
using System.Windows;
namespace HandyControlDemo.Window
{
public partial class AboutWindow
{
public AboutWindow()
{
InitializeComponent();
DataContext = this;
var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
CopyRight = versionInfo.LegalCopyright;
Version = $"v {versionInfo.FileVersion}";
}
public static readonly DependencyProperty CopyRightProperty = DependencyProperty.Register(
"CopyRight", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
public string CopyRight
{
get => (string) GetValue(CopyRightProperty);
set => SetValue(CopyRightProperty, value);
}
public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(
"Version", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
public string Version
{
get => (string) GetValue(VersionProperty);
set => SetValue(VersionProperty, value);
}
}
}