├── DMSkin.ScreenShot ├── demo.png ├── demo1.png └── demo2.png ├── DMSkin.WPF ├── Styles │ ├── DMTreeView.xaml │ ├── DMListBox.xaml │ ├── DMIcon.xaml │ ├── DMResizeGrip.xaml │ ├── DMSkinSimpleWindow.xaml │ ├── DMToolTip.xaml │ ├── DMImage.xaml │ ├── Animation.xaml │ ├── DMCheckBox.xaml │ ├── DMTextBox.xaml │ ├── DMContextMenu.xaml │ └── DMScrollViewer.xaml ├── Controls │ ├── DMSystemMinButton.cs │ ├── DMButton.cs │ ├── DMLinkButton.cs │ ├── DMSystemCloseButton.cs │ ├── DMRadioButton.cs │ ├── DMCheckBox.cs │ ├── DMSystemMaxButton.cs │ ├── DMTabItem.cs │ ├── DMNumericBox.cs │ ├── DMThumb.cs │ ├── DMTextBox.cs │ ├── DMScrollBar.cs │ ├── DMScrollViewer.cs │ ├── DMSystemButton.cs │ └── ElasticWrapPanel.cs ├── ShadowWindow.xaml ├── Properties │ └── AssemblyInfo.cs ├── ShadowWindow.xaml.cs ├── DMSkin.WPF.csproj └── DMSkinSimpleWindow.cs ├── DMSkin.WPF.Demos ├── Images │ ├── image1.png │ └── user.jpg ├── app.config ├── StartWindow.xaml.cs ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── ViewModels │ ├── MainWindowViewModel.cs │ ├── PageAboutViewModel.cs │ └── StartWindowViewModel.cs ├── Views │ ├── PageVirtualizing.xaml │ ├── PageAbout.xaml.cs │ ├── PageAnimation.xaml.cs │ ├── PageAntDesign.xaml.cs │ ├── PageScrollViewer.xaml.cs │ ├── PageVirtualizing.xaml.cs │ ├── Window │ │ ├── SimpleWindow.xaml.cs │ │ ├── ComplexWindow.xaml.cs │ │ ├── ComplexWindow.xaml │ │ └── SimpleWindow.xaml │ ├── PageAnimation.xaml │ ├── PageAbout.xaml │ ├── PageScrollViewer.xaml │ └── PageAntDesign.xaml ├── App.xaml.cs ├── App.xaml └── DMSkin.WPF.Demos.csproj ├── DMSkin.Core ├── Converters │ ├── EnumToBooleanConverter.cs │ ├── TimeSpanToStringConverter.cs │ ├── EnumToVisibilityConverter.cs │ ├── CompareToVisibilityConverter.cs │ ├── BoolToVisibilityConverter.cs │ └── SecondToStringConverter.cs ├── Properties │ └── AssemblyInfo.cs ├── MVVM │ ├── DelegateCommand.cs │ └── ViewModelBase.cs ├── Common │ ├── Execute.cs │ ├── UINT.cs │ └── Base64.cs ├── TaskManager.cs ├── WIN32 │ └── DesktopAPI.cs └── DMSkin.Core.csproj ├── LICENSE ├── DMSkin.WPF.AntDesign ├── Properties │ └── AssemblyInfo.cs └── DMSkin.WPF.AntDesign.csproj ├── .gitattributes ├── DMSkin-for-WPF.sln ├── .gitignore └── DMSkin.Docs └── README.md /DMSkin.ScreenShot/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/944095635/DMSkin-for-WPF/HEAD/DMSkin.ScreenShot/demo.png -------------------------------------------------------------------------------- /DMSkin.ScreenShot/demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/944095635/DMSkin-for-WPF/HEAD/DMSkin.ScreenShot/demo1.png -------------------------------------------------------------------------------- /DMSkin.ScreenShot/demo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/944095635/DMSkin-for-WPF/HEAD/DMSkin.ScreenShot/demo2.png -------------------------------------------------------------------------------- /DMSkin.WPF/Styles/DMTreeView.xaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/944095635/DMSkin-for-WPF/HEAD/DMSkin.WPF.Demos/Images/image1.png -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Images/user.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/944095635/DMSkin-for-WPF/HEAD/DMSkin.WPF.Demos/Images/user.jpg -------------------------------------------------------------------------------- /DMSkin.WPF/Styles/DMListBox.xaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /DMSkin.WPF/Styles/DMIcon.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/StartWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace DMSkin.WPF.Demos 2 | { 3 | public partial class StartWindow 4 | { 5 | public StartWindow() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/ViewModels/MainWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | using DMSkin.Core.MVVM; 2 | using System.Windows; 3 | using System.Windows.Input; 4 | 5 | namespace DM_Studio.ViewModels 6 | { 7 | public class MainWindowViewModel 8 | { 9 | public ICommand F1Command 10 | { 11 | get 12 | { 13 | return new DelegateCommand((obj) => { 14 | MessageBox.Show("Test"); 15 | }); 16 | } 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageVirtualizing.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/ViewModels/PageAboutViewModel.cs: -------------------------------------------------------------------------------- 1 | using DMSkin.Core.MVVM; 2 | using System.Diagnostics; 3 | using System.Windows.Input; 4 | 5 | namespace DMSkin.WPF.Demos.ViewModels 6 | { 7 | public class PageAboutViewModel 8 | { 9 | public ICommand OpenLinkCommand 10 | { 11 | get 12 | { 13 | return new DelegateCommand(obj => 14 | { 15 | if (obj is string url) 16 | { 17 | Process.Start(url); 18 | } 19 | }); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMSystemMinButton.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace DMSkin.WPF.Controls 7 | { 8 | public class DMSystemMinButton : DMSystemButton 9 | { 10 | Window targetWindow; 11 | public DMSystemMinButton() 12 | { 13 | Click += delegate 14 | { 15 | if (targetWindow == null) 16 | { 17 | targetWindow = Window.GetWindow(this); 18 | } 19 | targetWindow.WindowState = WindowState.Minimized; 20 | }; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | 8 | namespace DMSkin.WPF.Controls 9 | { 10 | public class DMButton : Button 11 | { 12 | public CornerRadius CornerRadius 13 | { 14 | get { return (CornerRadius)GetValue(CornerRadiusProperty); } 15 | set { SetValue(CornerRadiusProperty, value); } 16 | } 17 | public static readonly DependencyProperty CornerRadiusProperty = 18 | DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(DMButton), new PropertyMetadata(null)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMLinkButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | 8 | namespace DMSkin.WPF.Controls 9 | { 10 | public class DMLinkButton : DMSystemButton 11 | { 12 | public bool DMDisplayLine 13 | { 14 | get { return (bool)GetValue(DMDisplayLineProperty); } 15 | set { SetValue(DMDisplayLineProperty, value); } 16 | } 17 | public static readonly DependencyProperty DMDisplayLineProperty = 18 | DependencyProperty.Register("DMDisplayLine", typeof(bool), typeof(DMLinkButton), new PropertyMetadata(true)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageAbout.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace DMSkin.WPF.Demos.Views 16 | { 17 | /// 18 | /// PageAbout.xaml 的交互逻辑 19 | /// 20 | public partial class PageAbout : Page 21 | { 22 | public PageAbout() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMSystemCloseButton.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace DMSkin.WPF.Controls 7 | { 8 | public class DMSystemCloseButton : DMSystemButton 9 | { 10 | Window targetWindow; 11 | public DMSystemCloseButton() 12 | { 13 | DMSystemButtonHoverColor = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)); 14 | 15 | Click += delegate{ 16 | if (targetWindow==null) 17 | { 18 | targetWindow = Window.GetWindow(this); 19 | } 20 | targetWindow.Close(); 21 | }; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageAnimation.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace DMSkin.WPF.Demos.Views 16 | { 17 | /// 18 | /// PageAnimation.xaml 的交互逻辑 19 | /// 20 | public partial class PageAnimation : Page 21 | { 22 | public PageAnimation() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageAntDesign.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace DMSkin.WPF.Demos.Views 16 | { 17 | /// 18 | /// PageAntDesign.xaml 的交互逻辑 19 | /// 20 | public partial class PageAntDesign : UserControl 21 | { 22 | public PageAntDesign() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageScrollViewer.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace DMSkin.WPF.Demos.Views 16 | { 17 | /// 18 | /// PageScrollViewer.xaml 的交互逻辑 19 | /// 20 | public partial class PageScrollViewer : UserControl 21 | { 22 | public PageScrollViewer() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageVirtualizing.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace DMSkin.WPF.Demos.Views 16 | { 17 | /// 18 | /// PageVirtualizing.xaml 的交互逻辑 19 | /// 20 | public partial class PageVirtualizing : UserControl 21 | { 22 | public PageVirtualizing() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/Window/SimpleWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace DMSkin.WPF.Demos 16 | { 17 | public partial class SimpleWindow 18 | { 19 | public SimpleWindow() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | private void DMSkinWindow_Loaded(object sender, RoutedEventArgs e) 25 | { 26 | 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DMSkin.Core/Converters/EnumToBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace DMSkin.Core.Converters 6 | { 7 | public class EnumToBooleanConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | if (value == null||value.ToString()!=parameter.ToString()) 12 | { 13 | return false; 14 | } 15 | return true; 16 | } 17 | 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | return value != null && value.Equals(true) ? parameter : Binding.DoNothing; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMRadioButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Media; 8 | 9 | namespace DMSkin.WPF.Controls 10 | { 11 | public class DMRadioButton : RadioButton 12 | { 13 | public SolidColorBrush IconColor 14 | { 15 | get { return (SolidColorBrush)GetValue(IconColorProperty); } 16 | set { SetValue(IconColorProperty, value); } 17 | } 18 | public static readonly DependencyProperty IconColorProperty = 19 | DependencyProperty.Register("IconColor", typeof(SolidColorBrush), typeof(DMRadioButton), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 255,255,255)))); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DMSkin.Core/Converters/TimeSpanToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace DMSkin.Core.Converters 6 | { 7 | /// 8 | /// 将TimeSpan 转换为 00:00 9 | /// 10 | [ValueConversion(typeof(DateTime?), typeof(string))] 11 | public class TimeSpanToStringConverter : IValueConverter 12 | { 13 | #region Implementation of IValueConverter 14 | 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | var date = (TimeSpan)value; 18 | return date.ToString(@"mm\:ss\ "); 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | throw new NotSupportedException(); 24 | } 25 | #endregion 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DMSkin.Core/Converters/EnumToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace DMSkin.Core.Converters 7 | { 8 | /// 9 | /// 将枚举值 转换为 是否显示 10 | /// 11 | public class EnumToVisibilityConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (value == null||value.ToString()!=parameter.ToString()) 16 | { 17 | return Visibility.Collapsed; 18 | } 19 | return Visibility.Visible; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | return value != null && value.Equals(true) ? parameter : Binding.DoNothing; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using DMSkin.Core.Common; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Configuration; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Windows; 8 | 9 | namespace DMSkin.WPF.Demos 10 | { 11 | public partial class App : Application 12 | { 13 | protected override void OnStartup(StartupEventArgs e) 14 | { 15 | //初始化UI Dispatcher 16 | Execute.InitializeWithDispatcher(); 17 | 18 | ShutdownMode = ShutdownMode.OnLastWindowClose; 19 | 20 | //启动窗口 21 | StartWindow st= new StartWindow(); 22 | st.Show(); 23 | 24 | //ComplexWindow c = new ComplexWindow(); 25 | //c.Show(); 26 | 27 | //SimpleMainWindow s = new SimpleMainWindow(); 28 | //s.Show(); 29 | 30 | //DemoWindow d = new DemoWindow(); 31 | //d.Show(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DMSkin.WPF/ShadowWindow.xaml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DMSkin.WPF.Demos.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/Window/ComplexWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using DMSkin.Core.Common; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Data; 11 | using System.Windows.Documents; 12 | using System.Windows.Input; 13 | using System.Windows.Media; 14 | using System.Windows.Media.Imaging; 15 | using System.Windows.Navigation; 16 | using System.Windows.Shapes; 17 | 18 | namespace DMSkin.WPF.Demos 19 | { 20 | public partial class ComplexWindow 21 | { 22 | public ComplexWindow() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void ButtonSkin_Click(object sender, RoutedEventArgs e) 28 | { 29 | this.Hide(); 30 | Task.Factory.StartNew(()=> { 31 | Thread.Sleep(2000); 32 | Execute.OnUIThread(()=> 33 | { 34 | this.Show(); 35 | }); 36 | }); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dream.Machine 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /DMSkin.WPF.AntDesign/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("DMSkin.WPF.AntDesign")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DMSkin.WPF.AntDesign")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("d633fda6-ddbe-46d6-a3e4-8bcc145935bf")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DMSkin.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("DMSkin.Core")] 9 | [assembly: AssemblyDescription("Dream.Machine QQ944095635")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Dream.Machine")] 12 | [assembly: AssemblyProduct("DMSkin.Core")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("13da6558-356b-47b9-96f2-fe4d5457cb02")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.5.1.4")] 36 | [assembly: AssemblyFileVersion("2.5.1.4")] 37 | -------------------------------------------------------------------------------- /DMSkin.WPF/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("DMSkin.WPF")] 9 | [assembly: AssemblyDescription("Dream.Machine QQ944095635")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Dream.Machine")] 12 | [assembly: AssemblyProduct("DMSkin.WPF")] 13 | [assembly: AssemblyCopyright("DMSkin.WPF")] 14 | [assembly: AssemblyTrademark("Copyright © 2018")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("168352b1-6a0c-4c9c-8a32-68b512da3cfc")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.5.1.4")] 36 | [assembly: AssemblyFileVersion("2.5.1.4")] 37 | -------------------------------------------------------------------------------- /DMSkin.Core/MVVM/DelegateCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | 4 | namespace DMSkin.Core.MVVM 5 | { 6 | public class DelegateCommand : ICommand 7 | { 8 | private Action executeAction; 9 | private Func canExecuteFunc; 10 | public event EventHandler CanExecuteChanged; 11 | public DelegateCommand(Action execute) 12 | : this(execute, null) 13 | { } 14 | public DelegateCommand(Action execute, Func canExecute) 15 | { 16 | if (execute == null) 17 | { 18 | return; 19 | } 20 | executeAction = execute; 21 | canExecuteFunc = canExecute; 22 | } 23 | public bool CanExecute(object parameter) 24 | { 25 | if (canExecuteFunc == null) 26 | { 27 | return true; 28 | } 29 | return canExecuteFunc(parameter); 30 | } 31 | public void Execute(object parameter) 32 | { 33 | if (executeAction == null) 34 | { 35 | return; 36 | } 37 | executeAction(parameter); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMCheckBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Media; 8 | 9 | namespace DMSkin.WPF.Controls 10 | { 11 | public class DMCheckBox : CheckBox 12 | { 13 | public SolidColorBrush IconColor 14 | { 15 | get { return (SolidColorBrush)GetValue(IconColorProperty); } 16 | set { SetValue(IconColorProperty, value); } 17 | } 18 | public static readonly DependencyProperty IconColorProperty = 19 | DependencyProperty.Register("IconColor", typeof(SolidColorBrush), typeof(DMCheckBox), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 255,255,255)))); 20 | 21 | 22 | /// 23 | /// 是否显示内容 24 | /// 25 | public bool IsShowContent 26 | { 27 | get { return (bool)GetValue(IsShowContentProperty); } 28 | set { SetValue(IsShowContentProperty, value); } 29 | } 30 | public static readonly DependencyProperty IsShowContentProperty = 31 | DependencyProperty.Register("IsShowContent", typeof(bool), typeof(DMCheckBox), new PropertyMetadata(true)); 32 | 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DMSkin.Core/Converters/CompareToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | using Converts = System.Convert; 9 | 10 | namespace DMSkin.Core.Converters 11 | { 12 | /// 13 | /// 比较数字大小 返回是否显示的转换器 14 | /// 例:当界面尺寸大于某个值的时候显示某些东西。 15 | /// 16 | public class CompareToVisibilityConverter : IValueConverter 17 | { 18 | /// 19 | /// 转换函数 20 | /// 21 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | try 24 | { 25 | double v1 = Converts.ToDouble(value); 26 | double v2 = Converts.ToDouble(parameter); 27 | if (v1 > v2) 28 | { 29 | return Visibility.Visible; 30 | } 31 | } 32 | catch (Exception) 33 | { 34 | 35 | } 36 | return Visibility.Collapsed; 37 | } 38 | 39 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 40 | { 41 | return Binding.DoNothing; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DMSkin.Core/Common/Execute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Threading; 3 | 4 | namespace DMSkin.Core.Common 5 | { 6 | public static class Execute 7 | { 8 | private static Action executor = (action, async) => action(); 9 | /// 10 | /// 初始化UI调度器 11 | /// 12 | public static void InitializeWithDispatcher() 13 | { 14 | var dispatcher = Dispatcher.CurrentDispatcher; 15 | executor = (action, async) => 16 | { 17 | //确认是当前的线程 18 | if (dispatcher.CheckAccess()) 19 | { 20 | action(); 21 | } 22 | else 23 | { 24 | //异步执行 25 | if (async) 26 | { 27 | dispatcher.BeginInvoke(action); 28 | } 29 | else 30 | { 31 | dispatcher.Invoke(action); 32 | } 33 | } 34 | }; 35 | } 36 | 37 | /// 38 | /// UI线程中执行方法 39 | /// 40 | public static void OnUIThread(this Action action,bool async = false) 41 | { 42 | executor(action,async); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /DMSkin.Core/MVVM/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace DMSkin.Core.MVVM 4 | { 5 | public class ViewModelBase : INotifyPropertyChanged 6 | { 7 | #region UI更新接口 8 | public event PropertyChangedEventHandler PropertyChanged; 9 | protected virtual void OnPropertyChanged(string propertyName = null) 10 | { 11 | if (PropertyChanged != null) 12 | PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); 13 | } 14 | #endregion 15 | 16 | #region 是否正在加载 17 | private bool isLoad; 18 | 19 | /// 20 | /// 是否加载 21 | /// 22 | public bool IsLoad 23 | { 24 | get { return isLoad; } 25 | set 26 | { 27 | isLoad = value; 28 | OnPropertyChanged(nameof(IsLoad)); 29 | } 30 | } 31 | #endregion 32 | 33 | #region 是否需要刷新 34 | private bool update; 35 | /// 36 | /// 刷新 37 | /// 38 | public bool Update 39 | { 40 | get { return update; } 41 | set 42 | { 43 | update = value; 44 | OnPropertyChanged(nameof(Update)); 45 | } 46 | } 47 | #endregion 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /DMSkin.Core/TaskManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace DMSkin.Core 9 | { 10 | public class TaskManager 11 | { 12 | /// 13 | /// 创建一个超时任务 14 | /// 15 | /// 执行的函数 16 | /// 超时时间 17 | public static bool Wait(Action action,int timeOut) 18 | { 19 | Task taskWait = new Task(()=> 20 | { 21 | action(); 22 | }); 23 | 24 | Task taskTime = new Task(() => 25 | { 26 | Thread.Sleep(timeOut); 27 | }); 28 | 29 | taskWait.Start(); 30 | taskTime.Start(); 31 | 32 | if (Task.WaitAny(taskWait, taskTime)==0) 33 | { 34 | return true; 35 | } 36 | return false; 37 | } 38 | 39 | /// 40 | /// 延迟执行 41 | /// 42 | /// 43 | /// 44 | public static void Delay(Action action, int time) 45 | { 46 | Task taskWait = new Task(() => 47 | { 48 | Thread.Sleep(time); 49 | action(); 50 | }); 51 | taskWait.Start(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /DMSkin.Core/Common/UINT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DMSkin.Core.Common 7 | { 8 | public class UINT 9 | { 10 | /// 11 | /// 将数据转换为 12 | /// 13 | /// 数值 14 | /// 从类型 15 | /// 到类型 16 | /// 小数点后位数 17 | public static string ToSize(UINTYPE fromtype,double size,int count = 2) 18 | { 19 | double temp = size; 20 | double mod = 1024.0; 21 | switch (fromtype) 22 | { 23 | case UINTYPE.KB: 24 | temp = size * mod; 25 | break; 26 | case UINTYPE.MB: 27 | temp = size * mod * mod; 28 | break; 29 | case UINTYPE.GB: 30 | temp = size * mod * mod * mod; 31 | break; 32 | } 33 | 34 | string[] units = new string[] { "B", "KB", "MB", "GB", "TB"}; 35 | int i = 0; 36 | while (temp >= mod) 37 | { 38 | temp /= mod; 39 | i++; 40 | } 41 | return Math.Round(temp,count) + units[i]; 42 | } 43 | } 44 | 45 | public enum UINTYPE 46 | { 47 | B, 48 | KB, 49 | MB, 50 | GB 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /DMSkin.Core/Converters/BoolToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace DMSkin.Core.Converters 7 | { 8 | /// 9 | /// Bool 转换 为 Visibility 10 | /// 11 | public class BoolToVisibilityConverter : IValueConverter 12 | { 13 | /// 14 | /// 转换函数 15 | /// 16 | /// 只要有值就会被反转 - 相当于取反 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | if (value is bool b && b) 20 | { 21 | return ConvertFun(Visibility.Visible, parameter); 22 | } 23 | return ConvertFun(Visibility.Collapsed, parameter); 24 | } 25 | 26 | public object ConvertFun(Visibility visibility, object parameter) 27 | { 28 | //有command参数 取反值 29 | if (parameter is string p)//取反值 30 | { 31 | if (visibility == Visibility.Visible) 32 | { 33 | return Visibility.Collapsed; 34 | } 35 | return Visibility.Visible; 36 | } 37 | return visibility; 38 | } 39 | 40 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 41 | { 42 | return value != null && value.Equals(true) ? parameter : Binding.DoNothing; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /DMSkin.Core/Converters/SecondToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows.Data; 7 | 8 | namespace DMSkin.Core.Converters 9 | { 10 | /// 11 | /// 将秒数 转换 为时间显示 00:10:00 12 | /// 13 | public class SecondToStringConverter : IValueConverter 14 | { 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | if (value is int offset) 18 | { 19 | var absOffset = Math.Abs(offset); 20 | var hour = ((absOffset / 3600)).ToString(); 21 | var minute = ((absOffset - ((absOffset / 3600) * 3600)) / 60).ToString(); 22 | var second = ((absOffset - ((absOffset / 3600) * 3600)) % 60).ToString(); 23 | return $"{(offset >= 0 ? "" : "-")}{hour.PadLeft(2, '0')}:{minute.PadLeft(2, '0')}:{second.PadLeft(2, '0')}"; 24 | } 25 | return value; 26 | } 27 | 28 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 29 | { 30 | var arr = (value as string)?.Split(':'); 31 | if (arr?.Length == 2) 32 | { 33 | long hour, minute; 34 | if (Int64.TryParse(arr[0], out hour) && Int64.TryParse(arr[1], out minute)) 35 | { 36 | return hour * 3600 + minute * 60; 37 | } 38 | } 39 | return value; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /DMSkin.WPF/Styles/DMResizeGrip.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 29 | 30 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // 有关程序集的一般信息由以下 8 | // 控制。更改这些特性值可修改 9 | // 与程序集关联的信息。 10 | [assembly: AssemblyTitle("DMSkin.WPF.Demos")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("DMSkin.WPF.Demos")] 15 | [assembly: AssemblyCopyright("Copyright © 2017")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // 将 ComVisible 设置为 false 会使此程序集中的类型 20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 21 | //请将此类型的 ComVisible 特性设置为 true。 22 | [assembly: ComVisible(false)] 23 | 24 | //若要开始生成可本地化的应用程序,请设置 25 | //.csproj 文件中的 CultureYouAreCodingWith 26 | //例如,如果您在源文件中使用的是美国英语, 27 | //使用的是美国英语,请将 设置为 en-US。 然后取消 28 | //对以下 NeutralResourceLanguage 特性的注释。 更新 29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置 36 | //(未在页面中找到资源时使用, 37 | //或应用程序资源字典中找到时使用) 38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 39 | //(未在页面中找到资源时使用, 40 | //、应用程序或任何主题专用资源字典中找到时使用) 41 | )] 42 | 43 | 44 | // 程序集的版本信息由下列四个值组成: 45 | // 46 | // 主版本 47 | // 次版本 48 | // 生成号 49 | // 修订号 50 | // 51 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 52 | // 方法是按如下所示使用“*”: : 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("2.5.0.7")] 55 | [assembly: AssemblyFileVersion("2.5.0.7")] 56 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMSystemMaxButton.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace DMSkin.WPF.Controls 7 | { 8 | public class DMSystemMaxButton : DMSystemButton 9 | { 10 | Window targetWindow; 11 | public DMSystemMaxButton() 12 | { 13 | Click += delegate 14 | { 15 | if (targetWindow == null) 16 | { 17 | targetWindow = Window.GetWindow(this); 18 | targetWindow.StateChanged += delegate 19 | { 20 | if (targetWindow.WindowState == WindowState.Normal) 21 | { 22 | IsMax = false; 23 | } 24 | else if (targetWindow.WindowState == WindowState.Maximized) 25 | { 26 | IsMax = true; 27 | } 28 | }; 29 | } 30 | if (targetWindow.WindowState == WindowState.Normal) 31 | { 32 | targetWindow.WindowState = WindowState.Maximized; 33 | } 34 | else if (targetWindow.WindowState == WindowState.Maximized) 35 | { 36 | targetWindow.WindowState = WindowState.Normal; 37 | } 38 | }; 39 | } 40 | 41 | public bool IsMax 42 | { 43 | get { return (bool)GetValue(IsMaxProperty); } 44 | set { SetValue(IsMaxProperty, value); 45 | } 46 | } 47 | 48 | public static readonly DependencyProperty IsMaxProperty = 49 | DependencyProperty.Register("IsMax", typeof(bool), typeof(DMSystemMaxButton), new PropertyMetadata(false)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /DMSkin.Core/WIN32/DesktopAPI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DMSkin.Core.WIN32 4 | { 5 | public class DesktopAPI 6 | { 7 | /// 8 | /// 初始化 9 | /// 10 | public static void Initialization(IntPtr Handle) 11 | { 12 | //获取所有屏幕 13 | //Screen[] allScreens = Screen.AllScreens; 14 | //所有屏幕 15 | //int count = allScreens.Length; 16 | //拿到程序管理器句柄 17 | IntPtr progman = NativeMethods.FindWindow("Progman", null); 18 | NativeMethods.SendMessageTimeout(progman, (uint)0x052C, new UIntPtr(0), IntPtr.Zero, SendMessageTimeoutFlags.SMTO_NORMAL, 1000, out UIntPtr result); 19 | NativeMethods.SetParent(Handle, FindWorkerWPtr()); 20 | } 21 | 22 | /// 23 | /// 查找工作区域 24 | /// 25 | public static IntPtr FindWorkerWPtr() 26 | { 27 | IntPtr workerw = IntPtr.Zero; 28 | IntPtr def = IntPtr.Zero; 29 | IntPtr intPtr = NativeMethods.FindWindow("Progman", null); 30 | //http://blog.csdn.net/whatday/article/details/8714573 31 | IntPtr zeroResult = IntPtr.Zero; 32 | //遍历窗体 33 | NativeMethods.EnumWindows(delegate (IntPtr handle, IntPtr param) 34 | { 35 | //TODO 双屏问题 36 | //参考:http://blog.csdn.net/zhoufoxcn/article/details/2515753,获取墙纸的窗体下面的一个窗体句柄 37 | if ((def = NativeMethods.FindWindowEx(handle, IntPtr.Zero, "SHELLDLL_DefView", IntPtr.Zero)) != IntPtr.Zero) 38 | { 39 | workerw = NativeMethods.FindWindowEx(IntPtr.Zero, handle, "WorkerW", IntPtr.Zero); 40 | //得到 41 | Console.Write("workerw:" + workerw + "\n"); 42 | NativeMethods.ShowWindow(workerw, 0); 43 | } 44 | return true; 45 | }, IntPtr.Zero); 46 | 47 | return intPtr; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /DMSkin.WPF/Styles/DMSkinSimpleWindow.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 35 | -------------------------------------------------------------------------------- /DMSkin.WPF/Styles/DMToolTip.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 42 | -------------------------------------------------------------------------------- /DMSkin.Core/Common/Base64.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace DMSkin.Core.Commom 5 | { 6 | public sealed class Base64 7 | { 8 | /// 9 | /// Base64加密 10 | /// 11 | /// 加密采用的编码方式 12 | /// 待加密的明文 13 | /// 返回加密的文本 14 | public static string EncodeBase64(Encoding encode, string source) 15 | { 16 | byte[] bytes = encode.GetBytes(source); 17 | try 18 | { 19 | source = Convert.ToBase64String(bytes); 20 | } 21 | catch 22 | { 23 | 24 | } 25 | return source; 26 | } 27 | 28 | /// 29 | /// Base64加密,采用utf8编码方式加密 30 | /// 31 | /// 待加密的明文 32 | /// 加密后的字符串 33 | public static string EncodeBase64(string source) 34 | { 35 | return EncodeBase64(Encoding.UTF8, source); 36 | } 37 | 38 | /// 39 | /// Base64解密 40 | /// 41 | /// 解密采用的编码方式,注意和加密时采用的方式一致 42 | /// 待解密的密文 43 | /// 解密后的字符串 44 | public static string DecodeBase64(Encoding encode, string result) 45 | { 46 | string decode = ""; 47 | byte[] bytes = Convert.FromBase64String(result); 48 | try 49 | { 50 | decode = encode.GetString(bytes); 51 | } 52 | catch 53 | { 54 | decode = result; 55 | } 56 | return decode; 57 | } 58 | 59 | /// 60 | /// Base64解密,采用utf8编码方式解密 61 | /// 62 | /// 待解密的密文 63 | /// 解密后的字符串 64 | public static string DecodeBase64(string result) 65 | { 66 | return DecodeBase64(Encoding.UTF8, result); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /DMSkin.WPF/Styles/DMImage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 44 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/ViewModels/StartWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | using DMSkin.Core.Common; 2 | using DMSkin.Core.MVVM; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | 11 | namespace DMSkin.WPF.Demos.ViewModels 12 | { 13 | public class StartWindowViewModel:ViewModelBase 14 | { 15 | public ICommand ComplexWindowCommand 16 | { 17 | get 18 | { 19 | return new DelegateCommand(obj => 20 | { 21 | //UI线程执行 22 | Execute.OnUIThread(() => 23 | { 24 | new ComplexWindow().Show(); 25 | }); 26 | }); 27 | } 28 | } 29 | 30 | public ICommand SimpleWindowCommand 31 | { 32 | get 33 | { 34 | return new DelegateCommand(obj => 35 | { 36 | new SimpleWindow().Show(); 37 | }); 38 | } 39 | } 40 | 41 | 42 | 43 | private Color _DMWindowShadowColor; 44 | 45 | /// 46 | /// 窗体阴影颜色 47 | /// 48 | public Color DMWindowShadowColor 49 | { 50 | get { return _DMWindowShadowColor; } 51 | set 52 | { 53 | _DMWindowShadowColor = value; 54 | OnPropertyChanged("DMWindowShadowColor"); 55 | } 56 | } 57 | 58 | public ICommand ChangeWindowCommand 59 | { 60 | get 61 | { 62 | return new DelegateCommand(obj => 63 | { 64 | DMWindowShadowColor = (Color)ColorConverter.ConvertFromString(obj.ToString()); 65 | }); 66 | } 67 | } 68 | 69 | 70 | 71 | public ICommand OpenLinkCommand 72 | { 73 | get 74 | { 75 | return new DelegateCommand(obj => 76 | { 77 | if (obj is string url) 78 | { 79 | Process.Start(url); 80 | } 81 | }); 82 | } 83 | } 84 | 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/Window/ComplexWindow.xaml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 35 | 39 | 43 | 47 | 48 | 49 | 55 | 56 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/Window/SimpleWindow.xaml: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 37 | 41 | 45 | 49 | 50 | 51 | 57 | 58 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | ############################################################################### 4 | # Set default behavior for command prompt diff. 5 | # 6 | # This is need for earlier builds of msysgit that does not have it on by 7 | # default for csharp files. 8 | # Note: This is only used by command line 9 | ############################################################################### 10 | #*.cs diff=csharp 11 | 12 | ############################################################################### 13 | # Set the merge driver for project and solution files 14 | # 15 | # Merging from the command prompt will add diff markers to the files if there 16 | # are conflicts (Merging from VS is not affected by the settings below, in VS 17 | # the diff markers are never inserted). Diff markers may cause the following 18 | # file extensions to fail to load in VS. An alternative would be to treat 19 | # these files as binary and thus will always conflict and require user 20 | # intervention with every merge. To do so, just uncomment the entries below 21 | ############################################################################### 22 | #*.sln merge=binary 23 | #*.csproj merge=binary 24 | #*.vbproj merge=binary 25 | #*.vcxproj merge=binary 26 | #*.vcproj merge=binary 27 | #*.dbproj merge=binary 28 | #*.fsproj merge=binary 29 | #*.lsproj merge=binary 30 | #*.wixproj merge=binary 31 | #*.modelproj merge=binary 32 | #*.sqlproj merge=binary 33 | #*.wwaproj merge=binary 34 | 35 | ############################################################################### 36 | # behavior for image files 37 | # 38 | # image files are treated as binary by default. 39 | ############################################################################### 40 | #*.jpg binary 41 | #*.png binary 42 | #*.gif binary 43 | 44 | ############################################################################### 45 | # diff behavior for common document formats 46 | # 47 | # Convert binary document formats to text before diffing them. This feature 48 | # is only available from the command line. Turn it on by uncommenting the 49 | # entries below. 50 | ############################################################################### 51 | #*.doc diff=astextplain 52 | #*.DOC diff=astextplain 53 | #*.docx diff=astextplain 54 | #*.DOCX diff=astextplain 55 | #*.dot diff=astextplain 56 | #*.DOT diff=astextplain 57 | #*.pdf diff=astextplain 58 | #*.PDF diff=astextplain 59 | #*.rtf diff=astextplain 60 | #*.RTF diff=astextplain 61 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMTabItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Media; 8 | 9 | namespace DMSkin.WPF.Controls 10 | { 11 | public class DMTabItem : TabItem 12 | { 13 | 14 | /// 15 | /// 选中背景色 16 | /// 17 | public SolidColorBrush SelectedColor 18 | { 19 | get { return (SolidColorBrush)GetValue(SelectedColorProperty); } 20 | set { SetValue(SelectedColorProperty, value); } 21 | } 22 | public static readonly DependencyProperty SelectedColorProperty = 23 | DependencyProperty.Register("SelectedColor", typeof(SolidColorBrush), typeof(DMTabItem), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 124, 125, 133)))); 24 | 25 | /// 26 | /// 选中文字颜色 27 | /// 28 | public SolidColorBrush SelectedForeground 29 | { 30 | get { return (SolidColorBrush)GetValue(SelectedForegroundProperty); } 31 | set { SetValue(SelectedForegroundProperty, value); } 32 | } 33 | public static readonly DependencyProperty SelectedForegroundProperty = 34 | DependencyProperty.Register("SelectedForeground", typeof(SolidColorBrush), typeof(DMTabItem), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 229, 229, 231)))); 35 | 36 | 37 | /// 38 | /// 鼠标悬浮背景色 39 | /// 40 | public SolidColorBrush HoverColor 41 | { 42 | get { return (SolidColorBrush)GetValue(HoverColorProperty); } 43 | set { SetValue(HoverColorProperty, value); } 44 | } 45 | 46 | public static readonly DependencyProperty HoverColorProperty = 47 | DependencyProperty.Register("HoverColor", typeof(SolidColorBrush), typeof(DMTabItem), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 220, 220, 220)))); 48 | 49 | 50 | 51 | 52 | public TabItemType TabItemType 53 | { 54 | get { return (TabItemType)GetValue(TabItemTypeProperty); } 55 | set { 56 | SetValue(TabItemTypeProperty, value); 57 | } 58 | } 59 | public static readonly DependencyProperty TabItemTypeProperty = 60 | DependencyProperty.Register("TabItemType", typeof(TabItemType), typeof(DMTabItem), new PropertyMetadata(TabItemType.Middle)); 61 | } 62 | 63 | public enum TabItemType 64 | { 65 | Left,Middle,Right 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /DMSkin.WPF.AntDesign/DMSkin.WPF.AntDesign.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D633FDA6-DDBE-46D6-A3E4-8BCC145935BF} 8 | Library 9 | Properties 10 | DMSkin.WPF.AntDesign 11 | DMSkin.WPF.AntDesign 12 | v4.0 13 | 512 14 | true 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | MSBuild:Compile 53 | Designer 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DMSkin.WPF.Demos.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DMSkin.WPF.Demos.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 重写当前线程的 CurrentUICulture 属性 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMNumericBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | 8 | namespace DMSkin.WPF.Controls 9 | { 10 | public class DMNumericBox : Control 11 | { 12 | public string ShowText 13 | { 14 | get { return (string)GetValue(ShowTextProperty); } 15 | set { SetValue(ShowTextProperty, value); } 16 | } 17 | public static readonly DependencyProperty ShowTextProperty = 18 | DependencyProperty.Register("ShowText", typeof(string), typeof(DMNumericBox), new PropertyMetadata(string.Empty)); 19 | 20 | 21 | public override void OnApplyTemplate() 22 | { 23 | Button BtnAdd = Template.FindName("BtnAdd",this) as Button; 24 | Button BtnReduce = Template.FindName("BtnReduce", this) as Button; 25 | 26 | BtnReduce.Click +=delegate{ 27 | if (Value <= MinValue) 28 | { 29 | Value = MinValue; 30 | return; 31 | } 32 | Value--; 33 | }; 34 | 35 | BtnAdd.Click += delegate { 36 | if (Value>=MaxValue) 37 | { 38 | Value = MaxValue; 39 | return; 40 | } 41 | Value++; 42 | }; 43 | } 44 | 45 | 46 | 47 | 48 | public int Value 49 | { 50 | get { return (int)GetValue(ValueProperty); } 51 | set { SetValue(ValueProperty, value); } 52 | } 53 | 54 | public static readonly DependencyProperty ValueProperty = 55 | DependencyProperty.Register("Value", typeof(int), typeof(DMNumericBox), new PropertyMetadata(0)); 56 | 57 | 58 | 59 | public int MinValue 60 | { 61 | get { return (int)GetValue(MinValueProperty); } 62 | set { SetValue(MinValueProperty, value); } 63 | } 64 | 65 | // Using a DependencyProperty as the backing store for MinValue. This enables animation, styling, binding, etc... 66 | public static readonly DependencyProperty MinValueProperty = 67 | DependencyProperty.Register("MinValue", typeof(int), typeof(DMNumericBox), new PropertyMetadata(0)); 68 | 69 | 70 | 71 | public int MaxValue 72 | { 73 | get { return (int)GetValue(MaxValueProperty); } 74 | set { SetValue(MaxValueProperty, value); } 75 | } 76 | 77 | public static readonly DependencyProperty MaxValueProperty = 78 | DependencyProperty.Register("MaxValue", typeof(int), typeof(DMNumericBox), new PropertyMetadata(100)); 79 | 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /DMSkin.WPF/ShadowWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using DMSkin.Core.WIN32; 2 | using System; 3 | using System.ComponentModel; 4 | using System.Windows; 5 | using System.Windows.Interop; 6 | using System.Windows.Media; 7 | 8 | namespace DMSkin.WPF 9 | { 10 | public partial class ShadowWindow : Window, INotifyPropertyChanged 11 | { 12 | #region UI更新接口 13 | public event PropertyChangedEventHandler PropertyChanged; 14 | protected virtual void OnPropertyChanged(string propertyName = null) 15 | { 16 | if (PropertyChanged != null) 17 | PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); 18 | } 19 | #endregion 20 | 21 | private double _DMWindowShadowSize = 10.0; 22 | [Description("窗体阴影大小"), Category("DMSkin")] 23 | public double DMWindowShadowSize 24 | { 25 | get 26 | { 27 | return _DMWindowShadowSize; 28 | } 29 | 30 | set 31 | { 32 | _DMWindowShadowSize = value; 33 | OnPropertyChanged("DMWindowShadowSize"); 34 | } 35 | } 36 | 37 | private Color _DMWindowShadowColor = Color.FromArgb(255, 200, 200, 200); 38 | [Description("窗体阴影颜色"), Category("DMSkin")] 39 | public Color DMWindowShadowColor 40 | { 41 | get 42 | { 43 | return _DMWindowShadowColor; 44 | } 45 | 46 | set 47 | { 48 | _DMWindowShadowColor = value; 49 | OnPropertyChanged("DMWindowShadowColor"); 50 | } 51 | } 52 | 53 | 54 | private Brush _DMWindowShadowBackColor = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)); 55 | [Description("窗体阴影背景颜色"), Category("DMSkin")] 56 | public Brush DMWindowShadowBackColor 57 | { 58 | get 59 | { 60 | return _DMWindowShadowBackColor; 61 | } 62 | 63 | set 64 | { 65 | _DMWindowShadowBackColor = value; 66 | OnPropertyChanged("DMWindowShadowBackColor"); 67 | } 68 | } 69 | 70 | public ShadowWindow() 71 | { 72 | InitializeComponent(); 73 | DataContext = this; 74 | SourceInitialized += MainWindow_SourceInitialized; 75 | } 76 | 77 | private void MainWindow_SourceInitialized(object sender, EventArgs e) 78 | { 79 | IntPtr Handle = new WindowInteropHelper(this).Handle; 80 | int exStyle = (int)NativeMethods.GetWindowLong(Handle, -20); 81 | exStyle = NativeConstants.WS_EX_TOOLWINDOW; 82 | NativeMethods.SetWindowLong(Handle, -20, (IntPtr)exStyle); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMThumb.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls.Primitives; 7 | using System.Windows.Media; 8 | 9 | namespace DMSkin.WPF.Controls 10 | { 11 | public class DMThumb:Thumb 12 | { 13 | #region 滑块默认颜色 14 | public SolidColorBrush ThemeColor 15 | { 16 | get { return (SolidColorBrush)GetValue(ThemeColorProperty); } 17 | set { SetValue(ThemeColorProperty, value); } 18 | } 19 | /// 20 | /// 滑块默认颜色 21 | /// 22 | public static readonly DependencyProperty ThemeColorProperty = 23 | DependencyProperty.Register("ThemeColor", typeof(SolidColorBrush), typeof(DMThumb), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 200, 200, 200)))); 24 | #endregion 25 | 26 | #region 滑块悬浮颜色 27 | public SolidColorBrush ThemeColorMouseOver 28 | { 29 | get { return (SolidColorBrush)GetValue(ThemeColorMouseOverProperty); } 30 | set { SetValue(ThemeColorMouseOverProperty, value); } 31 | } 32 | /// 33 | /// 滑块悬浮颜色 34 | /// 35 | public static readonly DependencyProperty ThemeColorMouseOverProperty = 36 | DependencyProperty.Register("ThemeColorMouseOver", typeof(SolidColorBrush), typeof(DMThumb), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255,180, 180, 180)))); 37 | #endregion 38 | 39 | #region 滑块悬浮按下颜色 40 | public SolidColorBrush ThemeColorPressed 41 | { 42 | get { return (SolidColorBrush)GetValue(ThemeColorPressedProperty); } 43 | set { SetValue(ThemeColorPressedProperty, value); } 44 | } 45 | /// 46 | /// 滑块悬浮按下颜色 47 | /// 48 | public static readonly DependencyProperty ThemeColorPressedProperty = 49 | DependencyProperty.Register("ThemeColorPressed", typeof(SolidColorBrush), typeof(DMThumb), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 190,190,190)))); 50 | #endregion 51 | 52 | #region 圆角值X 53 | /// 54 | /// 圆角值X 55 | /// 56 | public double RadiusX 57 | { 58 | get { return (double)GetValue(RadiusXProperty); } 59 | set { SetValue(RadiusXProperty, value); } 60 | } 61 | public static readonly DependencyProperty RadiusXProperty = 62 | DependencyProperty.Register("RadiusX", typeof(double), typeof(DMThumb), new PropertyMetadata(2.0)); 63 | #endregion 64 | 65 | #region 圆角值Y 66 | /// 67 | /// 圆角值Y 68 | /// 69 | public double RadiusY 70 | { 71 | get { return (double)GetValue(RadiusYProperty); } 72 | set { SetValue(RadiusYProperty, value); } 73 | } 74 | public static readonly DependencyProperty RadiusYProperty = 75 | DependencyProperty.Register("RadiusY", typeof(double), typeof(DMThumb), new PropertyMetadata(2.0)); 76 | #endregion 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /DMSkin.WPF/Styles/Animation.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 15 | 16 | 17 | 18 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Visible 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageAnimation.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 25 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageAbout.xaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 41 | 48 | 59 | 70 | 76 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMTextBox.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Media; 4 | 5 | namespace DMSkin.WPF.Controls 6 | { 7 | public class DMTextBox : TextBox 8 | { 9 | public string Hint 10 | { 11 | get { return (string)GetValue(HintProperty); } 12 | set { SetValue(HintProperty, value); } 13 | } 14 | public static readonly DependencyProperty HintProperty = 15 | DependencyProperty.Register("Hint", typeof(string), typeof(DMTextBox), new PropertyMetadata("")); 16 | public CornerRadius CornerRadius 17 | { 18 | get { return (CornerRadius)GetValue(CornerRadiusProperty); } 19 | set { SetValue(CornerRadiusProperty, value); } 20 | } 21 | public static readonly DependencyProperty CornerRadiusProperty = 22 | DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(DMTextBox), new PropertyMetadata(new CornerRadius(2))); 23 | public Geometry Icon 24 | { 25 | get { return (Geometry)GetValue(IconProperty); } 26 | set { SetValue(IconProperty, value); } 27 | } 28 | public static readonly DependencyProperty IconProperty = 29 | DependencyProperty.Register("Icon", typeof(Geometry), typeof(DMTextBox), new PropertyMetadata(null)); 30 | public bool ShowIcon 31 | { 32 | get { return (bool)GetValue(ShowIconProperty); } 33 | set { SetValue(ShowIconProperty, value); } 34 | } 35 | public static readonly DependencyProperty ShowIconProperty = 36 | DependencyProperty.Register("ShowIcon", typeof(bool), typeof(DMTextBox), new PropertyMetadata(false)); 37 | 38 | 39 | /// 40 | /// 图标宽度 41 | /// 42 | public double IconWidth 43 | { 44 | get { return (double)GetValue(IconWidthProperty); } 45 | set { SetValue(IconWidthProperty, value); } 46 | } 47 | public static readonly DependencyProperty IconWidthProperty = 48 | DependencyProperty.Register("IconWidth", typeof(double), typeof(DMTextBox), new PropertyMetadata(15.0)); 49 | 50 | /// 51 | /// 图标高度 52 | /// 53 | public double IconHeight 54 | { 55 | get { return (double)GetValue(IconHeightProperty); } 56 | set { SetValue(IconHeightProperty, value); } 57 | } 58 | public static readonly DependencyProperty IconHeightProperty = 59 | DependencyProperty.Register("IconHeight", typeof(double), typeof(DMTextBox), new PropertyMetadata(15.0)); 60 | 61 | public SolidColorBrush SelectedColor 62 | { 63 | get { return (SolidColorBrush)GetValue(SelectedColorProperty); } 64 | set { SetValue(SelectedColorProperty, value); } 65 | } 66 | public static readonly DependencyProperty SelectedColorProperty = 67 | DependencyProperty.Register("SelectedColor", typeof(SolidColorBrush), typeof(DMTextBox), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 124, 125, 133)))); 68 | 69 | /// 70 | /// 水印颜色 71 | /// 72 | public SolidColorBrush HintColor 73 | { 74 | get { return (SolidColorBrush)GetValue(HintColorProperty); } 75 | set { SetValue(HintColorProperty, value); } 76 | } 77 | public static readonly DependencyProperty HintColorProperty = 78 | DependencyProperty.Register("HintColor", typeof(SolidColorBrush), typeof(DMTextBox), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 88, 88, 88)))); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMScrollBar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls.Primitives; 7 | using System.Windows.Media; 8 | 9 | namespace DMSkin.WPF.Controls 10 | { 11 | public class DMScrollBar: ScrollBar 12 | { 13 | #region 滑块默认颜色 14 | public SolidColorBrush ThemeColor 15 | { 16 | get { return (SolidColorBrush)GetValue(ThemeColorProperty); } 17 | set { SetValue(ThemeColorProperty, value); } 18 | } 19 | /// 20 | /// 滑块默认颜色 21 | /// 22 | public static readonly DependencyProperty ThemeColorProperty = 23 | DependencyProperty.Register("ThemeColor", typeof(SolidColorBrush), typeof(DMScrollBar), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 200, 200, 200)))); 24 | #endregion 25 | 26 | #region 滑块悬浮颜色 27 | public SolidColorBrush ThemeColorMouseOver 28 | { 29 | get { return (SolidColorBrush)GetValue(ThemeColorMouseOverProperty); } 30 | set { SetValue(ThemeColorMouseOverProperty, value); } 31 | } 32 | /// 33 | /// 滑块悬浮颜色 34 | /// 35 | public static readonly DependencyProperty ThemeColorMouseOverProperty = 36 | DependencyProperty.Register("ThemeColorMouseOver", typeof(SolidColorBrush), typeof(DMScrollBar), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 180, 180, 180)))); 37 | #endregion 38 | 39 | #region 滑块悬浮按下颜色 40 | public SolidColorBrush ThemeColorPressed 41 | { 42 | get { return (SolidColorBrush)GetValue(ThemeColorPressedProperty); } 43 | set { SetValue(ThemeColorPressedProperty, value); } 44 | } 45 | /// 46 | /// 滑块悬浮按下颜色 47 | /// 48 | public static readonly DependencyProperty ThemeColorPressedProperty = 49 | DependencyProperty.Register("ThemeColorPressed", typeof(SolidColorBrush), typeof(DMScrollBar), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 190, 190, 190)))); 50 | #endregion 51 | 52 | #region 圆角值X 53 | /// 54 | /// 圆角值X 55 | /// 56 | public double RadiusX 57 | { 58 | get { return (double)GetValue(RadiusXProperty); } 59 | set { SetValue(RadiusXProperty, value); } 60 | } 61 | public static readonly DependencyProperty RadiusXProperty = 62 | DependencyProperty.Register("RadiusX", typeof(double), typeof(DMScrollBar), new PropertyMetadata(2.0)); 63 | #endregion 64 | 65 | #region 圆角值Y 66 | /// 67 | /// 圆角值Y 68 | /// 69 | public double RadiusY 70 | { 71 | get { return (double)GetValue(RadiusYProperty); } 72 | set { SetValue(RadiusYProperty, value); } 73 | } 74 | public static readonly DependencyProperty RadiusYProperty = 75 | DependencyProperty.Register("RadiusY", typeof(double), typeof(DMScrollBar), new PropertyMetadata(2.0)); 76 | #endregion 77 | 78 | #region 滚动条大小 79 | /// 80 | /// 滚动条大小 81 | /// 82 | public double ScrollBarSize 83 | { 84 | get { return (double)GetValue(ScrollBarSizeProperty); } 85 | set { SetValue(ScrollBarSizeProperty, value); } 86 | } 87 | public static readonly DependencyProperty ScrollBarSizeProperty = 88 | DependencyProperty.Register("ScrollBarSize", typeof(double), typeof(DMScrollBar), new PropertyMetadata(6.0)); 89 | #endregion 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /DMSkin.WPF/Styles/DMCheckBox.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMScrollViewer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Media; 8 | 9 | namespace DMSkin.WPF.Controls 10 | { 11 | /// 12 | /// 拥有 颜色 圆角值 属性的 滚动容器 13 | /// 14 | public class DMScrollViewer: ScrollViewer 15 | { 16 | #region 滑块默认颜色 17 | public SolidColorBrush ThemeColor 18 | { 19 | get { return (SolidColorBrush)GetValue(ThemeColorProperty); } 20 | set { SetValue(ThemeColorProperty, value); } 21 | } 22 | /// 23 | /// 滑块默认颜色 24 | /// 25 | public static readonly DependencyProperty ThemeColorProperty = 26 | DependencyProperty.Register("ThemeColor", typeof(SolidColorBrush), typeof(DMScrollViewer), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 200, 200, 200)))); 27 | #endregion 28 | 29 | #region 滑块悬浮颜色 30 | public SolidColorBrush ThemeColorMouseOver 31 | { 32 | get { return (SolidColorBrush)GetValue(ThemeColorMouseOverProperty); } 33 | set { SetValue(ThemeColorMouseOverProperty, value); } 34 | } 35 | /// 36 | /// 滑块悬浮颜色 37 | /// 38 | public static readonly DependencyProperty ThemeColorMouseOverProperty = 39 | DependencyProperty.Register("ThemeColorMouseOver", typeof(SolidColorBrush), typeof(DMScrollViewer), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 180, 180, 180)))); 40 | #endregion 41 | 42 | #region 滑块悬浮按下颜色 43 | public SolidColorBrush ThemeColorPressed 44 | { 45 | get { return (SolidColorBrush)GetValue(ThemeColorPressedProperty); } 46 | set { SetValue(ThemeColorPressedProperty, value); } 47 | } 48 | /// 49 | /// 滑块悬浮按下颜色 50 | /// 51 | public static readonly DependencyProperty ThemeColorPressedProperty = 52 | DependencyProperty.Register("ThemeColorPressed", typeof(SolidColorBrush), typeof(DMScrollViewer), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 180, 180, 180)))); 53 | #endregion 54 | 55 | #region 圆角值X 56 | /// 57 | /// 圆角值X 58 | /// 59 | public double RadiusX 60 | { 61 | get { return (double)GetValue(RadiusXProperty); } 62 | set { SetValue(RadiusXProperty, value); } 63 | } 64 | public static readonly DependencyProperty RadiusXProperty = 65 | DependencyProperty.Register("RadiusX", typeof(double), typeof(DMScrollViewer), new PropertyMetadata(2.0)); 66 | #endregion 67 | 68 | #region 圆角值Y 69 | /// 70 | /// 圆角值Y 71 | /// 72 | public double RadiusY 73 | { 74 | get { return (double)GetValue(RadiusYProperty); } 75 | set { SetValue(RadiusYProperty, value); } 76 | } 77 | public static readonly DependencyProperty RadiusYProperty = 78 | DependencyProperty.Register("RadiusY", typeof(double), typeof(DMScrollViewer), new PropertyMetadata(2.0)); 79 | #endregion 80 | 81 | #region 滚动条大小 82 | /// 83 | /// 滚动条大小 84 | /// 85 | public double ScrollBarSize 86 | { 87 | get { return (double)GetValue(ScrollBarSizeProperty); } 88 | set { SetValue(ScrollBarSizeProperty, value); } 89 | } 90 | public static readonly DependencyProperty ScrollBarSizeProperty = 91 | DependencyProperty.Register("ScrollBarSize", typeof(double), typeof(DMScrollViewer), new PropertyMetadata(6.0)); 92 | #endregion 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/DMSystemButton.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace DMSkin.WPF.Controls 7 | { 8 | public class DMSystemButton : Button 9 | { 10 | [Description("窗体系统按钮大小"), Category("DMSkin")] 11 | public double DMSystemButtonSize 12 | { 13 | get { return (double)GetValue(DMSystemButtonSizeProperty); } 14 | set { SetValue(DMSystemButtonSizeProperty, value); } 15 | } 16 | public static readonly DependencyProperty DMSystemButtonSizeProperty = 17 | DependencyProperty.Register("DMSystemButtonSize", typeof(double), typeof(DMSystemButton), new PropertyMetadata(30.0)); 18 | 19 | [Description("窗体系统按钮鼠标悬浮背景颜色"), Category("DMSkin")] 20 | public SolidColorBrush DMSystemButtonHoverColor 21 | { 22 | get { return (SolidColorBrush)GetValue(DMSystemButtonHoverColorProperty); } 23 | set { SetValue(DMSystemButtonHoverColorProperty, value); } 24 | } 25 | public static readonly DependencyProperty DMSystemButtonHoverColorProperty = 26 | DependencyProperty.Register("DMSystemButtonHoverColor", typeof(SolidColorBrush), typeof(DMSystemButton), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(50, 50, 50, 50)))); 27 | 28 | 29 | 30 | [Description("窗体系统按钮颜色"), Category("DMSkin")] 31 | public SolidColorBrush DMSystemButtonForeground 32 | { 33 | get { return (SolidColorBrush)GetValue(DMSystemButtonForegroundProperty); } 34 | set { SetValue(DMSystemButtonForegroundProperty, value); } 35 | } 36 | public static readonly DependencyProperty DMSystemButtonForegroundProperty = 37 | DependencyProperty.Register("DMSystemButtonForeground", typeof(SolidColorBrush), typeof(DMSystemButton), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)))); 38 | 39 | 40 | 41 | [Description("窗体系统按钮鼠标悬按钮颜色"), Category("DMSkin")] 42 | public SolidColorBrush DMSystemButtonHoverForeground 43 | { 44 | get { return (SolidColorBrush)GetValue(DMSystemButtonHoverForegroundProperty); } 45 | set { SetValue(DMSystemButtonHoverForegroundProperty, value); } 46 | } 47 | public static readonly DependencyProperty DMSystemButtonHoverForegroundProperty = 48 | DependencyProperty.Register("DMSystemButtonHoverForeground", typeof(SolidColorBrush), typeof(DMSystemButton), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)))); 49 | 50 | 51 | /// 52 | /// 图标 53 | /// 54 | [Description("图标"), Category("DMSkin")] 55 | public Geometry Icon 56 | { 57 | get { return (Geometry)GetValue(IconProperty); } 58 | set { SetValue(IconProperty, value); } 59 | } 60 | public static readonly DependencyProperty IconProperty = 61 | DependencyProperty.Register("Icon", typeof(Geometry), typeof(DMSystemButton), new PropertyMetadata(null)); 62 | 63 | /// 64 | /// 图标宽度 65 | /// 66 | public double IconWidth 67 | { 68 | get { return (double)GetValue(IconWidthProperty); } 69 | set { SetValue(IconWidthProperty, value); } 70 | } 71 | public static readonly DependencyProperty IconWidthProperty = 72 | DependencyProperty.Register("IconWidth", typeof(double), typeof(DMSystemButton), new PropertyMetadata(15.0)); 73 | 74 | /// 75 | /// 图标高度 76 | /// 77 | public double IconHeight 78 | { 79 | get { return (double)GetValue(IconHeightProperty); } 80 | set { SetValue(IconHeightProperty, value); } 81 | } 82 | public static readonly DependencyProperty IconHeightProperty = 83 | DependencyProperty.Register("IconHeight", typeof(double), typeof(DMSystemButton), new PropertyMetadata(15.0)); 84 | 85 | 86 | 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /DMSkin.Core/DMSkin.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {13DA6558-356B-47B9-96F2-FE4D5457CB02} 8 | Library 9 | Properties 10 | DMSkin.Core 11 | DMSkin.Core 12 | v4.0 13 | 512 14 | true 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | false 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | false 35 | 36 | 37 | true 38 | bin\x86\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x86 42 | prompt 43 | MinimumRecommendedRules.ruleset 44 | false 45 | 46 | 47 | bin\x86\Release\ 48 | TRACE 49 | true 50 | pdbonly 51 | x86 52 | prompt 53 | MinimumRecommendedRules.ruleset 54 | false 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageScrollViewer.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 32 | 33 | 34 | 35 | 36 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 52 | 53 | 54 | 55 | 56 | 61 | 62 | 63 | 64 | 76 | 77 | 81 | 82 | 83 | 95 | 99 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /DMSkin.WPF/Controls/ElasticWrapPanel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace DMSkin.WPF.Controls 6 | { 7 | public class ElasticWrapPanel : Panel 8 | { 9 | /// 10 | /// Identifies the dependency property. 11 | /// 12 | internal static readonly DependencyProperty DesiredColumnWidthProperty = 13 | DependencyProperty.Register("DesiredColumnWidth", typeof (double), typeof (ElasticWrapPanel), 14 | new PropertyMetadata(230d, OnDesiredColumnWidthChanged)); 15 | 16 | /// 17 | /// The panel's number of columns 18 | /// 19 | private int _columns; 20 | 21 | /// 22 | /// The desired column width 23 | /// 24 | public double DesiredColumnWidth 25 | { 26 | private get { return (double) GetValue(DesiredColumnWidthProperty); } 27 | set { SetValue(DesiredColumnWidthProperty, value); } 28 | } 29 | 30 | /// 31 | /// Calculate the available space for each column 32 | /// 33 | /// availableSize 34 | /// Computed overrided size 35 | protected override Size MeasureOverride(Size availableSize) 36 | { 37 | if (availableSize.Height.Equals(0)) 38 | availableSize.Height = MaxHeight; 39 | 40 | _columns = (int) (availableSize.Width/DesiredColumnWidth); 41 | 42 | foreach (UIElement child in Children) 43 | child.Measure(availableSize); 44 | 45 | return base.MeasureOverride(availableSize); 46 | } 47 | 48 | /// 49 | /// Calculate the size of each column to organize their location 50 | /// 51 | /// finalSize 52 | /// Computed arranged size 53 | protected override Size ArrangeOverride(Size finalSize) 54 | { 55 | if (_columns == 0) return base.ArrangeOverride(finalSize); 56 | var columnWidth = Math.Floor(finalSize.Width/_columns); 57 | var totalHeight = 0d; 58 | var top = 0d; 59 | var rowHeight = 0d; 60 | var overflow = 0d; 61 | var column = 0; 62 | var index = 0; 63 | var overflowAlreadyCount = false; 64 | 65 | foreach (UIElement child in Children) 66 | { 67 | // Compute the tile size and position 68 | child.Arrange(new Rect(columnWidth*column, top, columnWidth, child.DesiredSize.Height)); 69 | column++; 70 | rowHeight = Children.Count >= _columns 71 | ? Math.Max(rowHeight, child.DesiredSize.Height) 72 | : Math.Min(rowHeight, child.DesiredSize.Height); 73 | index++; 74 | 75 | // Check if the current element is at the end of a row and add an height overflow to get enough space for the next elements of the second row 76 | if (column == _columns && Children.Count != index && (Children.Count - index + 1) <= _columns && 77 | !overflowAlreadyCount) 78 | { 79 | overflow = rowHeight; 80 | totalHeight += rowHeight; 81 | overflowAlreadyCount = true; 82 | } 83 | else 84 | { 85 | if (!overflowAlreadyCount) 86 | totalHeight += rowHeight; 87 | } 88 | 89 | if (column != _columns) continue; 90 | column = 0; 91 | top += rowHeight; 92 | rowHeight = 0; 93 | } 94 | 95 | if (Children.Count >= _columns) 96 | totalHeight = totalHeight/_columns + overflow; 97 | 98 | Height = totalHeight; 99 | finalSize.Height = totalHeight; 100 | return base.ArrangeOverride(finalSize); 101 | } 102 | 103 | /// 104 | /// Inform when DesiredColumnWidthProperty has changed 105 | /// 106 | /// e 107 | /// obj 108 | private static void OnDesiredColumnWidthChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) 109 | { 110 | var panel = (ElasticWrapPanel) obj; 111 | panel.InvalidateMeasure(); 112 | panel.InvalidateArrange(); 113 | } 114 | } 115 | } -------------------------------------------------------------------------------- /DMSkin.WPF.Demos/Views/PageAntDesign.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 52 | 53 | 54 | 55 | 56 | 61 | 62 | 63 | 64 | 65 |