├── doc └── AduSkin编码规范.docx ├── screenshot ├── Cover.jpg ├── Cover (1).png ├── Cover (2).png ├── Cover (3).png ├── other │ └── zhifu.jpg └── project │ ├── azai.png │ ├── AduMusic.jpg │ ├── Shadow.png │ ├── aduchat.gif │ ├── SuperEvil.png │ └── AduShopping.gif ├── src ├── AduSkin.Demo │ ├── logo.ico │ ├── logo.png │ ├── Resources │ │ ├── pic.jpg │ │ ├── aduskin.png │ │ ├── github.png │ │ ├── tabIcon.png │ │ ├── editIcon.png │ │ ├── Img │ │ │ └── Header │ │ │ │ ├── 头像1.png │ │ │ │ ├── 头像2.png │ │ │ │ ├── 头像3.png │ │ │ │ ├── 头像4.png │ │ │ │ ├── 头像5.png │ │ │ │ └── 头像6.png │ │ └── titleMuenIcon.png │ ├── Servers │ │ ├── Contracts │ │ │ └── IWindow.cs │ │ ├── Extensions │ │ │ └── ServiceCollectionExtensions.cs │ │ └── ApplicationHostService.cs │ ├── Models │ │ ├── NoticeInfo.cs │ │ ├── Carousel.cs │ │ ├── DemoModel.cs │ │ ├── CompanyModel.cs │ │ ├── ChatUserModel.cs │ │ ├── SupportUser.cs │ │ ├── Sys_Code.cs │ │ └── ControlModel.cs │ ├── Views │ │ ├── PracticalCase.xaml.cs │ │ ├── AduVideoDemo.xaml.cs │ │ ├── AduSkinAbout.xaml.cs │ │ ├── AduSkinSupport.xaml.cs │ │ └── AduVideoDemo.xaml │ ├── Data │ │ ├── ControlToken.cs │ │ └── Enum │ │ │ └── AduEnums.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── MainWindow.xaml.cs │ ├── Style │ │ └── Converter.xaml │ ├── UserControls │ │ ├── Tools │ │ │ ├── BaiduTranslate.xaml │ │ │ ├── HttpTool.xaml.cs │ │ │ └── BaiduTranslate.xaml.cs │ │ └── Demos │ │ │ ├── MessageBoxDemo.xaml.cs │ │ │ ├── TimeBarDemo.xaml.cs │ │ │ ├── ImageTool.xaml.cs │ │ │ ├── NoticeDemo.xaml.cs │ │ │ ├── TimeBarDemo.xaml │ │ │ ├── DataGridDemo.xaml.cs │ │ │ ├── StepBarDemo.xaml.cs │ │ │ ├── VideoPlayer.xaml.cs │ │ │ ├── ContextMenuDemo.xaml.cs │ │ │ ├── NavigationPanel.xaml.cs │ │ │ ├── RunningBlockDemo.xaml.cs │ │ │ ├── TreeMenu.xaml │ │ │ ├── MultiFunctionTabControl.xaml.cs │ │ │ ├── FormVerificationDemo.xaml.cs │ │ │ ├── TransitioningContentControlDemo.xaml.cs │ │ │ ├── SortGroup.xaml.cs │ │ │ ├── CoverFlowDemo.xaml.cs │ │ │ ├── CoverFlowDemo.xaml │ │ │ ├── RunningBlockDemo.xaml │ │ │ ├── VideoPlayer.xaml │ │ │ ├── TimeLine.xaml.cs │ │ │ ├── ImageTool.xaml │ │ │ ├── CarouselContainer.xaml.cs │ │ │ ├── FormVerificationDemo.xaml │ │ │ ├── StepBarDemo.xaml │ │ │ ├── ExpanderMenu.xaml.cs │ │ │ ├── MessageBoxDemo.xaml │ │ │ ├── NoticeDemo.xaml │ │ │ ├── UploadPic.xaml.cs │ │ │ └── MultiFunctionTabControl.xaml │ ├── ViewModel │ │ ├── ModuleViewModel │ │ │ └── AduSkinAboutViewModel.cs │ │ └── DemoViewModel │ │ │ ├── RunningBlockViewModel.cs │ │ │ ├── StepBarDemoVM.cs │ │ │ ├── FormVerificationDemoViewModel.cs │ │ │ ├── MessageBoxDemoViewModel.cs │ │ │ └── NoticeDemoViewModel.cs │ ├── App.xaml │ ├── Converter │ │ └── StringRepeatConverter.cs │ └── App.xaml.cs ├── AduSkin │ ├── Resources │ │ ├── logo.ico │ │ └── logo.png │ ├── Interactivity │ │ ├── TagType.cs │ │ ├── FluidMoveScope.cs │ │ ├── PreviewInvokeEventArgs.cs │ │ ├── IAttachedObject.cs │ │ ├── Behavior!1.cs │ │ ├── TypeConstraintAttribute.cs │ │ ├── NameResolvedEventArgs.cs │ │ ├── TriggerAction!1.cs │ │ ├── EventTriggerBase!1.cs │ │ ├── EventTrigger.cs │ │ ├── RoutedEventTrigger.cs │ │ ├── BehaviorCollection.cs │ │ ├── TriggerCollection.cs │ │ ├── AdornerContainer.cs │ │ ├── IEventArgsConverter.cs │ │ ├── TriggerActionCollection.cs │ │ ├── DefaultTriggerAttribute.cs │ │ └── TransitionEffect.cs │ ├── Controls │ │ ├── Metro │ │ │ ├── Cover │ │ │ │ └── CoverView │ │ │ │ │ └── AduCoverViewItem.cs │ │ │ ├── Base │ │ │ │ ├── ISelectable.cs │ │ │ │ ├── AduButtonBase.cs │ │ │ │ ├── HeaderedSelectableItem.cs │ │ │ │ └── RegularItemsControl.cs │ │ │ ├── AduSlider.cs │ │ │ ├── AduGroupBox.cs │ │ │ ├── MetroGroupBox.cs │ │ │ ├── MetroTextButton.cs │ │ │ ├── AduToggleButton.cs │ │ │ ├── MetroContextMenu.cs │ │ │ ├── MetroMenuSeparator.cs │ │ │ ├── AduTabItem.cs │ │ │ ├── AduCheckBox.cs │ │ │ ├── AduExpander.cs │ │ │ ├── AduRadioButton.cs │ │ │ ├── AduNoExpander.cs │ │ │ ├── AduRadioButtonIcon.cs │ │ │ ├── AduTitleMenuItem.cs │ │ │ ├── AduButtonSvg.cs │ │ │ ├── AduFlatRadionButton.cs │ │ │ ├── AduIndexRadionButton.cs │ │ │ ├── MetroTitleMenu.cs │ │ │ ├── MetroTitleMenuItem.cs │ │ │ ├── AduButtonIcon.cs │ │ │ ├── MetroComboBoxItem.cs │ │ │ ├── AduTreeView.cs │ │ │ ├── AduDataGrid.cs │ │ │ ├── AduContextMenuButton.cs │ │ │ ├── AduPathIconButton.cs │ │ │ ├── MetroPath.cs │ │ │ ├── MetroTabItem.cs │ │ │ ├── StepBar │ │ │ │ └── AduStepBarItem.cs │ │ │ ├── AduTabControl.cs │ │ │ ├── AduStatusIcon.cs │ │ │ ├── MetroMenuItem.cs │ │ │ ├── MetroTabControl.cs │ │ │ ├── MetroButton.cs │ │ │ ├── MetroWebBrowser.xaml │ │ │ ├── MetroBorder.cs │ │ │ ├── MetroComboBox.cs │ │ │ ├── NumericUpDown │ │ │ │ ├── AduNumericUpDownBase.cs │ │ │ │ ├── AduIntegerUpDown.cs │ │ │ │ └── AduDoubleUpDown.cs │ │ │ ├── MetroTextBlock.cs │ │ │ ├── DatePickers │ │ │ │ ├── AduTimeButton.cs │ │ │ │ └── AduCalendarButton.cs │ │ │ ├── AduButtonRemind.cs │ │ │ ├── AduSimplePanel.cs │ │ │ ├── AduSpeTextBlock.cs │ │ │ ├── MetroCanvasGrid.cs │ │ │ ├── Badge │ │ │ │ └── AduBadge.cs │ │ │ ├── AduShield.cs │ │ │ ├── MetroWebBrowser.xaml.cs │ │ │ ├── TextBlock │ │ │ │ └── TextBlockHighlightSourceConverter.cs │ │ │ ├── MetroVisualElement.cs │ │ │ └── MetroSwitch.cs │ │ ├── Helper │ │ │ ├── ColorHelper.cs │ │ │ ├── ScrollViewerBehavior.cs │ │ │ ├── ExtensionMethod.cs │ │ │ ├── ValidateHelper.cs │ │ │ └── ChoosePathHelper.cs │ │ ├── Data │ │ │ ├── Args │ │ │ │ ├── CancelRoutedEventArgs.cs │ │ │ │ └── FunctionEventArgs1.cs │ │ │ └── ValueBoxes.cs │ │ ├── Converter │ │ │ ├── EnumToBooleanConverter.cs │ │ │ ├── StringToVisibility.cs │ │ │ ├── EnumConverter.cs │ │ │ ├── StringIsEmptyConverter.cs │ │ │ ├── NullToVisibilityConverter.cs │ │ │ ├── DoubleToPercentageConverter.cs │ │ │ ├── CornerRadiusToDouble.cs │ │ │ ├── BoolReverseConverter.cs │ │ │ ├── DoubleToCornerRadius.cs │ │ │ ├── IsLastItemConverter.cs │ │ │ ├── NumberConverter.cs │ │ │ ├── IndentConverter.cs │ │ │ ├── BoolToVisibility.cs │ │ │ ├── OffsetConverter.cs │ │ │ ├── DoubleFactor.cs │ │ │ ├── IsProgressedConverter.cs │ │ │ └── CalendarDayButtonTypeConverter.cs │ │ ├── Tools │ │ │ ├── Helper │ │ │ │ ├── DesignerHelper.cs │ │ │ │ ├── SecurityHelper.cs │ │ │ │ ├── AnimationHelper.cs │ │ │ │ ├── ResourceHelper.cs │ │ │ │ └── VisualHelper.cs │ │ │ ├── Interop │ │ │ │ ├── CommonHandles.cs │ │ │ │ ├── WpfSafeHandle.cs │ │ │ │ ├── IconHandle.cs │ │ │ │ ├── BitmapHandle.cs │ │ │ │ └── SafeFileMappingHandle.cs │ │ │ └── Extension │ │ │ │ └── GeometryExtension.cs │ │ └── Attach │ │ │ └── InputAttach.cs │ ├── Themes │ │ ├── Generic.xaml │ │ ├── Metro │ │ │ ├── MetroComboBoxItem.xaml │ │ │ ├── DefaultControl.xaml │ │ │ ├── MetroWaterfallFlow.xaml │ │ │ ├── MetroMenuSeparator.xaml │ │ │ ├── StepBar │ │ │ │ └── AduStepBar.xaml │ │ │ ├── MetroPath.xaml │ │ │ ├── MetroTitleMenu.xaml │ │ │ ├── RatingBar │ │ │ │ └── AduRatingBarButton.xaml │ │ │ └── MetroGroupBox.xaml │ │ ├── Opacity.xaml │ │ ├── Effects.xaml │ │ └── Converters.xaml │ ├── Commen │ │ └── ExternDll.cs │ ├── Utility │ │ ├── Computer │ │ │ └── TaskBarPostion.cs │ │ ├── Element │ │ │ └── VisualObj.cs │ │ ├── AduMethod │ │ │ └── DateTimeHelper.cs │ │ ├── Media │ │ │ ├── StreamObj.cs │ │ │ └── ResObj.cs │ │ └── Resource │ │ │ └── ResourceUtility.cs │ ├── AduSkin.csproj │ └── Properties │ │ └── AssemblyInfo.cs └── AduVideoPlayer │ ├── Properties │ └── AssemblyInfo.cs │ ├── Controls │ └── VideoInfo.cs │ └── AduVideoPlayer.csproj ├── .editorconfig └── .github └── FUNDING.yml /doc/AduSkin编码规范.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/doc/AduSkin编码规范.docx -------------------------------------------------------------------------------- /screenshot/Cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/Cover.jpg -------------------------------------------------------------------------------- /screenshot/Cover (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/Cover (1).png -------------------------------------------------------------------------------- /screenshot/Cover (2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/Cover (2).png -------------------------------------------------------------------------------- /screenshot/Cover (3).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/Cover (3).png -------------------------------------------------------------------------------- /screenshot/other/zhifu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/other/zhifu.jpg -------------------------------------------------------------------------------- /src/AduSkin.Demo/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/logo.ico -------------------------------------------------------------------------------- /src/AduSkin.Demo/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/logo.png -------------------------------------------------------------------------------- /screenshot/project/azai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/project/azai.png -------------------------------------------------------------------------------- /screenshot/project/AduMusic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/project/AduMusic.jpg -------------------------------------------------------------------------------- /screenshot/project/Shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/project/Shadow.png -------------------------------------------------------------------------------- /screenshot/project/aduchat.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/project/aduchat.gif -------------------------------------------------------------------------------- /src/AduSkin/Resources/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin/Resources/logo.ico -------------------------------------------------------------------------------- /src/AduSkin/Resources/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin/Resources/logo.png -------------------------------------------------------------------------------- /screenshot/project/SuperEvil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/project/SuperEvil.png -------------------------------------------------------------------------------- /screenshot/project/AduShopping.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/screenshot/project/AduShopping.gif -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/pic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/pic.jpg -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/aduskin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/aduskin.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/github.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/tabIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/tabIcon.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/editIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/editIcon.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/Img/Header/头像1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/Img/Header/头像1.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/Img/Header/头像2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/Img/Header/头像2.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/Img/Header/头像3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/Img/Header/头像3.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/Img/Header/头像4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/Img/Header/头像4.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/Img/Header/头像5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/Img/Header/头像5.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/Img/Header/头像6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/Img/Header/头像6.png -------------------------------------------------------------------------------- /src/AduSkin.Demo/Resources/titleMuenIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aduskin/AduSkin/HEAD/src/AduSkin.Demo/Resources/titleMuenIcon.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | indent_style = space 3 | indent_size = 3 4 | charset = utf-8 5 | 6 | [.csproj] 7 | indent_size = 4 8 | 9 | [.md] 10 | indent_size = 4 -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/TagType.cs: -------------------------------------------------------------------------------- 1 | namespace AduSkin.Interactivity 2 | { 3 | public enum TagType 4 | { 5 | Element, 6 | DataContext 7 | } 8 | } -------------------------------------------------------------------------------- /src/AduVideoPlayer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] 4 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/FluidMoveScope.cs: -------------------------------------------------------------------------------- 1 | namespace AduSkin.Interactivity 2 | { 3 | public enum FluidMoveScope 4 | { 5 | Self, 6 | Children 7 | } 8 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/Cover/CoverView/AduCoverViewItem.cs: -------------------------------------------------------------------------------- 1 | namespace AduSkin.Controls.Metro 2 | { 3 | public class AduCoverViewItem : HeaderedSelectableItem 4 | { 5 | internal int Index { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/PreviewInvokeEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AduSkin.Interactivity 4 | { 5 | public class PreviewInvokeEventArgs : EventArgs 6 | { 7 | public bool Cancelling { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Servers/Contracts/IWindow.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AduSkin.Demo.Servers.Contracts 4 | { 5 | public interface IWindow 6 | { 7 | event RoutedEventHandler Loaded; 8 | 9 | void Show(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [aduskin] 4 | patreon: aduskin 5 | open_collective: AduSkin 6 | ko_fi: aduskin 7 | tidelift: npm/cdn 8 | issuehunt: aduskin 9 | custom: custom: ["https://paypal.me/aduskin3821", 杜召] 10 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/Base/ISelectable.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AduSkin.Controls.Metro 4 | { 5 | public interface ISelectable 6 | { 7 | event RoutedEventHandler Selected; 8 | 9 | bool IsSelected { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/IAttachedObject.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AduSkin.Interactivity 4 | { 5 | public interface IAttachedObject 6 | { 7 | void Attach(DependencyObject dependencyObject); 8 | void Detach(); 9 | 10 | DependencyObject AssociatedObject { get; } 11 | } 12 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduSlider.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class AduSlider : Slider 7 | { 8 | static AduSlider() 9 | { 10 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduGroupBox.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class AduGroupBox : GroupBox 7 | { 8 | static AduGroupBox() 9 | { 10 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/Base/AduButtonBase.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Controls.Primitives; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro.Base 7 | { 8 | public class AduButtonBase : Button 9 | { 10 | #region AduSkin 11 | 12 | #endregion 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroGroupBox.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class MetroGroupBox : GroupBox 7 | { 8 | static MetroGroupBox() 9 | { 10 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/Behavior!1.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AduSkin.Interactivity 4 | { 5 | public abstract class Behavior : Behavior where T : DependencyObject 6 | { 7 | protected Behavior() : base(typeof(T)) 8 | { 9 | } 10 | 11 | protected new T AssociatedObject => (T)base.AssociatedObject; 12 | } 13 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroTextButton.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class MetroTextButton : Button 7 | { 8 | static MetroTextButton() 9 | { 10 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Models/NoticeInfo.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace AduSkin.Demo.Models 3 | { 4 | public class NoticeInfo 5 | { 6 | public string Title { get; set; } 7 | public string Content { get; set; } 8 | /// 9 | /// Type的值只能为Info、Success、Warn、Error 10 | /// 11 | public string Type { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Views/PracticalCase.xaml.cs: -------------------------------------------------------------------------------- 1 | 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Demo.Views 5 | { 6 | /// 7 | /// PracticalCase.xaml 的交互逻辑 8 | /// 9 | public partial class PracticalCase : UserControl 10 | { 11 | public PracticalCase() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduToggleButton.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls.Primitives; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class AduToggleButton : ToggleButton 7 | { 8 | static AduToggleButton() 9 | { 10 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroContextMenu.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class MetroContextMenu : ContextMenu 7 | { 8 | static MetroContextMenu() 9 | { 10 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroMenuSeparator.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class MetroMenuSeparator : Separator 7 | { 8 | static MetroMenuSeparator() 9 | { 10 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduTabItem.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class AduTabItem : TabItem 9 | { 10 | static AduTabItem() 11 | { 12 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Models/Carousel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AduSkin.Demo.Models 8 | { 9 | public class Carousel 10 | { 11 | public string name { get; set; } 12 | public string imgpath { get; set; } 13 | public string info { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduCheckBox.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class AduCheckBox : CheckBox 9 | { 10 | static AduCheckBox() 11 | { 12 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduExpander.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class AduExpander : Expander 9 | { 10 | static AduExpander() 11 | { 12 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduRadioButton.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class AduRadioButton : RadioButton 9 | { 10 | static AduRadioButton() 11 | { 12 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduNoExpander.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class AduNoExpander : Expander 9 | { 10 | static AduNoExpander() 11 | { 12 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduRadioButtonIcon.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class AduRadioButtonIcon : RadioButton 9 | { 10 | static AduRadioButtonIcon() 11 | { 12 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduTitleMenuItem.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class AduTitleMenuItem : MenuItem 7 | { 8 | public AduTitleMenuItem() 9 | { 10 | 11 | } 12 | static AduTitleMenuItem() 13 | { 14 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/TypeConstraintAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AduSkin.Interactivity 4 | { 5 | [AttributeUsage(AttributeTargets.Class, Inherited = false)] 6 | public sealed class TypeConstraintAttribute : Attribute 7 | { 8 | public TypeConstraintAttribute(Type constraint) 9 | { 10 | Constraint = constraint; 11 | } 12 | 13 | public Type Constraint { get; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Data/ControlToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AduSkin.Demo.Data 8 | { 9 | public class ControlToken 10 | { 11 | //窗口 12 | //控件 13 | public static readonly string SortGroup = nameof(SortGroup); 14 | 15 | public static readonly string UploadPic = nameof(UploadPic); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduButtonSvg.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Metro.Base; 2 | using AduSkin.Utility.Element; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | 7 | public class AduButtonSvg : AduButtonBase 8 | { 9 | public AduButtonSvg() 10 | { 11 | 12 | } 13 | 14 | static AduButtonSvg() 15 | { 16 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduFlatRadionButton.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class AduFlatRadionButton: RadioButton 7 | { 8 | static AduFlatRadionButton() 9 | { 10 | DefaultStyleKeyProperty.OverrideMetadata(typeof(AduFlatRadionButton), new FrameworkPropertyMetadata(typeof(AduFlatRadionButton))); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduIndexRadionButton.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class AduIndexRadionButton : RadioButton 7 | { 8 | static AduIndexRadionButton() 9 | { 10 | DefaultStyleKeyProperty.OverrideMetadata(typeof(AduIndexRadionButton), new FrameworkPropertyMetadata(typeof(AduIndexRadionButton))); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroTitleMenu.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class MetroTitleMenu : Menu 7 | { 8 | public MetroTitleMenu() 9 | { 10 | 11 | } 12 | 13 | static MetroTitleMenu() 14 | { 15 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroTitleMenuItem.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.ComponentModel; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Media; 6 | 7 | namespace AduSkin.Controls.Metro 8 | { 9 | public class MetroTitleMenuItem : MenuItem 10 | { 11 | static MetroTitleMenuItem() 12 | { 13 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | 4 | [assembly: ThemeInfo( 5 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置 6 | //(当资源未在页面 7 | //或应用程序资源字典中找到时使用) 8 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 9 | //(当资源未在页面 10 | //、应用程序或任何主题专用资源字典中找到时使用) 11 | )] 12 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduButtonIcon.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Metro.Base; 2 | using AduSkin.Utility.Element; 3 | using System.Windows; 4 | using System.Windows.Controls.Primitives; 5 | using System.Windows.Media; 6 | 7 | namespace AduSkin.Controls.Metro 8 | { 9 | public class AduButtonIcon : AduButtonBase 10 | { 11 | static AduButtonIcon() 12 | { 13 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Models/DemoModel.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace AduSkin.Demo.Models 3 | { 4 | public class DemoModel 5 | { 6 | public int ID { get; set; } 7 | public string Cover { get; set; } 8 | public string Name { get; set; } 9 | public string BlogDate { get; set; } 10 | public string Likes { get; set; } 11 | public string Shares { get; set; } 12 | public string Link { get; set; } 13 | public string Describe { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/AduSkin/Commen/ExternDll.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AduSkin.Commen 8 | { 9 | internal static class ExternDll 10 | { 11 | public const string 12 | User32 = "user32.dll", 13 | Gdi32 = "gdi32.dll", 14 | Kernel32 = "kernel32.dll", 15 | Shell32 = "shell32.dll", 16 | DwmApi = "dwmapi.dll"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroComboBoxItem.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class MetroComboBoxItem : ComboBoxItem 7 | { 8 | public MetroComboBoxItem() 9 | { 10 | 11 | } 12 | 13 | static MetroComboBoxItem() 14 | { 15 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/NameResolvedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AduSkin.Interactivity 4 | { 5 | internal sealed class NameResolvedEventArgs : EventArgs 6 | { 7 | public NameResolvedEventArgs(object oldObject, object newObject) 8 | { 9 | OldObject = oldObject; 10 | NewObject = newObject; 11 | } 12 | 13 | public object NewObject { get; } 14 | 15 | public object OldObject { get; } 16 | } 17 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduTreeView.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Controls; 8 | 9 | namespace AduSkin.Controls.Metro 10 | { 11 | public class AduTreeView : TreeView 12 | { 13 | static AduTreeView() 14 | { 15 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Metro/MetroComboBoxItem.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Helper/ColorHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Media; 7 | 8 | namespace AduSkin.Controls.Helper 9 | { 10 | public class ColorHelper 11 | { 12 | public static Color ToColor(uint c) 13 | { 14 | var bytes = BitConverter.GetBytes(c); 15 | return Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Models/CompanyModel.cs: -------------------------------------------------------------------------------- 1 | 2 | using System.Collections.ObjectModel; 3 | 4 | namespace AduSkin.Demo.Models 5 | { 6 | public class CompanyModel 7 | { 8 | public bool IsGrouping { get; set; } 9 | public ObservableCollection Children { get; set; } 10 | public string DisplayName { get; set; } 11 | public string SurName { get; set; } 12 | public string Name { get; set; } 13 | public string Info { get; set; } 14 | public string State { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Data/Args/CancelRoutedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace AduSkin.Controls.Data.Args 9 | { 10 | public class CancelRoutedEventArgs : RoutedEventArgs 11 | { 12 | public CancelRoutedEventArgs(RoutedEvent routedEvent, object source) : base(routedEvent, source) 13 | { 14 | } 15 | 16 | public bool Cancel { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Metro; 2 | using AduSkin.Demo.Servers.Contracts; 3 | using AduSkin.Demo.ViewModel; 4 | using System; 5 | using System.Windows; 6 | 7 | namespace AduSkin.Demo 8 | { 9 | public partial class MainWindow : MetroWindow, IWindow 10 | { 11 | public MainWindow(MainViewModel viewModel) 12 | { 13 | InitializeComponent(); 14 | this.DataContext = viewModel; 15 | this.Closed += delegate { Application.Current.Shutdown(); }; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduDataGrid.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Controls.Primitives; 5 | using System.Windows.Media; 6 | 7 | namespace AduSkin.Controls.Metro 8 | { 9 | 10 | public class AduDataGrid : DataGrid 11 | { 12 | public AduDataGrid() 13 | { 14 | 15 | } 16 | 17 | static AduDataGrid() 18 | { 19 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Views/AduVideoDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Metro; 2 | using System; 3 | 4 | namespace AduSkin.Demo.Views 5 | { 6 | /// 7 | /// AduSkinDemo.xaml 的交互逻辑 8 | /// 9 | public partial class AduVideoDemo : AduWindow 10 | { 11 | public AduVideoDemo() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | private void AduWindow_Closed(object sender, EventArgs e) 17 | { 18 | if(videoPlayer.IsPlaying) 19 | this.videoPlayer.Stop(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Metro/DefaultControl.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 10 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Data/Enum/AduEnums.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AduSkin.Demo.Data.Enum 8 | { 9 | public enum DemoType 10 | { 11 | Demo, 12 | Tool 13 | } 14 | 15 | public enum ControlState 16 | { 17 | New, 18 | InDev, 19 | Nor 20 | } 21 | 22 | public enum SupportType 23 | { 24 | //技术 25 | Skill, 26 | //打赏 27 | Money, 28 | //推荐 29 | Recommend, 30 | //推广 31 | Extension 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/TriggerAction!1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace AduSkin.Interactivity 5 | { 6 | public abstract class TriggerAction : TriggerAction where T : DependencyObject 7 | { 8 | protected TriggerAction() : base(typeof(T)) 9 | { 10 | } 11 | 12 | #pragma warning disable 108,114 13 | protected T AssociatedObject => (T)base.AssociatedObject; 14 | #pragma warning restore 108,114 15 | 16 | protected sealed override Type AssociatedObjectTypeConstraint => 17 | base.AssociatedObjectTypeConstraint; 18 | } 19 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Data/Args/FunctionEventArgs1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace AduSkin.Controls.Data 9 | { 10 | public class FunctionEventArgs : RoutedEventArgs 11 | { 12 | public FunctionEventArgs(T info) 13 | { 14 | Info = info; 15 | } 16 | 17 | public FunctionEventArgs(RoutedEvent routedEvent, object source) : base(routedEvent, source) 18 | { 19 | } 20 | 21 | public T Info { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduContextMenuButton.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | /// 7 | /// 带上下文菜单的按钮 8 | /// 9 | public class AduContextMenuButton : AduPathIconButton 10 | { 11 | public MetroContextMenu Menu { get; set; } 12 | 13 | protected override void OnClick() 14 | { 15 | base.OnClick(); 16 | if (Menu != null) 17 | { 18 | Menu.PlacementTarget = this; 19 | Menu.IsOpen = true; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduPathIconButton.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 AduSkin.Controls.Metro 10 | { 11 | /// 12 | /// 只有图标的按钮(不显示按钮文本) 13 | /// 14 | public class AduPathIconButton : Button 15 | { 16 | static AduPathIconButton() 17 | { 18 | DefaultStyleKeyProperty.OverrideMetadata(typeof(AduPathIconButton), new FrameworkPropertyMetadata(typeof(AduPathIconButton))); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Style/Converter.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Tools/BaiduTranslate.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/AduSkin/Utility/Computer/TaskBarPostion.cs: -------------------------------------------------------------------------------- 1 | namespace AduSkin.Utility.Computer 2 | { 3 | /// 4 | /// 任务栏位置 5 | /// 6 | public enum TaskBarPostion 7 | { 8 | /// 9 | /// 上边 10 | /// 11 | Top, 12 | /// 13 | /// 左边 14 | /// 15 | Left, 16 | /// 17 | /// 右边 18 | /// 19 | Right, 20 | /// 21 | /// 下边 22 | /// 23 | Bottom, 24 | /// 25 | /// 隐藏 26 | /// 27 | Hide 28 | } 29 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroPath.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class MetroPath : ContentControl 9 | { 10 | public static readonly DependencyProperty DataProperty = ElementBase.Property("DataProperty"); 11 | 12 | public Geometry Data { get { return (Geometry)GetValue(DataProperty); } set { SetValue(DataProperty, value); } } 13 | 14 | static MetroPath() 15 | { 16 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/EnumToBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace AduSkin.Controls.Converter 6 | { 7 | public class EnumToBooleanConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | return value == null ? false : value.Equals(parameter); 12 | } 13 | 14 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | return value != null && value.Equals(true) ? parameter : Binding.DoNothing; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroTabItem.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class MetroTabItem : TabItem 9 | { 10 | public static readonly DependencyProperty IconProperty = ElementBase.Property("IconProperty", null); 11 | 12 | public ImageSource Icon { get { return (ImageSource)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } 13 | 14 | static MetroTabItem() 15 | { 16 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Helper/DesignerHelper.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | 4 | 5 | namespace AduSkin.Controls.Tools.Helper 6 | { 7 | public class DesignerHelper 8 | { 9 | private static bool? _isInDesignMode; 10 | 11 | public static bool IsInDesignMode 12 | { 13 | get 14 | { 15 | if (!_isInDesignMode.HasValue) 16 | { 17 | _isInDesignMode = (bool)DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)).Metadata.DefaultValue; 18 | } 19 | return _isInDesignMode.Value; 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/EventTriggerBase!1.cs: -------------------------------------------------------------------------------- 1 | namespace AduSkin.Interactivity 2 | { 3 | public abstract class EventTriggerBase : EventTriggerBase where T : class 4 | { 5 | protected EventTriggerBase() : base(typeof(T)) 6 | { 7 | } 8 | 9 | protected virtual void OnSourceChanged(T oldSource, T newSource) 10 | { 11 | } 12 | 13 | internal sealed override void OnSourceChangedImpl(object oldSource, object newSource) 14 | { 15 | base.OnSourceChangedImpl(oldSource, newSource); 16 | OnSourceChanged(oldSource as T, newSource as T); 17 | } 18 | 19 | public new T Source => (T)base.Source; 20 | } 21 | } -------------------------------------------------------------------------------- /src/AduSkin/Themes/Opacity.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 1 6 | 0.9 7 | 0.8 8 | 0.5 9 | 0.6 10 | 0.25 11 | 12 | 13 | 1 14 | -------------------------------------------------------------------------------- /src/AduSkin/Utility/Element/VisualObj.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Media; 3 | 4 | namespace AduSkin.Utility.Element 5 | { 6 | public class VisualObj 7 | { 8 | public static void ActionOnAllElement(Visual visual, Action action) 9 | { 10 | for (int i = 0; i < VisualTreeHelper.GetChildrenCount(visual); i++) 11 | { 12 | Visual childVisual = (Visual)VisualTreeHelper.GetChild(visual, i); 13 | if (childVisual != null) 14 | { 15 | action(childVisual); 16 | ActionOnAllElement(childVisual, action); 17 | } 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/StringToVisibility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace AduSkin.Controls.Converter 7 | { 8 | public class StringToVisibility : IValueConverter 9 | { 10 | public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) 11 | { 12 | return value == null || string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible; 13 | } 14 | 15 | public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) 16 | { 17 | return value; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Models/ChatUserModel.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls; 2 | using CommunityToolkit.Mvvm.ComponentModel; 3 | 4 | namespace AduSkin.Demo.Models 5 | { 6 | public partial class ChatUserModel : ObservableObject 7 | { 8 | public string SortID { get; set; } 9 | 10 | public int Id { get; set; } 11 | 12 | public string Header { get; set; } = "pack://application:,,,/Resources/Img/Header/头像.png"; 13 | 14 | public string UserName { get; set; } = "欢迎使用 AduChat"; 15 | 16 | public string Describe { get; set; } = "追求极致,永臻完美"; 17 | 18 | public ContactType ContactType { get; set; } = ContactType.Single; 19 | 20 | [ObservableProperty] 21 | private bool _IsChecked; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/MessageBoxDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | using System.Windows.Media.Imaging; 11 | using System.Windows.Navigation; 12 | using System.Windows.Shapes; 13 | 14 | namespace AduSkin.Demo.UserControls 15 | { 16 | /// 17 | /// MessageBoxDemo.xaml 的交互逻辑 18 | /// 19 | public partial class MessageBoxDemo : UserControl 20 | { 21 | public MessageBoxDemo() 22 | { 23 | InitializeComponent(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/StepBar/AduStepBarItem.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using System.Windows; 3 | using AduSkin.Utility.Element; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | public class AduStepBarItem : ContentControl 8 | { 9 | static AduStepBarItem() 10 | { 11 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 12 | } 13 | /// 14 | /// 编号 15 | /// 16 | public string Number { get { return (string)GetValue(NumberProperty); } set { SetValue(NumberProperty, value); } } 17 | public static readonly DependencyProperty NumberProperty = DependencyProperty.Register("Number", typeof(string), typeof(AduStepBarItem)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Interop/CommonHandles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Text; 5 | 6 | namespace AduSkin.Controls.Tools.Interop 7 | { 8 | [SuppressMessage("ReSharper", "InconsistentNaming")] 9 | internal static class CommonHandles 10 | { 11 | public static readonly int Icon = HandleCollector.RegisterType(nameof(Icon), 20, 500); 12 | 13 | public static readonly int HDC = HandleCollector.RegisterType(nameof(HDC), 100, 2); 14 | 15 | public static readonly int GDI = HandleCollector.RegisterType(nameof(GDI), 50, 500); 16 | 17 | public static readonly int Kernel = HandleCollector.RegisterType(nameof(Kernel), 0, 1000); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduTabControl.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class AduTabControl : TabControl 7 | { 8 | void SelectionState() 9 | { 10 | } 11 | 12 | public AduTabControl() 13 | { 14 | Loaded += delegate { ElementBase.GoToState(this, "SelectionLoaded"); }; 15 | SelectionChanged += delegate (object sender, SelectionChangedEventArgs e) { if (e.Source is AduTabControl) { SelectionState(); } }; 16 | 17 | } 18 | 19 | static AduTabControl() 20 | { 21 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/EnumConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Data; 7 | 8 | namespace AduSkin.Controls.Converter 9 | { 10 | public class EnumConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 13 | { 14 | return value?.Equals(parameter); 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 18 | { 19 | return value?.Equals(true) == true ? parameter : Binding.DoNothing; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/StringIsEmptyConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Data; 3 | 4 | namespace AduSkin.Controls.Converter 5 | { 6 | /// 7 | /// 判断值是否为空 8 | /// 9 | public class StringIsEmptyConverter : IValueConverter 10 | { 11 | #region IValueConverter 成员 12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 13 | { 14 | return string.IsNullOrEmpty(System.Convert.ToString(value)); 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 18 | { 19 | return null; 20 | } 21 | 22 | #endregion 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Views/AduSkinAbout.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.Views 17 | { 18 | /// 19 | /// AduSkinAbout.xaml 的交互逻辑 20 | /// 21 | public partial class AduSkinAbout : UserControl 22 | { 23 | public AduSkinAbout() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin/Utility/AduMethod/DateTimeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace AduSkin.Utility.AduMethod 7 | { 8 | public class DateTimeHelper 9 | { 10 | /// 11 | /// 判断月份是否相等 12 | /// 13 | /// 14 | /// 15 | /// 16 | public static bool MonthIsEqual(DateTime dt1, DateTime dt2) 17 | { 18 | bool flag = false; 19 | 20 | if(dt1.Year == dt2.Year && dt1.Month == dt2.Month) 21 | { 22 | flag = true; 23 | } 24 | 25 | return flag; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/TimeBarDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 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 AduSkin.Demo.UserControls 16 | { 17 | /// 18 | /// TimeBarControl.xaml 的交互逻辑 19 | /// 20 | public partial class TimeBarDemo : UserControl 21 | { 22 | public TimeBarDemo() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Tools/HttpTool.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// HttpTool.xaml 的交互逻辑 20 | /// 21 | public partial class HttpTool : UserControl 22 | { 23 | public HttpTool() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Interop/WpfSafeHandle.cs: -------------------------------------------------------------------------------- 1 | using System.Security; 2 | using Microsoft.Win32.SafeHandles; 3 | 4 | namespace AduSkin.Controls.Tools.Interop 5 | { 6 | internal abstract class WpfSafeHandle : SafeHandleZeroOrMinusOneIsInvalid 7 | { 8 | private readonly int _collectorId; 9 | 10 | [SecurityCritical] 11 | protected WpfSafeHandle(bool ownsHandle, int collectorId) : base(ownsHandle) 12 | { 13 | HandleCollector.Add(collectorId); 14 | _collectorId = collectorId; 15 | } 16 | 17 | [SecurityCritical, SecuritySafeCritical] 18 | protected override void Dispose(bool disposing) 19 | { 20 | HandleCollector.Remove(_collectorId); 21 | base.Dispose(disposing); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/ImageTool.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// ImageTool.xaml 的交互逻辑 20 | /// 21 | public partial class ImageTool : UserControl 22 | { 23 | public ImageTool() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Views/AduSkinSupport.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.Views 17 | { 18 | /// 19 | /// AduSkinSupport.xaml 的交互逻辑 20 | /// 21 | public partial class AduSkinSupport : UserControl 22 | { 23 | public AduSkinSupport() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/NoticeDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// NoticeDemo.xaml 的交互逻辑 20 | /// 21 | public partial class NoticeDemo : UserControl 22 | { 23 | public NoticeDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/TimeBarDemo.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Models/SupportUser.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace AduSkin.Demo.Models 3 | { 4 | public class SupportUser 5 | { 6 | public SupportUser(string name,string contact,string headerurl,string describe, string[] supportTypes) 7 | { 8 | Name = name; 9 | Contact = contact; 10 | Header = headerurl; 11 | Describe = describe; 12 | SupportTypes = supportTypes; 13 | } 14 | public int Id { get; set; } 15 | //昵称 16 | public string Name { get; set; } 17 | //联系方式 18 | public string Contact { get; set; } 19 | //头像 20 | public string Header { get; set; } 21 | //描述 22 | public string Describe { get; set; } 23 | //支持类型 24 | public string[] SupportTypes { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/DataGridDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// DataGridDemo.xaml 的交互逻辑 20 | /// 21 | public partial class DataGridDemo : UserControl 22 | { 23 | public DataGridDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/StepBarDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// StepBarDemo.xaml 的交互逻辑 20 | /// 21 | public partial class StepBarDemo : UserControl 22 | { 23 | public StepBarDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/VideoPlayer.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// VideoPlayer.xaml 的交互逻辑 20 | /// 21 | public partial class VideoPlayer : UserControl 22 | { 23 | public VideoPlayer() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Tools/BaiduTranslate.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// BaiduTranslate.xaml 的交互逻辑 20 | /// 21 | public partial class BaiduTranslate : UserControl 22 | { 23 | public BaiduTranslate() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/NullToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Data; 4 | 5 | namespace AduSkin.Controls.Converter 6 | { 7 | /// 8 | /// 判断值是否为空 9 | /// 10 | public class NullToVisibilityConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 13 | { 14 | if (value != null) 15 | return Visibility.Visible; 16 | else 17 | return Visibility.Collapsed; 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 21 | { 22 | return null; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/ContextMenuDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// ContextMenuDemo.xaml 的交互逻辑 20 | /// 21 | public partial class ContextMenuDemo : UserControl 22 | { 23 | public ContextMenuDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/NavigationPanel.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// NavigationPanel.xaml 的交互逻辑 20 | /// 21 | public partial class NavigationPanel : UserControl 22 | { 23 | public NavigationPanel() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduStatusIcon.cs: -------------------------------------------------------------------------------- 1 | 2 | using AduSkin.Utility.Element; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class AduStatusIcon : Control 9 | { 10 | static AduStatusIcon() 11 | { 12 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 13 | } 14 | 15 | public static readonly DependencyProperty StatusTypeProperty = DependencyProperty.Register( 16 | "StatusType", typeof(StatusType), typeof(AduStatusIcon), new PropertyMetadata(default(StatusType))); 17 | 18 | public StatusType StatusType 19 | { 20 | get => (StatusType)GetValue(StatusTypeProperty); 21 | set => SetValue(StatusTypeProperty, value); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Helper/SecurityHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Security; 5 | using System.Security.Permissions; 6 | using System.Text; 7 | 8 | namespace AduSkin.Controls.Tools.Helper 9 | { 10 | [SuppressMessage("ReSharper", "InconsistentNaming")] 11 | internal class SecurityHelper 12 | { 13 | private static UIPermission _allWindowsUIPermission; 14 | 15 | [SecurityCritical] 16 | internal static void DemandUIWindowPermission() 17 | { 18 | if (_allWindowsUIPermission == null) 19 | { 20 | _allWindowsUIPermission = new UIPermission(UIPermissionWindow.AllWindows); 21 | } 22 | _allWindowsUIPermission.Demand(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/RunningBlockDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// RunningBlockDemo.xaml 的交互逻辑 20 | /// 21 | public partial class RunningBlockDemo : UserControl 22 | { 23 | public RunningBlockDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Effects.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/TreeMenu.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/MultiFunctionTabControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// MultiFunctionTabControl.xaml 的交互逻辑 20 | /// 21 | public partial class MultiFunctionTabControl : UserControl 22 | { 23 | public MultiFunctionTabControl() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/FormVerificationDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// FormVerificationDemo.xaml 的交互逻辑 20 | /// 21 | public partial class FormVerificationDemo : UserControl 22 | { 23 | public FormVerificationDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/DoubleToPercentageConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | using System.Windows; 9 | 10 | namespace AduSkin.Controls.Converter 11 | { 12 | public class DoubleToPercentageConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | if (value is double dvalue) 17 | { 18 | return $"{dvalue * 100.0}%"; 19 | } 20 | return $"0%"; 21 | } 22 | 23 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | return parameter; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroMenuItem.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.ComponentModel; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class MetroMenuItem : MenuItem 9 | { 10 | public MetroMenuItem() 11 | { 12 | 13 | } 14 | 15 | static MetroMenuItem() 16 | { 17 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 18 | } 19 | 20 | [Bindable(true)] 21 | [Category("Content")] 22 | [Localizability(LocalizationCategory.Label)] 23 | public new object Icon { get { return (object)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } 24 | public static readonly new DependencyProperty IconProperty = ElementBase.Property("IconProperty", null); 25 | } 26 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/TransitioningContentControlDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AduSkin.Demo.UserControls 17 | { 18 | /// 19 | /// TransitioningContentControlDemo.xaml 的交互逻辑 20 | /// 21 | public partial class TransitioningContentControlDemo : UserControl 22 | { 23 | public TransitioningContentControlDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Converters.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Metro/MetroWaterfallFlow.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroTabControl.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | public class MetroTabControl : TabControl 7 | { 8 | void SelectionState() 9 | { 10 | ElementBase.GoToState(this, "SelectionStart"); 11 | ElementBase.GoToState(this, "SelectionEnd"); 12 | } 13 | 14 | public MetroTabControl() 15 | { 16 | Loaded += delegate { ElementBase.GoToState(this, "SelectionLoaded"); }; 17 | SelectionChanged += delegate (object sender, SelectionChangedEventArgs e) { if (e.Source is MetroTabControl) { SelectionState(); } }; 18 | 19 | } 20 | 21 | static MetroTabControl() 22 | { 23 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/SortGroup.xaml.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Demo.Models; 2 | using AduSkin.Demo.ViewModel; 3 | using CommunityToolkit.Mvvm.Input; 4 | using System.Windows.Controls; 5 | using System.Windows.Input; 6 | 7 | namespace AduSkin.Demo.UserControls 8 | { 9 | /// 10 | /// SortGroup.xaml 的交互逻辑 11 | /// 12 | public partial class SortGroup : UserControl 13 | { 14 | public SortGroup() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | /// 20 | /// 命令Command 21 | /// 22 | [RelayCommand] 23 | public void ToGroup(ChatUserModel e) 24 | { 25 | SortGroupViewModel vm = this.DataContext as SortGroupViewModel; 26 | vm.IsOpenSortList = false; 27 | ListBoxContact.UpdateLayout(); 28 | ListBoxContact.AnimateScrollIntoView(e); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Metro/MetroMenuSeparator.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 16 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Interop/IconHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.ConstrainedExecution; 3 | using System.Security; 4 | 5 | namespace AduSkin.Controls.Tools.Interop 6 | { 7 | internal sealed class IconHandle : WpfSafeHandle 8 | { 9 | [SecurityCritical] 10 | private IconHandle() : base(true, CommonHandles.Icon) 11 | { 12 | } 13 | 14 | [SecurityCritical] 15 | [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] 16 | protected override bool ReleaseHandle() 17 | { 18 | return InteropMethods.DestroyIcon(handle); 19 | } 20 | 21 | [SecurityCritical, SecuritySafeCritical] 22 | internal static IconHandle GetInvalidIcon() 23 | { 24 | return new IconHandle(); 25 | } 26 | 27 | [SecurityCritical] 28 | internal IntPtr CriticalGetHandle() 29 | { 30 | return handle; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/AduSkin/Utility/Media/StreamObj.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Windows.Media; 3 | using System.Windows.Media.Imaging; 4 | 5 | namespace AduSkin.Utility.Media 6 | { 7 | public class StreamObj 8 | { 9 | public static string ToString(Stream stream) 10 | { 11 | try { return new StreamReader(stream).ReadToEnd(); } 12 | catch { return ""; } 13 | } 14 | 15 | public static ImageSource ToImageSource(Stream stream) 16 | { 17 | try 18 | { 19 | BitmapImage bitmapImage = new BitmapImage(); 20 | bitmapImage.BeginInit(); 21 | bitmapImage.CacheOption = BitmapCacheOption.OnLoad; 22 | bitmapImage.StreamSource = stream; 23 | bitmapImage.EndInit(); 24 | 25 | return bitmapImage; 26 | } 27 | catch { return null; } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/ViewModel/ModuleViewModel/AduSkinAboutViewModel.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Demo.Views; 2 | using CommunityToolkit.Mvvm.ComponentModel; 3 | using CommunityToolkit.Mvvm.Input; 4 | using System.Windows.Input; 5 | 6 | namespace AduSkin.Demo.ViewModel 7 | { 8 | public partial class AduSkinAboutViewModel : ObservableObject 9 | { 10 | /// 11 | /// 命令Command 12 | /// 13 | [RelayCommand] 14 | public void OpenDemo(string e) 15 | { 16 | switch (e) 17 | { 18 | case "About": 19 | new AduSkinDemo().Show(); 20 | return; 21 | case "Video": 22 | new AduVideoDemo().Show(); 23 | return; 24 | case "Reward": 25 | IsOpenReward = true; 26 | return; 27 | } 28 | } 29 | 30 | [ObservableProperty] 31 | private bool _isOpenReward; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroButton.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls.Primitives; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | public enum ButtonState 8 | { 9 | None, 10 | Red, 11 | Green, 12 | Blue 13 | } 14 | 15 | public class MetroButton : ButtonBase 16 | { 17 | public static readonly DependencyProperty MetroButtonStateProperty = ElementBase.Property("MetroButtonStateProperty", ButtonState.None); 18 | 19 | public ButtonState MetroButtonState { get { return (ButtonState)GetValue(MetroButtonStateProperty); } set { SetValue(MetroButtonStateProperty, value); } } 20 | 21 | public MetroButton() 22 | { 23 | 24 | } 25 | 26 | static MetroButton() 27 | { 28 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroWebBrowser.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/CoverFlowDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using System.Windows.Controls; 3 | 4 | namespace AduSkin.Demo.UserControls 5 | { 6 | /// 7 | /// CoverFlowDemo.xaml 的交互逻辑 8 | /// 9 | public partial class CoverFlowDemo : UserControl 10 | { 11 | public CoverFlowDemo() 12 | { 13 | InitializeComponent(); 14 | 15 | #region 轮播 16 | ObservableCollection list = new ObservableCollection(); 17 | for (int i = 0; i < 5; i++) 18 | { 19 | list.Add(new Models.Carousel() 20 | { 21 | imgpath = "../Resources/aduskin.png", 22 | name = "AduSkin", 23 | info = "追求极致,永臻完美" 24 | }); 25 | } 26 | this.CoverFlowMain.ItemsSource = list; 27 | CoverFlowMain.JumpTo(2); 28 | #endregion 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AduVideoPlayer/Controls/VideoInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AduVideoPlayer.Controls 8 | { 9 | /// 10 | /// 视频播放信息 11 | /// 12 | public class VideoInfo 13 | { 14 | /// 15 | /// 主键 16 | /// 17 | private string Key { get; set; } 18 | /// 19 | /// 视频名称 20 | /// 21 | public string Name { get; set; } 22 | /// 23 | /// 视频播放路径 24 | /// 25 | public string PlayUrl { get; set; } 26 | /// 27 | /// 视频播放类型 28 | /// 29 | public EnumVideoType VideoType { get; set; } 30 | } 31 | 32 | public enum EnumVideoType 33 | { 34 | LocalVideo = 0, 35 | Stream = 1, 36 | Mrl = 2, 37 | Uri = 3, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/CornerRadiusToDouble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace AduSkin.Controls.Converter 7 | { 8 | public class CornerRadiusToDouble : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (parameter != null) 13 | { 14 | return ((CornerRadius)value).TopLeft * System.Convert.ToDouble(parameter); 15 | } 16 | return ((CornerRadius)value).TopLeft; 17 | } 18 | 19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 20 | { 21 | if (parameter != null) 22 | { 23 | return new CornerRadius((double)value/ System.Convert.ToDouble(parameter)); 24 | } 25 | return new CornerRadius((double)value); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/ViewModel/DemoViewModel/RunningBlockViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AduSkin.Demo.ViewModel 10 | { 11 | public partial class RunningBlockViewModel : ObservableObject 12 | { 13 | private string _RunningText = "AduSkin - 追求极致,永臻完美"; 14 | /// 15 | /// 滚动字幕 16 | /// 17 | public string RunningText 18 | { 19 | get { return _RunningText; } 20 | set 21 | { 22 | _RunningText = value; 23 | OnPropertyChanged("RunningText"); 24 | } 25 | } 26 | 27 | /// 28 | /// 刷新 29 | /// 30 | [RelayCommand] 31 | public void Update() 32 | { 33 | RunningText = $"AduSkin - {Guid.NewGuid().ToString()}"; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/BoolReverseConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace AduSkin.Controls.Converter 10 | { 11 | public class BoolReverseConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (value is bool boolValue) 16 | { 17 | return !boolValue; 18 | } 19 | else 20 | { 21 | return value; 22 | } 23 | } 24 | 25 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 26 | { 27 | if (value is bool boolValue) 28 | { 29 | return !boolValue; 30 | } 31 | else 32 | { 33 | return value; 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/DoubleToCornerRadius.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace AduSkin.Controls.Converter 7 | { 8 | public class DoubleToCornerRadius : IValueConverter 9 | { 10 | public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (parameter != null) 13 | { 14 | return new CornerRadius((double)value / System.Convert.ToDouble(parameter)); 15 | } 16 | return new CornerRadius((double)value); 17 | } 18 | 19 | public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) 20 | { 21 | if (parameter != null) 22 | { 23 | return ((CornerRadius)value).TopLeft * System.Convert.ToDouble(parameter); 24 | } 25 | return ((CornerRadius)value).TopLeft; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/CoverFlowDemo.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/Base/HeaderedSelectableItem.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AduSkin.Controls.Metro 4 | { 5 | public class HeaderedSelectableItem : SelectableItem 6 | { 7 | public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register( 8 | "Header", typeof(object), typeof(HeaderedSelectableItem), new PropertyMetadata(default(object))); 9 | 10 | public object Header 11 | { 12 | get => GetValue(HeaderProperty); 13 | set => SetValue(HeaderProperty, value); 14 | } 15 | 16 | public static readonly DependencyProperty HeaderTemplateProperty = DependencyProperty.Register( 17 | "HeaderTemplate", typeof(DataTemplate), typeof(HeaderedSelectableItem), new PropertyMetadata(default(DataTemplate))); 18 | 19 | public DataTemplate HeaderTemplate 20 | { 21 | get => (DataTemplate) GetValue(HeaderTemplateProperty); 22 | set => SetValue(HeaderTemplateProperty, value); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroBorder.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | public class MetroBorder : Border 8 | { 9 | public static readonly DependencyProperty AutoCornerRadiusProperty = ElementBase.Property("AutoCornerRadiusProperty"); 10 | public bool AutoCornerRadius { get { return (bool)GetValue(AutoCornerRadiusProperty); } set { SetValue(AutoCornerRadiusProperty, value); } } 11 | public MetroBorder() 12 | { 13 | Loaded += delegate { SizeChang(); }; 14 | SizeChanged += delegate { SizeChang(); }; 15 | } 16 | 17 | void SizeChang() 18 | { 19 | if (AutoCornerRadius) 20 | { 21 | if (IsLoaded) 22 | { 23 | CornerRadius = new CornerRadius(ActualWidth >= ActualHeight ? ActualHeight / 2 : ActualWidth / 2); 24 | } 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroComboBox.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class MetroComboBox : ComboBox 9 | { 10 | public static readonly DependencyProperty TitleProperty = ElementBase.Property("TitleProperty", ""); 11 | public static readonly DependencyProperty IconProperty = ElementBase.Property("IconProperty", null); 12 | 13 | public string Title { get { return (string)GetValue(TitleProperty); } set { SetValue(TitleProperty, value); } } 14 | public ImageSource Icon { get { return (ImageSource)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } 15 | 16 | public MetroComboBox() 17 | { 18 | 19 | } 20 | 21 | static MetroComboBox() 22 | { 23 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Models/Sys_Code.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AduSkin.Demo.Models 8 | { 9 | public class Sys_Code 10 | { 11 | public Sys_Code() 12 | { 13 | } 14 | public Sys_Code(string CodeName, string CodeValue) 15 | { 16 | this.CodeName = CodeName; 17 | this.CodeValue = CodeValue; 18 | } 19 | private string _CodeName; 20 | /// 21 | /// XXX 22 | /// 23 | public string CodeName 24 | { 25 | get { return _CodeName; } 26 | set 27 | { 28 | _CodeName = value; 29 | } 30 | } 31 | private string _CodeValue; 32 | /// 33 | /// XXX 34 | /// 35 | public string CodeValue 36 | { 37 | get { return _CodeValue; } 38 | set 39 | { 40 | _CodeValue = value; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/EventTrigger.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AduSkin.Interactivity 4 | { 5 | public class EventTrigger : EventTriggerBase 6 | { 7 | public static readonly DependencyProperty EventNameProperty = DependencyProperty.Register("EventName", typeof(string), typeof(EventTrigger), new FrameworkPropertyMetadata("Loaded", OnEventNameChanged)); 8 | 9 | public EventTrigger() 10 | { 11 | } 12 | 13 | public EventTrigger(string eventName) => EventName = eventName; 14 | 15 | protected override string GetEventName() => EventName; 16 | 17 | private static void OnEventNameChanged(object sender, DependencyPropertyChangedEventArgs args) 18 | { 19 | ((EventTrigger)sender).OnEventNameChanged((string)args.OldValue, (string)args.NewValue); 20 | } 21 | 22 | public string EventName 23 | { 24 | get => (string)GetValue(EventNameProperty); 25 | 26 | set => SetValue(EventNameProperty, value); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/AduSkin/Utility/Media/ResObj.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Reflection; 3 | using System.Windows.Media; 4 | 5 | namespace AduSkin.Utility.Media 6 | { 7 | public class ResObj 8 | { 9 | static Stream Get(Assembly assembly, string path) 10 | { 11 | return assembly.GetManifestResourceStream(assembly.GetName().Name + "." + path); 12 | } 13 | 14 | public static string GetString(Assembly assembly, string path) 15 | { 16 | try 17 | { 18 | return StreamObj.ToString(Get(assembly, path)); 19 | } 20 | catch 21 | { 22 | return null; 23 | } 24 | } 25 | 26 | public static ImageSource GetImageSource(Assembly assembly, string path) 27 | { 28 | try 29 | { 30 | return StreamObj.ToImageSource(Get(assembly, path)); 31 | } 32 | catch 33 | { 34 | return null; 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/NumericUpDown/AduNumericUpDownBase.cs: -------------------------------------------------------------------------------- 1 | 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | public class AduNumericUpDownBase : MetroTextBox 8 | { 9 | static AduNumericUpDownBase() 10 | { 11 | DefaultStyleKeyProperty.OverrideMetadata(typeof(AduNumericUpDownBase), new FrameworkPropertyMetadata(typeof(AduNumericUpDownBase))); 12 | } 13 | 14 | public enum UpDownOrientationEnum 15 | { 16 | Vertical, 17 | Horizontal, 18 | } 19 | 20 | public static readonly DependencyProperty UpDownOrientationProperty = DependencyProperty.Register("UpDownOrientation" 21 | , typeof(UpDownOrientationEnum), typeof(MetroTextBox)); 22 | /// 23 | /// 皮肤 24 | /// 25 | public UpDownOrientationEnum UpDownOrientation 26 | { 27 | get { return (UpDownOrientationEnum)GetValue(UpDownOrientationProperty); } 28 | set { SetValue(UpDownOrientationProperty, value); } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/RoutedEventTrigger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace AduSkin.Interactivity 5 | { 6 | public class RoutedEventTrigger : EventTriggerBase 7 | { 8 | public RoutedEvent RoutedEvent { get; set; } 9 | 10 | protected override void OnAttached() 11 | { 12 | var behavior = AssociatedObject as Behavior; 13 | var associatedElement = AssociatedObject as FrameworkElement; 14 | if (behavior != null) associatedElement = ((IAttachedObject)behavior).AssociatedObject as FrameworkElement; 15 | if (associatedElement == null) throw new ArgumentException(); 16 | if (RoutedEvent != null) associatedElement.AddHandler(RoutedEvent, new RoutedEventHandler(OnRoutedEvent)); 17 | } 18 | 19 | private void OnRoutedEvent(object sender, RoutedEventArgs args) 20 | { 21 | OnEvent(args); 22 | } 23 | 24 | protected override string GetEventName() 25 | { 26 | return RoutedEvent.Name; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroTextBlock.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace AduSkin.Controls.Metro 4 | { 5 | /* 6 | public class MetroTextBlock : ContentControl 7 | { 8 | 9 | public static readonly DependencyProperty SpacingProperty = ElementBase.Property("SpacingProperty), new Thickness(0.25)); 10 | public Thickness Spacing 11 | { 12 | get { return (Thickness)GetValue(SpacingProperty); } 13 | set { SetValue(SpacingProperty, value); } 14 | } 15 | public static readonly DependencyProperty TextProperty = ElementBase.Property("TextProperty), ""); 16 | public string Text 17 | { 18 | get { return (string)GetValue(TextProperty); } 19 | set { SetValue(TextProperty, value); } 20 | } 21 | static MetroTextBlock() 22 | { 23 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 24 | } 25 | } 26 | */ 27 | public class MetroTextBlock : TextBlock 28 | { 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Data/ValueBoxes.cs: -------------------------------------------------------------------------------- 1 | namespace AduSkin.Controls.Data 2 | { 3 | /// 4 | /// 装箱后的值类型(用于提高效率) 5 | /// 6 | internal static class ValueBoxes 7 | { 8 | internal static object TrueBox = true; 9 | 10 | internal static object FalseBox = false; 11 | 12 | internal static object Double0Box = .0; 13 | 14 | internal static object Double1Box = 1.0; 15 | 16 | internal static object Double20Box = 20.0; 17 | 18 | internal static object Double100Box = 100.0; 19 | 20 | internal static object Double200Box = 200.0; 21 | 22 | internal static object Double300Box = 300.0; 23 | 24 | internal static object DoubleNeg1Box = -1.0; 25 | 26 | internal static object Int0Box = 0; 27 | 28 | internal static object Int1Box = 1; 29 | 30 | internal static object Int2Box = 2; 31 | 32 | internal static object Int5Box = 5; 33 | 34 | internal static object Int99Box = 99; 35 | 36 | internal static object BooleanBox(bool value) => value ? TrueBox : FalseBox; 37 | } 38 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/DatePickers/AduTimeButton.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.Controls.Primitives; 8 | 9 | namespace AduSkin.Controls.Metro 10 | { 11 | public class AduTimeButton : ListBoxItem 12 | { 13 | public AduTimeButton() 14 | { 15 | 16 | } 17 | 18 | #region Private属性 19 | #endregion 20 | 21 | #region 依赖属性定义 22 | 23 | #endregion 24 | 25 | #region 依赖属性set get 26 | 27 | #endregion 28 | 29 | #region Constructors 30 | static AduTimeButton() 31 | { 32 | DefaultStyleKeyProperty.OverrideMetadata(typeof(AduTimeButton), new FrameworkPropertyMetadata(typeof(AduTimeButton))); 33 | } 34 | #endregion 35 | 36 | #region Override方法 37 | public override void OnApplyTemplate() 38 | { 39 | base.OnApplyTemplate(); 40 | } 41 | #endregion 42 | 43 | #region Private方法 44 | 45 | #endregion 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/RunningBlockDemo.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/IsLastItemConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Controls; 3 | using System.Windows.Data; 4 | 5 | namespace AduSkin.Controls.Converter 6 | { 7 | /// 8 | /// true则隐藏,false则显示 9 | /// 10 | public class IsLastItemConverter : IMultiValueConverter 11 | { 12 | public object Convert(object[] value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 13 | { 14 | ContentControl contentPresenter = value[0] as ContentControl; 15 | ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(contentPresenter); 16 | 17 | bool flag = false; 18 | if (itemsControl != null) 19 | { 20 | int index = itemsControl.ItemContainerGenerator.IndexFromContainer(contentPresenter); 21 | flag = (index == (itemsControl.Items.Count - 1)); 22 | } 23 | 24 | return flag; 25 | } 26 | public object[] ConvertBack(object value, Type[] targetType, object parameter, System.Globalization.CultureInfo culture) 27 | { 28 | return null; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/NumberConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace AduSkin.Controls.Converter 6 | { 7 | /// 8 | /// 在0~9前面加0 9 | /// 10 | public class NumberConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | if (value == null) 15 | { 16 | return 0; 17 | } 18 | int number = 0; 19 | int flag = 0; 20 | if (int.TryParse(value.ToString(), out number)) 21 | { 22 | if (number > 99) 23 | { 24 | flag = 3; 25 | } 26 | else if (number > 9 && number <= 99) 27 | { 28 | flag = 2; 29 | } 30 | else 31 | { 32 | flag = 1; 33 | } 34 | } 35 | return flag; 36 | } 37 | 38 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 39 | { 40 | return null; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Metro/StepBar/AduStepBar.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 27 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduButtonRemind.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Metro.Base; 2 | using AduSkin.Utility.Element; 3 | using System.Windows; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | public class AduButtonRemind : AduButtonBase 8 | { 9 | public AduButtonRemind() 10 | { 11 | 12 | } 13 | 14 | static AduButtonRemind() 15 | { 16 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 17 | } 18 | 19 | #region AduSkin 20 | public static readonly DependencyProperty AduButtonStateProperty = ElementBase.Property("AduButtonStateProperty", ButtonState.None); 21 | public ButtonState AduButtonState { get { return (ButtonState)GetValue(AduButtonStateProperty); } set { SetValue(AduButtonStateProperty, value); } } 22 | 23 | public string Hint 24 | { 25 | get { return (string)GetValue(HintProperty); } 26 | set { SetValue(HintProperty, value); } 27 | } 28 | 29 | public static readonly DependencyProperty HintProperty = 30 | DependencyProperty.Register("Hint", typeof(string), typeof(AduButtonRemind)); 31 | #endregion 32 | } 33 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/VideoPlayer.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/IndentConverter.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Metro; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Media; 10 | 11 | namespace AduSkin.Controls.Converter 12 | { 13 | public class IndentConverter : IValueConverter 14 | { 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | double colunwidth = 10; 18 | double left = 0.0; 19 | 20 | UIElement element = value as TreeViewItem; 21 | while (element.GetType() != typeof(AduTreeView)) 22 | { 23 | element = (UIElement)VisualTreeHelper.GetParent(element); 24 | if (element.GetType() == typeof(TreeViewItem)) 25 | left += colunwidth; 26 | } 27 | return new Thickness(left, 0, 0, 0); 28 | } 29 | 30 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | throw new NotImplementedException(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduSimplePanel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | /// 8 | /// 用以代替Grid 9 | /// 10 | /// 11 | /// 当不需要Grid的行、列分隔等功能时建议用此轻量级类代替 12 | /// 13 | public class AduSimplePanel : Panel 14 | { 15 | protected override Size MeasureOverride(Size availableSize) 16 | { 17 | var maxSize = new Size(); 18 | 19 | foreach (UIElement child in InternalChildren) 20 | { 21 | if (child != null) 22 | { 23 | child.Measure(availableSize); 24 | maxSize.Width = Math.Max(maxSize.Width, child.DesiredSize.Width); 25 | maxSize.Height = Math.Max(maxSize.Height, child.DesiredSize.Height); 26 | } 27 | } 28 | 29 | return maxSize; 30 | } 31 | 32 | protected override Size ArrangeOverride(Size arrangeSize) 33 | { 34 | foreach (UIElement child in InternalChildren) 35 | { 36 | child?.Arrange(new Rect(arrangeSize)); 37 | } 38 | 39 | return arrangeSize; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Models/ControlModel.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Demo.Data.Enum; 2 | using AduSkin.Utility.Extend; 3 | using System; 4 | 5 | namespace AduSkin.Demo.Models 6 | { 7 | public class ControlModel 8 | { 9 | public ControlModel(string title, Type content, DemoType type = DemoType.Demo, ControlState state = ControlState.Nor, string xaml = "", string code = "", string tags = "") 10 | { 11 | Title = title; 12 | TitlePinyin = StringExtend.GetPinyin(title); 13 | Content = content; 14 | Type = type; 15 | Tags = tags; 16 | XAML = xaml; 17 | Code = code; 18 | State = state; 19 | } 20 | 21 | public ControlModel() 22 | { 23 | Tags = string.Empty; 24 | } 25 | 26 | public DemoType Type { get; set; } 27 | 28 | public int Id { get; private set; } 29 | 30 | public string Title { get; set; } 31 | 32 | public string TitlePinyin { get; set; } 33 | 34 | public Type Content { get; set; } 35 | 36 | public string XAML { get; set; } 37 | 38 | public string Code { get; set; } 39 | 40 | public string Tags { get; set; } 41 | 42 | public ControlState State { get; set; } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/BehaviorCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AduSkin.Interactivity 4 | { 5 | public sealed class BehaviorCollection : AttachableCollection 6 | { 7 | internal BehaviorCollection() 8 | { 9 | } 10 | 11 | protected override void OnAttached() 12 | { 13 | foreach (var behavior in this) 14 | behavior.Attach(AssociatedObject); 15 | } 16 | 17 | protected override void OnDetaching() 18 | { 19 | foreach (var behavior in this) 20 | behavior.Detach(); 21 | } 22 | 23 | internal override void ItemAdded(Behavior item) 24 | { 25 | if (item == null || AssociatedObject == null) 26 | return; 27 | item.Attach(AssociatedObject); 28 | } 29 | 30 | internal override void ItemRemoved(Behavior item) 31 | { 32 | if (((IAttachedObject) item)?.AssociatedObject == null) 33 | return; 34 | item.Detach(); 35 | } 36 | 37 | protected override Freezable CreateInstanceCore() 38 | { 39 | return new BehaviorCollection(); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/TriggerCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AduSkin.Interactivity 4 | { 5 | public sealed class TriggerCollection : AttachableCollection 6 | { 7 | internal TriggerCollection() 8 | { 9 | } 10 | 11 | protected override void OnAttached() 12 | { 13 | foreach (var triggerBase in this) 14 | triggerBase.Attach(AssociatedObject); 15 | } 16 | 17 | protected override void OnDetaching() 18 | { 19 | foreach (var triggerBase in this) 20 | triggerBase.Detach(); 21 | } 22 | 23 | internal override void ItemAdded(TriggerBase item) 24 | { 25 | if (AssociatedObject == null) 26 | return; 27 | item.Attach(AssociatedObject); 28 | } 29 | 30 | internal override void ItemRemoved(TriggerBase item) 31 | { 32 | if (((IAttachedObject) item).AssociatedObject == null) 33 | return; 34 | item.Detach(); 35 | } 36 | 37 | protected override Freezable CreateInstanceCore() 38 | { 39 | return new TriggerCollection(); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/TimeLine.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace AduSkin.Demo.UserControls 18 | { 19 | /// 20 | /// TimeLine.xaml 的交互逻辑 21 | /// 22 | public partial class TimeLine : UserControl 23 | { 24 | public TimeLine() 25 | { 26 | InitializeComponent(); 27 | 28 | #region 时间轴 29 | ObservableCollection> listTimeLine = new ObservableCollection>(); 30 | for (int i = 0; i < 5; i++) 31 | { 32 | listTimeLine.Add(new Tuple(i, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "哈哈哈哈")); 33 | } 34 | AduTimeLine.ItemsSource = listTimeLine; 35 | #endregion 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/BoolToVisibility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace AduSkin.Controls.Converter 7 | { 8 | public class BoolToVisibility: IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if ((bool)value) 13 | return Visibility.Visible; 14 | else 15 | return Visibility.Collapsed; 16 | } 17 | 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | } 23 | 24 | public class BoolToReVisibility : IValueConverter 25 | { 26 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 27 | { 28 | if ((bool)value) 29 | return Visibility.Collapsed; 30 | else 31 | return Visibility.Visible; 32 | } 33 | 34 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 35 | { 36 | throw new NotImplementedException(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Metro/MetroPath.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 25 | 26 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/ImageTool.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Servers/Extensions/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AduSkin.Demo.Servers.Extensions 10 | { 11 | public static class ServiceCollectionExtensions 12 | { 13 | public static IServiceCollection AddTransientFromNamespace( 14 | this IServiceCollection services, 15 | string namespaceName, 16 | params Assembly[] assemblies 17 | ) 18 | { 19 | foreach (Assembly assembly in assemblies) 20 | { 21 | IEnumerable types = assembly 22 | .GetTypes() 23 | .Where(x => 24 | x.IsClass 25 | && x.Namespace!.StartsWith(namespaceName, StringComparison.InvariantCultureIgnoreCase) 26 | ); 27 | 28 | foreach (Type? type in types) 29 | { 30 | if (services.All(x => x.ServiceType != type)) 31 | { 32 | _ = services.AddTransient(type); 33 | } 34 | } 35 | } 36 | 37 | return services; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/OffsetConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | namespace AduSkin.Controls.Converter 11 | { 12 | public class OffsetConverter : IMultiValueConverter 13 | { 14 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | if (values.FirstOrDefault(v => v == DependencyProperty.UnsetValue) != null) 17 | { 18 | return double.NaN; 19 | } 20 | 21 | double placementTargetWidth = (double)values[0]; 22 | double toolTipWidth = (double)values[1]; 23 | 24 | if ("Center".Equals(parameter)) 25 | { 26 | return (placementTargetWidth / 2.0) - (toolTipWidth / 2.0); 27 | } 28 | else if ("Right".Equals(parameter)) 29 | { 30 | return placementTargetWidth - toolTipWidth; 31 | } 32 | 33 | return 0; 34 | } 35 | 36 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 37 | { 38 | return null; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Attach/InputAttach.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AduSkin.Controls.Attach 4 | { 5 | public class InputAttach 6 | { 7 | /// 8 | /// 输入提示 9 | /// 10 | public static readonly DependencyProperty InputHintProperty = DependencyProperty.RegisterAttached( 11 | "InputHint", typeof(string), typeof(InputAttach), new PropertyMetadata(default(string))); 12 | 13 | public static void SetInputHint(DependencyObject element, string value) 14 | => element.SetValue(InputHintProperty, value); 15 | 16 | public static string GetInputHint(DependencyObject element) 17 | => (string)element.GetValue(InputHintProperty); 18 | 19 | /// 20 | /// 操作提示 21 | /// 22 | public static readonly DependencyProperty OperationHintProperty = DependencyProperty.RegisterAttached( 23 | "OperationHint", typeof(string), typeof(InputAttach), new PropertyMetadata(default(string))); 24 | 25 | public static void SetOperationHint(DependencyObject element, string value) 26 | => element.SetValue(OperationHintProperty, value); 27 | 28 | public static string GetOperationHint(DependencyObject element) 29 | => (string)element.GetValue(OperationHintProperty); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/DoubleFactor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace AduSkin.Controls.Converter 6 | { 7 | public class DoubleFactor : IValueConverter 8 | { 9 | public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) 10 | { 11 | if (value == null) 12 | { 13 | return 0.0; 14 | } 15 | else if (parameter == null) 16 | { 17 | return System.Convert.ToDouble(value); 18 | } 19 | else 20 | { 21 | return System.Convert.ToDouble(value) * System.Convert.ToDouble(parameter); 22 | } 23 | } 24 | 25 | public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) 26 | { 27 | if (value == null) 28 | { 29 | return 0.0; 30 | } 31 | else if (parameter == null) 32 | { 33 | return System.Convert.ToDouble(value); 34 | } 35 | else 36 | { 37 | return System.Convert.ToDouble(value) / System.Convert.ToDouble(parameter); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/CarouselContainer.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace AduSkin.Demo.UserControls 18 | { 19 | /// 20 | /// Carousel.xaml 的交互逻辑 21 | /// 22 | public partial class CarouselContainer : UserControl 23 | { 24 | public CarouselContainer() 25 | { 26 | InitializeComponent(); 27 | 28 | #region 轮播 29 | ObservableCollection list = new ObservableCollection(); 30 | for (int i = 0; i < 5; i++) 31 | { 32 | list.Add(new Models.Carousel() 33 | { 34 | imgpath = "../Resources/aduskin.png", 35 | name = "AduSkin", 36 | info = "追求极致,永臻完美" 37 | }); 38 | } 39 | this.Carousels.ItemsSource = list; 40 | #endregion 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduSpeTextBlock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows.Controls; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | /// 9 | /// 作为刻度使用的文字块 10 | /// 11 | internal class AduSpeTextBlock : TextBlock 12 | { 13 | public double X { get; set; } 14 | 15 | public AduSpeTextBlock() => Width = 60; 16 | 17 | public AduSpeTextBlock(double x) : this() 18 | { 19 | X = x; 20 | Canvas.SetLeft(this, X); 21 | } 22 | 23 | /// 24 | /// 时间 25 | /// 26 | private DateTime _time; 27 | 28 | /// 29 | /// 时间 30 | /// 31 | public DateTime Time 32 | { 33 | get => _time; 34 | set 35 | { 36 | _time = value; 37 | Text = $"{value.ToString(TimeFormat)}\r\n|"; 38 | } 39 | } 40 | 41 | /// 42 | /// 时间格式 43 | /// 44 | public string TimeFormat { get; set; } = "HH:mm"; 45 | 46 | /// 47 | /// 横向移动 48 | /// 49 | /// 50 | public void MoveX(double offsetX) => Canvas.SetLeft(this, X + offsetX); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/NumericUpDown/AduIntegerUpDown.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | [TemplatePart(Name = "PART_ContentHost", Type = typeof(ScrollViewer))] 8 | [TemplatePart(Name = "PART_UP", Type = typeof(Button))] 9 | [TemplatePart(Name = "PART_DOWN", Type = typeof(Button))] 10 | public class AduIntegerUpDown : AduNumericUpDown 11 | { 12 | public AduIntegerUpDown() : base() 13 | { 14 | this.Minimum = 0; 15 | this.Maximum = 100; 16 | this.Value = this.Minimum; 17 | this.Increment = 1; 18 | } 19 | 20 | protected override int IncrementValue(int value, int increment) 21 | { 22 | return value + increment; 23 | } 24 | 25 | protected override int DecrementValue(int value, int increment) 26 | { 27 | return value - increment; 28 | } 29 | 30 | protected override int ParseValue(string value) 31 | { 32 | int temp = 0; 33 | if(int.TryParse(value, out temp)) 34 | { 35 | return temp; 36 | } 37 | else 38 | { 39 | return int.MinValue; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Views/AduVideoDemo.xaml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/NumericUpDown/AduDoubleUpDown.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | [TemplatePart(Name = "PART_ContentHost", Type = typeof(ScrollViewer))] 8 | [TemplatePart(Name = "PART_UP", Type = typeof(Button))] 9 | [TemplatePart(Name = "PART_DOWN", Type = typeof(Button))] 10 | public class AduDoubleUpDown : AduNumericUpDown 11 | { 12 | public AduDoubleUpDown() : base() 13 | { 14 | this.Minimum = 0d; 15 | this.Maximum = 100d; 16 | this.Value = this.Minimum; 17 | this.Increment = 1d; 18 | } 19 | 20 | protected override double IncrementValue(double value, double increment) 21 | { 22 | return value + increment; 23 | } 24 | 25 | protected override double DecrementValue(double value, double increment) 26 | { 27 | return value - increment; 28 | } 29 | 30 | protected override double ParseValue(string value) 31 | { 32 | double temp = 0; 33 | if (double.TryParse(value, out temp)) 34 | { 35 | return temp; 36 | } 37 | else 38 | { 39 | return double.MinValue; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Interop/BitmapHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.ConstrainedExecution; 4 | using System.Runtime.InteropServices; 5 | using System.Security; 6 | 7 | 8 | namespace AduSkin.Controls.Tools.Interop 9 | { 10 | [SuppressMessage("ReSharper", "UnusedMember.Local")] 11 | internal sealed class BitmapHandle : WpfSafeHandle 12 | { 13 | [SecurityCritical] 14 | private BitmapHandle() : this(true) 15 | { 16 | //请不要删除此构造函数,否则当使用自定义ico文件时会报错 17 | } 18 | 19 | [SecurityCritical] 20 | private BitmapHandle(bool ownsHandle) : base(ownsHandle, CommonHandles.GDI) 21 | { 22 | } 23 | 24 | [SecurityCritical] 25 | [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] 26 | protected override bool ReleaseHandle() 27 | { 28 | return InteropMethods.DeleteObject(handle); 29 | } 30 | 31 | [SecurityCritical] 32 | internal HandleRef MakeHandleRef(object obj) 33 | { 34 | return new HandleRef(obj, handle); 35 | } 36 | 37 | [SecurityCritical] 38 | internal static BitmapHandle CreateFromHandle(IntPtr hbitmap, bool ownsHandle = true) 39 | { 40 | return new BitmapHandle(ownsHandle) 41 | { 42 | handle = hbitmap, 43 | }; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Metro/MetroTitleMenu.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 26 | -------------------------------------------------------------------------------- /src/AduSkin/Themes/Metro/RatingBar/AduRatingBarButton.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 24 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/AdornerContainer.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Documents; 3 | using System.Windows.Media; 4 | 5 | namespace AduSkin.Interactivity 6 | { 7 | public class AdornerContainer : Adorner 8 | { 9 | private UIElement _child; 10 | 11 | public AdornerContainer(UIElement adornedElement) : base(adornedElement) 12 | { 13 | } 14 | 15 | public UIElement Child 16 | { 17 | get => _child; 18 | set 19 | { 20 | if (value == null) 21 | { 22 | RemoveVisualChild(_child); 23 | // ReSharper disable once ExpressionIsAlwaysNull 24 | _child = value; 25 | return; 26 | } 27 | AddVisualChild(value); 28 | _child = value; 29 | } 30 | } 31 | 32 | protected override int VisualChildrenCount => _child != null ? 1 : 0; 33 | 34 | protected override Size ArrangeOverride(Size finalSize) 35 | { 36 | _child?.Arrange(new Rect(finalSize)); 37 | return finalSize; 38 | } 39 | 40 | protected override Visual GetVisualChild(int index) 41 | { 42 | if (index == 0 && _child != null) return _child; 43 | return base.GetVisualChild(index); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Helper/ScrollViewerBehavior.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 AduSkin 9 | { 10 | public class ScrollViewerBehavior 11 | { 12 | public static DependencyProperty VerticalOffsetProperty = 13 | DependencyProperty.RegisterAttached("VerticalOffset", 14 | typeof(double), 15 | typeof(ScrollViewerBehavior), 16 | new UIPropertyMetadata(0.0, OnVerticalOffsetChanged)); 17 | 18 | public static void SetVerticalOffset(FrameworkElement target, double value) 19 | { 20 | target.SetValue(VerticalOffsetProperty, value); 21 | } 22 | public static double GetVerticalOffset(FrameworkElement target) 23 | { 24 | return (double)target.GetValue(VerticalOffsetProperty); 25 | } 26 | private static void OnVerticalOffsetChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) 27 | { 28 | ScrollViewer scrollViewer = target as ScrollViewer; 29 | if (scrollViewer != null) 30 | { 31 | scrollViewer.ScrollToVerticalOffset((double)e.NewValue); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/IEventArgsConverter.cs: -------------------------------------------------------------------------------- 1 | /*refrence from https://github.com/lbugnion/mvvmlight*/ 2 | 3 | //The MIT License(MIT) 4 | 5 | //Copyright(c) 2009 - 2018 Laurent Bugnion 6 | 7 | //Permission is hereby granted, free of charge, to any person obtaining a copy 8 | //of this software and associated documentation files (the "Software"), to deal 9 | //in the Software without restriction, including without limitation the rights 10 | //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | //copies of the Software, and to permit persons to whom the Software is 12 | //furnished to do so, subject to the following conditions: 13 | 14 | //The above copyright notice and this permission notice shall be included in all 15 | //copies or substantial portions of the Software. 16 | 17 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | //SOFTWARE. 24 | 25 | namespace AduSkin.Interactivity 26 | { 27 | public interface IEventArgsConverter 28 | { 29 | object Convert(object value, object parameter); 30 | } 31 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/DatePickers/AduCalendarButton.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 AduSkin.Controls.Metro 9 | { 10 | public class AduCalendarButton : Button 11 | { 12 | #region Private属性 13 | 14 | #endregion 15 | 16 | #region Fields 17 | public AduCalendar Owner { get; set; } 18 | #endregion 19 | 20 | #region 依赖属性set get 21 | 22 | #region HasSelectedDates 23 | public bool HasSelectedDates 24 | { 25 | get { return (bool)GetValue(HasSelectedDatesProperty); } 26 | set { SetValue(HasSelectedDatesProperty, value); } 27 | } 28 | 29 | public static readonly DependencyProperty HasSelectedDatesProperty = 30 | DependencyProperty.Register("HasSelectedDates", typeof(bool), typeof(AduCalendarButton), new PropertyMetadata(false)); 31 | #endregion 32 | 33 | #endregion 34 | 35 | #region Constructors 36 | static AduCalendarButton() 37 | { 38 | DefaultStyleKeyProperty.OverrideMetadata(typeof(AduCalendarButton), new FrameworkPropertyMetadata(typeof(AduCalendarButton))); 39 | } 40 | #endregion 41 | 42 | #region Override方法 43 | 44 | #endregion 45 | 46 | #region Private方法 47 | 48 | #endregion 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/IsProgressedConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Controls; 3 | using System.Windows.Data; 4 | 5 | namespace AduSkin.Controls.Converter 6 | { 7 | public class IsProgressedConverter : IMultiValueConverter 8 | { 9 | public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) 10 | { 11 | if ((values[0] is ContentControl && values[1] is int) == false) 12 | { 13 | return EnumCompare.None; 14 | } 15 | 16 | ContentControl contentControl = values[0] as ContentControl; 17 | int progress = (int)values[1]; 18 | ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(contentControl); 19 | 20 | if (itemsControl == null) 21 | { 22 | return EnumCompare.None; 23 | } 24 | 25 | int index = itemsControl.ItemContainerGenerator.IndexFromContainer(contentControl); 26 | 27 | if (index < progress) 28 | { 29 | return EnumCompare.Less; 30 | } 31 | else if (index == progress) 32 | { 33 | return EnumCompare.Equal; 34 | } 35 | return EnumCompare.Large; 36 | } 37 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) 38 | { 39 | throw new NotSupportedException(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/TriggerActionCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace AduSkin.Interactivity 5 | { 6 | public class TriggerActionCollection : AttachableCollection 7 | { 8 | internal TriggerActionCollection() 9 | { 10 | } 11 | 12 | protected override Freezable CreateInstanceCore() 13 | { 14 | return new TriggerActionCollection(); 15 | } 16 | 17 | internal override void ItemAdded(TriggerAction item) 18 | { 19 | if (item.IsHosted) 20 | throw new InvalidOperationException(ExceptionStringTable 21 | .CannotHostTriggerActionMultipleTimesExceptionMessage); 22 | if (AssociatedObject != null) 23 | item.Attach(AssociatedObject); 24 | item.IsHosted = true; 25 | } 26 | 27 | internal override void ItemRemoved(TriggerAction item) 28 | { 29 | if (((IAttachedObject) item).AssociatedObject != null) 30 | item.Detach(); 31 | item.IsHosted = false; 32 | } 33 | 34 | protected override void OnAttached() 35 | { 36 | foreach (var action in this) 37 | action.Attach(AssociatedObject); 38 | } 39 | 40 | protected override void OnDetaching() 41 | { 42 | foreach (var action in this) 43 | action.Detach(); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/Converter/StringRepeatConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace AduSkin.Demo.Converter 10 | { 11 | public class StringRepeatConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (value is string strValue) 16 | { 17 | var builder = new StringBuilder(); 18 | int num; 19 | if (parameter is string numStr) 20 | { 21 | if (!int.TryParse(numStr, out num)) 22 | { 23 | return strValue; 24 | } 25 | } 26 | else if (parameter is int intValue) 27 | { 28 | num = intValue; 29 | } 30 | else 31 | { 32 | return strValue; 33 | } 34 | for (var i = 0; i < num; i++) 35 | { 36 | builder.Append(strValue); 37 | } 38 | return builder.ToString(); 39 | } 40 | return string.Empty; 41 | } 42 | 43 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 44 | { 45 | throw new NotImplementedException(); 46 | } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/Servers/ApplicationHostService.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Metro; 2 | using AduSkin.Demo.Servers.Contracts; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Microsoft.Extensions.Hosting; 5 | using System; 6 | using System.Linq; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | 11 | namespace AduSkin.Demo.Servers 12 | { 13 | public class ApplicationHostService : IHostedService 14 | { 15 | private readonly IServiceProvider _serviceProvider; 16 | public ApplicationHostService(IServiceProvider serviceProvider) 17 | { 18 | _serviceProvider = serviceProvider; 19 | } 20 | 21 | public Task StartAsync(CancellationToken cancellationToken) 22 | { 23 | if (Application.Current.Windows.OfType().Any()) 24 | { 25 | return Task.CompletedTask; 26 | } 27 | //启动封面 28 | var splashScreen = new SplashScreen("Resources/aduskin.png"); 29 | splashScreen.Show(true); 30 | //主窗口 31 | IWindow mainWindow = _serviceProvider.GetRequiredService(); 32 | mainWindow?.Show(); 33 | //初始化通知弹框 34 | NoticeManager.Initialize(); 35 | 36 | return Task.CompletedTask; 37 | } 38 | 39 | public Task StopAsync(CancellationToken cancellationToken) 40 | { 41 | //退出 42 | NoticeManager.ExitNotification(); 43 | return Task.CompletedTask; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/AduVideoPlayer/AduVideoPlayer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net48;net47;net6-windows; 4 | true 5 | true 6 | true 7 | $(NoWarn);0067 8 | AnyCPU;x64 9 | 10 | 11 | 1.1.1.5 12 | Adu 13 | http://www.dmskin.com/image/aduskin.ico 14 | https://github.com/aduskin/AduSkin 15 | git 16 | Add new controls and demo 17 | http://www.dmskin.com/image/aduskin.ico 18 | vlc视频播放组件 19 | Copyright @ 2019 - 2025 AduSkin - WPFUI 20 | AduSkin WPF Controls 21 | Add new controls and demo 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Helper/AnimationHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Media.Animation; 4 | 5 | namespace AduSkin.Controls.Tools 6 | { 7 | /// 8 | /// 包含一些常用的动画辅助方法 9 | /// 10 | public class AnimationHelper 11 | { 12 | /// 13 | /// 创建一个Thickness动画 14 | /// 15 | /// 16 | /// 17 | /// 18 | public static ThicknessAnimation CreateAnimation(Thickness thickness = default(Thickness), double milliseconds = 200) 19 | { 20 | return new ThicknessAnimation(thickness, new Duration(TimeSpan.FromMilliseconds(milliseconds))) 21 | { 22 | EasingFunction = new PowerEase { EasingMode = EasingMode.EaseInOut } 23 | }; 24 | } 25 | 26 | /// 27 | /// 创建一个Double动画 28 | /// 29 | /// 30 | /// 31 | /// 32 | public static DoubleAnimation CreateAnimation(double toValue, double milliseconds = 200) 33 | { 34 | return new DoubleAnimation(toValue, new Duration(TimeSpan.FromMilliseconds(milliseconds))) 35 | { 36 | EasingFunction = new PowerEase { EasingMode = EasingMode.EaseInOut } 37 | }; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/FormVerificationDemo.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/StepBarDemo.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/ExpanderMenu.xaml.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Metro; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace AduSkin.Demo.UserControls 18 | { 19 | /// 20 | /// Expander.xaml 的交互逻辑 21 | /// 22 | public partial class ExpanderMenu : UserControl 23 | { 24 | public ExpanderMenu() 25 | { 26 | InitializeComponent(); 27 | 28 | foreach (FrameworkElement fe in lists.Children) 29 | { 30 | if (fe is MetroExpander) 31 | { 32 | (fe as MetroExpander).Click += delegate (object sender, EventArgs e) 33 | { 34 | if ((fe as MetroExpander).CanHide) 35 | { 36 | foreach (FrameworkElement fe1 in lists.Children) 37 | { 38 | if (fe1 is MetroExpander && fe1 != sender) 39 | { 40 | (fe1 as MetroExpander).IsExpanded = false; 41 | } 42 | } 43 | } 44 | }; 45 | } 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroCanvasGrid.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | public class MetroCanvasGrid : ContentControl 8 | { 9 | public static readonly DependencyProperty ViewportProperty = ElementBase.Property("ViewportProperty"); 10 | public Rect Viewport { get { return (Rect)GetValue(ViewportProperty); } set { SetValue(ViewportProperty, value); } } 11 | 12 | public static readonly DependencyProperty GridOpacityProperty = ElementBase.Property("GridOpacityProperty"); 13 | public static readonly DependencyProperty GridSizeProperty = ElementBase.Property("GridSizeProperty"); 14 | public static readonly DependencyProperty CornerRadiusProperty = ElementBase.Property("CornerRadiusProperty"); 15 | 16 | public double GridOpacity { get { return (double)GetValue(GridOpacityProperty); } set { SetValue(GridOpacityProperty, value); } } 17 | public CornerRadius CornerRadius { get { return (CornerRadius)GetValue(CornerRadiusProperty); } set { SetValue(CornerRadiusProperty, value); } } 18 | 19 | public bool IsApplyTheme { get; set; } //= true; 20 | 21 | public MetroCanvasGrid() 22 | { 23 | 24 | } 25 | 26 | static MetroCanvasGrid() 27 | { 28 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/Badge/AduBadge.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | /// 8 | /// 右上角角标控件 9 | /// 10 | public class AduBadge : Control 11 | { 12 | #region 依赖属性定义 13 | public static readonly DependencyProperty NumberProperty = DependencyProperty.Register("Number" 14 | , typeof(int), typeof(AduBadge), new FrameworkPropertyMetadata(0)); 15 | 16 | public static readonly DependencyProperty IsDotProperty; 17 | 18 | #endregion 19 | 20 | #region 依赖属性set get 21 | /// 22 | /// 获取或者设置角标中显示的数字 23 | /// 24 | public int Number 25 | { 26 | get { return (int)GetValue(NumberProperty); } 27 | set { SetValue(NumberProperty, value); } 28 | } 29 | 30 | /// 31 | /// 获取或者设置角标的样式是否显示成一个圆点 32 | /// 33 | public bool IsDot 34 | { 35 | get { return (bool)GetValue(IsDotProperty); } 36 | set { SetValue(IsDotProperty, value); } 37 | } 38 | #endregion 39 | 40 | #region Constructors 41 | static AduBadge() 42 | { 43 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 44 | 45 | IsDotProperty = DependencyProperty.Register("IsDot", typeof(bool), typeof(AduBadge), new FrameworkPropertyMetadata(false)); 46 | } 47 | 48 | public AduBadge() 49 | { 50 | 51 | } 52 | #endregion 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Interop/SafeFileMappingHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Security; 4 | using System.Security.Permissions; 5 | using Microsoft.Win32.SafeHandles; 6 | 7 | namespace AduSkin.Controls.Tools.Interop 8 | { 9 | internal sealed class SafeFileMappingHandle : SafeHandleZeroOrMinusOneIsInvalid 10 | { 11 | [SecurityCritical] 12 | internal SafeFileMappingHandle(IntPtr handle) : base(false) 13 | { 14 | SetHandle(handle); 15 | } 16 | 17 | [SecurityCritical, SecuritySafeCritical] 18 | internal SafeFileMappingHandle() : base(true) 19 | { 20 | } 21 | 22 | public override bool IsInvalid 23 | { 24 | [SecurityCritical, SecuritySafeCritical] 25 | get => handle == IntPtr.Zero; 26 | } 27 | 28 | [SecurityCritical, SecuritySafeCritical] 29 | protected override bool ReleaseHandle() 30 | { 31 | new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert(); 32 | try 33 | { 34 | return CloseHandleNoThrow(new HandleRef(null, handle)); 35 | } 36 | finally 37 | { 38 | CodeAccessPermission.RevertAssert(); 39 | } 40 | } 41 | 42 | [SecurityCritical] 43 | public static bool CloseHandleNoThrow(HandleRef handle) 44 | { 45 | HandleCollector.Remove((IntPtr)handle, CommonHandles.Kernel); 46 | var result = InteropMethods.IntCloseHandle(handle); 47 | return result; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/MessageBoxDemo.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/ViewModel/DemoViewModel/StepBarDemoVM.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace AduSkin.Demo.ViewModel.DemoViewModel 6 | { 7 | public partial class StepBarDemoVM : ObservableObject 8 | { 9 | public StepBarDemoVM() 10 | { 11 | StepItems.Add("第一步"); 12 | StepItems.Add("第二步"); 13 | StepItems.Add("第三步"); 14 | StepItems.Add("第四步"); 15 | } 16 | private ObservableCollection _StepItems = new ObservableCollection(); 17 | /// 18 | /// 步骤 19 | /// 20 | public ObservableCollection StepItems 21 | { 22 | get { return _StepItems; } 23 | set 24 | { 25 | _StepItems = value; 26 | OnPropertyChanged("StepItems"); 27 | } 28 | } 29 | private int _StepIndex; 30 | /// 31 | /// 属性 32 | /// 33 | public int StepIndex 34 | { 35 | get { return _StepIndex; } 36 | set 37 | { 38 | _StepIndex = value; 39 | OnPropertyChanged("StepIndex"); 40 | } 41 | } 42 | [RelayCommand] 43 | public void Next(string e) 44 | { 45 | if (StepIndex >= StepItems.Count) 46 | return; 47 | StepIndex += 1; 48 | } 49 | [RelayCommand] 50 | public void Up(string e) 51 | { 52 | if (StepIndex > 0) 53 | { 54 | StepIndex -= 1; 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/Base/RegularItemsControl.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Data; 2 | using System.Windows; 3 | 4 | namespace AduSkin.Controls.Metro 5 | { 6 | /// 7 | /// 规则ItemsControl 8 | /// 9 | /// 10 | /// 该类的每一项都具有相同的大小和外边距 11 | /// 12 | public class RegularItemsControl : SimpleItemsControl 13 | { 14 | public static readonly DependencyProperty ItemWidthProperty = DependencyProperty.Register( 15 | "ItemWidth", typeof(double), typeof(RegularItemsControl), new PropertyMetadata(ValueBoxes.Double200Box)); 16 | 17 | public double ItemWidth 18 | { 19 | get => (double) GetValue(ItemWidthProperty); 20 | set => SetValue(ItemWidthProperty, value); 21 | } 22 | 23 | public static readonly DependencyProperty ItemHeightProperty = DependencyProperty.Register( 24 | "ItemHeight", typeof(double), typeof(RegularItemsControl), new PropertyMetadata(ValueBoxes.Double200Box)); 25 | 26 | public double ItemHeight 27 | { 28 | get => (double) GetValue(ItemHeightProperty); 29 | set => SetValue(ItemHeightProperty, value); 30 | } 31 | 32 | public static readonly DependencyProperty ItemMarginProperty = DependencyProperty.Register( 33 | "ItemMargin", typeof(Thickness), typeof(RegularItemsControl), new PropertyMetadata(default(Thickness))); 34 | 35 | public Thickness ItemMargin 36 | { 37 | get => (Thickness) GetValue(ItemMarginProperty); 38 | set => SetValue(ItemMarginProperty, value); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/AduShield.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls.Primitives; 4 | using System.Windows.Markup; 5 | using System.Windows.Media; 6 | 7 | namespace AduSkin.Controls.Metro 8 | { 9 | [ContentProperty(nameof(Status))] 10 | public class AduShield : ButtonBase 11 | { 12 | public AduShield() 13 | { 14 | 15 | } 16 | 17 | static AduShield() 18 | { 19 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 20 | } 21 | 22 | public static readonly DependencyProperty SubjectProperty = DependencyProperty.Register( 23 | "Subject", typeof(string), typeof(AduShield), new PropertyMetadata(default(string))); 24 | 25 | public string Subject 26 | { 27 | get => (string)GetValue(SubjectProperty); 28 | set => SetValue(SubjectProperty, value); 29 | } 30 | 31 | public static readonly DependencyProperty StatusProperty = DependencyProperty.Register( 32 | "Status", typeof(object), typeof(AduShield), new PropertyMetadata(default(object))); 33 | 34 | public object Status 35 | { 36 | get => GetValue(StatusProperty); 37 | set => SetValue(StatusProperty, value); 38 | } 39 | 40 | public static readonly DependencyProperty ColorProperty = DependencyProperty.Register( 41 | "Color", typeof(Brush), typeof(AduShield), new PropertyMetadata(default(Brush))); 42 | 43 | public Brush Color 44 | { 45 | get => (Brush)GetValue(ColorProperty); 46 | set => SetValue(ColorProperty, value); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Demo.Servers; 2 | using AduSkin.Demo.Servers.Contracts; 3 | using AduSkin.Demo.Servers.Extensions; 4 | using AduSkin.Demo.ViewModel; 5 | using Microsoft.Extensions.Configuration; 6 | using Microsoft.Extensions.DependencyInjection; 7 | using Microsoft.Extensions.Hosting; 8 | using System; 9 | using System.Reflection; 10 | using System.Text; 11 | using System.Windows; 12 | 13 | namespace AduSkin.Demo 14 | { 15 | public partial class App : Application 16 | { 17 | public static Assembly Asssembly => Assembly.GetExecutingAssembly(); 18 | 19 | private static readonly IHost _host = Host.CreateDefaultBuilder() 20 | .ConfigureAppConfiguration(c => 21 | { 22 | _ = c.SetBasePath(AppContext.BaseDirectory); 23 | }) 24 | .ConfigureServices((context, services) => 25 | { 26 | services.AddHostedService(); 27 | 28 | services.AddSingleton(); 29 | services.AddSingleton(); 30 | 31 | services.AddTransientFromNamespace("AduSkin.Demo.Views", Asssembly); 32 | 33 | services.AddTransientFromNamespace("AduSkin.Demo.ViewModel", Asssembly); 34 | 35 | }).Build(); 36 | public App() 37 | { 38 | Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); 39 | } 40 | protected override void OnStartup(StartupEventArgs e) 41 | { 42 | _host.Start(); 43 | } 44 | protected override void OnExit(ExitEventArgs e) 45 | { 46 | _host.StopAsync().Wait(); 47 | _host.Dispose(); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/NoticeDemo.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/ViewModel/DemoViewModel/FormVerificationDemoViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using System; 3 | using System.ComponentModel; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | namespace AduSkin.Demo.ViewModel 7 | { 8 | public class FormVerificationDemoViewModel : ObservableValidator, INotifyDataErrorInfo 9 | { 10 | private string _Name; 11 | /// 12 | /// 名称 13 | /// 14 | [Required(ErrorMessage = "请输入用户名.")] 15 | [MaxLength(30, ErrorMessage = "用户名长度不能大于30.")] 16 | [MinLength(3, ErrorMessage = "用户名长度不能小于3.")] 17 | public string Name 18 | { 19 | get { return _Name; } 20 | set 21 | { 22 | SetProperty(ref _Name, value, true); 23 | } 24 | } 25 | 26 | private int _Age; 27 | /// 28 | /// 年龄 29 | /// 30 | [Required(ErrorMessage = "请输入年龄.")] 31 | [Range(0, 120, ErrorMessage = "年龄范围0~120.")] 32 | public int Age 33 | { 34 | get { return _Age; } 35 | set 36 | { 37 | SetProperty(ref _Age, value, true); 38 | } 39 | } 40 | 41 | private string _Address; 42 | /// 43 | /// 地址 44 | /// 45 | [Required(ErrorMessage = "请输入地址.")] 46 | [MaxLength(30, ErrorMessage = "地址长度不能大于30.")] 47 | [MinLength(0, ErrorMessage = "地址长度不能小于0.")] 48 | public string Address 49 | { 50 | get { return _Address; } 51 | set 52 | { 53 | SetProperty(ref _Address, value, true); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Converter/CalendarDayButtonTypeConverter.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 | 9 | namespace AduSkin.Controls.Converter 10 | { 11 | /// 12 | /// true则隐藏,false则显示 13 | /// 14 | public class CalendarDayButtonTypeConverter : IMultiValueConverter 15 | { 16 | #region IValueConverter 成员 17 | 18 | public object Convert(object[] value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 19 | { 20 | string str = string.Empty; 21 | List list = (List)value[0]; 22 | if (list.Count > 1) 23 | { 24 | DateTime dtStart = ((List)value[0])[0]; 25 | DateTime dtEnd = ((List)value[0])[1]; 26 | DateTime dtDayButton = (DateTime)value[1]; 27 | if (dtDayButton == dtStart) 28 | { 29 | str = "Left"; 30 | } 31 | else if(dtDayButton > dtStart && dtDayButton < dtEnd) 32 | { 33 | str = "Middle"; 34 | } 35 | else if(dtDayButton == dtEnd) 36 | { 37 | str = "Right"; 38 | } 39 | } 40 | return str; 41 | } 42 | public object[] ConvertBack(object value, Type[] targetType, object parameter, System.Globalization.CultureInfo culture) 43 | { 44 | return null; 45 | } 46 | #endregion 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/DefaultTriggerAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Globalization; 4 | 5 | namespace AduSkin.Interactivity 6 | { 7 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = true)] 8 | public sealed class DefaultTriggerAttribute : Attribute 9 | { 10 | private readonly object[] _parameters; 11 | 12 | public DefaultTriggerAttribute(Type targetType, Type triggerType, object parameter) : this(targetType, 13 | triggerType, new[] {parameter}) 14 | { 15 | } 16 | 17 | public DefaultTriggerAttribute(Type targetType, Type triggerType, params object[] parameters) 18 | { 19 | if (!typeof(TriggerBase).IsAssignableFrom(triggerType)) 20 | throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, 21 | ExceptionStringTable.DefaultTriggerAttributeInvalidTriggerTypeSpecifiedExceptionMessage, 22 | new object[] {triggerType.Name})); 23 | TargetType = targetType; 24 | TriggerType = triggerType; 25 | _parameters = parameters; 26 | } 27 | 28 | public IEnumerable Parameters => 29 | _parameters; 30 | 31 | public Type TargetType { get; } 32 | 33 | public Type TriggerType { get; } 34 | 35 | public TriggerBase Instantiate() 36 | { 37 | object obj2 = null; 38 | try 39 | { 40 | obj2 = Activator.CreateInstance(TriggerType, _parameters); 41 | } 42 | catch 43 | { 44 | // ignored 45 | } 46 | return (TriggerBase) obj2; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Helper/ResourceHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace AduSkin.Controls.Tools.Helper 9 | { 10 | /// 11 | /// 资源帮助类 12 | /// 13 | public class ResourceHelper 14 | { 15 | /// 16 | /// 获取字符串 17 | /// 18 | /// 19 | /// 20 | public static string GetString(string key) => Application.Current.TryFindResource(key) as string; 21 | 22 | /// 23 | /// 获取字符串 24 | /// 25 | /// 26 | /// 27 | /// 28 | public static string GetString(string separator = ";", params string[] keyArr) => 29 | string.Join(separator, keyArr.Select(key => Application.Current.TryFindResource(key) as string).ToList()); 30 | 31 | /// 32 | /// 获取字符串 33 | /// 34 | /// 35 | /// 36 | public static List GetStringList(params string[] keyArr) => keyArr.Select(key => Application.Current.TryFindResource(key) as string).ToList(); 37 | 38 | /// 39 | /// 获取资源 40 | /// 41 | /// 42 | /// 43 | public static T GetResource(string key) 44 | { 45 | if (Application.Current.TryFindResource(key) is T resource) 46 | { 47 | return resource; 48 | } 49 | 50 | return default; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/AduSkin/AduSkin.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net47;net48;net6-windows;net9.0-windows; 4 | true 5 | true 6 | true 7 | $(NoWarn);0067 8 | logo.png 9 | 10 | 1.2.0.0 11 | 12 | 一款简单漂亮的WPF UI 13 | A Beautiful WPF Control UI 14 | 15 | AnyCPU;x64 16 | AduSkin 17 | WPF UI 18 | 控件细节优化 19 | false 20 | README.md 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | True 34 | 35 | 36 | 37 | 38 | True 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/ViewModel/DemoViewModel/MessageBoxDemoViewModel.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls.Metro; 2 | using CommunityToolkit.Mvvm.ComponentModel; 3 | using CommunityToolkit.Mvvm.Input; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Input; 7 | 8 | namespace AduSkin.Demo.ViewModel 9 | { 10 | public partial class MessageBoxDemoViewModel : ObservableObject 11 | { 12 | /// 13 | /// 命令Command 14 | /// 15 | [RelayCommand] 16 | private void OpenMessageBox(string e) 17 | { 18 | switch (e) 19 | { 20 | case "普通弹框": 21 | AduMessageBox.Show("AduSkin\n追求极致,永臻完美\n且随疾风前行,身后一许流星"); 22 | break; 23 | case "普通弹框2": 24 | AduMessageBox.Show("AduSkin正在美化中!", "AduSkin 标题"); 25 | break; 26 | case "确认取消弹框": 27 | AduMessageBox.Show("您是否继续支持AduSkin!", "AduSkin 标题", MessageBoxButton.OKCancel); 28 | break; 29 | case "带图标确认取消弹框": 30 | AduMessageBox.Show("您是否继续支持AduSkin!", "AduSkin 标题", MessageBoxButton.YesNo, MessageBoxImage.Asterisk); 31 | break; 32 | case "自定义弹框": 33 | MessageBoxResult result = AduMessageBox.ShowYesNoCancel( 34 | "您是否继续支持AduSkin?", 35 | "欢迎使用AduSkin!", 36 | "希望", 37 | "不希望", 38 | "暂不使用", 39 | MessageBoxImage.Exclamation); 40 | 41 | NoticeManager.NotificationShow.AddNotification(new NotificationModel() 42 | { 43 | Title = "返回结果", 44 | Content = result.ToString() 45 | }); 46 | break; 47 | default: 48 | break; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Helper/VisualHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Windows; 3 | using System.Windows.Media; 4 | 5 | namespace AduSkin.Controls.Tools 6 | { 7 | public class VisualHelper 8 | { 9 | internal static VisualStateGroup TryGetVisualStateGroup(DependencyObject d, string groupName) 10 | { 11 | var root = GetImplementationRoot(d); 12 | if (root == null) 13 | { 14 | return null; 15 | } 16 | 17 | return VisualStateManager 18 | .GetVisualStateGroups(root)? 19 | .OfType() 20 | .FirstOrDefault(group => string.CompareOrdinal(groupName, group.Name) == 0); 21 | } 22 | 23 | internal static FrameworkElement GetImplementationRoot(DependencyObject d) 24 | { 25 | return 1 == VisualTreeHelper.GetChildrenCount(d) 26 | ? VisualTreeHelper.GetChild(d, 0) as FrameworkElement 27 | : null; 28 | } 29 | 30 | internal static T GetChild(DependencyObject d) where T : DependencyObject 31 | { 32 | if (d is T t) 33 | { 34 | return t; 35 | } 36 | 37 | for (int i = 0; i < VisualTreeHelper.GetChildrenCount(d); i++) 38 | { 39 | var child = VisualTreeHelper.GetChild(d, i); 40 | 41 | var result = GetChild(child); 42 | if (result != null) return result; 43 | } 44 | 45 | return default(T); 46 | } 47 | 48 | /// 49 | /// 获取当前应用中处于激活的一个窗口 50 | /// 51 | /// 52 | public static Window GetActiveWindow() => Application.Current.Windows.OfType().SingleOrDefault(x => x.IsActive); 53 | } 54 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Tools/Extension/GeometryExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Media; 4 | using AduSkin.Controls.Expression.Drawing; 5 | 6 | namespace AduSkin.Controls.Tools.Extension 7 | { 8 | public static class GeometryExtension 9 | { 10 | /// 11 | /// 获取路径总长度 12 | /// 13 | /// 14 | /// 15 | public static double GetTotalLength(this Geometry geometry) 16 | { 17 | if (geometry == null) return 0; 18 | 19 | var pathGeometry = PathGeometry.CreateFromGeometry(geometry); 20 | pathGeometry.GetPointAtFractionLength(1e-4, out var point, out _); 21 | var length = (pathGeometry.Figures[0].StartPoint - point).Length * 1e+4; 22 | 23 | return length; 24 | } 25 | 26 | /// 27 | /// 获取路径总长度 28 | /// 29 | /// 30 | /// 31 | /// 32 | /// 33 | public static double GetTotalLength(this Geometry geometry, Size size, double strokeThickness = 1) 34 | { 35 | if (geometry == null) return 0; 36 | 37 | if (MathHelper.IsVerySmall(size.Width) || MathHelper.IsVerySmall(size.Height)) return 0; 38 | 39 | var length = GetTotalLength(geometry); 40 | var sw = geometry.Bounds.Width / size.Width; 41 | var sh = geometry.Bounds.Height / size.Height; 42 | var min = Math.Min(sw, sh); 43 | 44 | if (MathHelper.IsVerySmall(min) || MathHelper.IsVerySmall(strokeThickness)) return 0; 45 | 46 | length /= min; 47 | return length / strokeThickness; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/AduSkin/Themes/Metro/MetroGroupBox.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 32 | 33 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Helper/ExtensionMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Interop; 7 | using System.Windows.Media; 8 | using System.Windows.Media.Imaging; 9 | 10 | namespace AduSkin.Controls.Helper 11 | { 12 | internal static class ExtensionMethod 13 | { 14 | internal static ImageSource ToImageSource(this Icon icon) 15 | { 16 | ImageSource imageSource = Imaging.CreateBitmapSourceFromHIcon( 17 | icon.Handle, 18 | Int32Rect.Empty, 19 | BitmapSizeOptions.FromEmptyOptions()); 20 | 21 | return imageSource; 22 | } 23 | 24 | /// 25 | /// Keyboard Accellerators are used in Windows to allow easy shortcuts to controls like Buttons and 26 | /// MenuItems. These allow users to press the Alt key, and a shortcut key will be highlighted on the 27 | /// control. If the user presses that key, that control will be activated. 28 | /// This method checks a string if it contains a keyboard accellerator. If it doesn't, it adds one to the 29 | /// beginning of the string. If there are two strings with the same accellerator, Windows handles it. 30 | /// The keyboard accellerator character for WPF is underscore (_). It will not be visible. 31 | /// 32 | /// 33 | /// 34 | internal static string TryAddKeyboardAccellerator(this string input) 35 | { 36 | const string accellerator = "_"; // This is the default WPF accellerator symbol - used to be & in WinForms 37 | 38 | // If it already contains an accellerator, do nothing 39 | if (input.Contains(accellerator)) return input; 40 | 41 | return accellerator + input; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroWebBrowser.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Diagnostics; 4 | using System.Reflection; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | 8 | namespace AduSkin.Controls.Metro 9 | { 10 | public partial class MetroWebBrowser : UserControl 11 | { 12 | public bool InDesignMode { get; set; } //= false; 13 | public Uri Source 14 | { 15 | get 16 | { 17 | return web.Url; 18 | } 19 | set 20 | { 21 | if (!DesignerProperties.GetIsInDesignMode(this) || InDesignMode) 22 | { 23 | webp.Visibility = Visibility.Visible; 24 | web.Url = value; 25 | } 26 | } 27 | } 28 | 29 | public string Document 30 | { 31 | get { return web.DocumentText; } 32 | set 33 | { 34 | if (!DesignerProperties.GetIsInDesignMode(this) || InDesignMode) 35 | { 36 | webp.Visibility = Visibility.Visible; 37 | web.DocumentText = value; 38 | } 39 | } 40 | } 41 | 42 | public MetroWebBrowser() 43 | { 44 | InitializeComponent(); 45 | web.NewWindow += delegate (object sender, CancelEventArgs e) 46 | { 47 | if (web.StatusText.StartsWith("http", StringComparison.CurrentCultureIgnoreCase)) 48 | { 49 | Navigate(web.StatusText); 50 | } 51 | // 禁止跳出当前窗口 52 | e.Cancel = true; 53 | }; 54 | } 55 | 56 | public void Navigate(string url) 57 | { 58 | // web.Navigate(new Uri(url)); 59 | Source = new Uri(url); 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/TextBlock/TextBlockHighlightSourceConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Globalization; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | public class TextBlockHighlightSourceConverter : TypeConverter 8 | { 9 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) 10 | { 11 | if (sourceType == typeof(string)) 12 | { 13 | return true; 14 | } 15 | 16 | return base.CanConvertFrom(context, sourceType); 17 | } 18 | 19 | 20 | public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) 21 | { 22 | if (destinationType == typeof(TextBlockHighlightSource)) 23 | { 24 | return true; 25 | } 26 | 27 | return base.CanConvertTo(context, destinationType); 28 | } 29 | 30 | public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) 31 | { 32 | switch (value) 33 | { 34 | case null: 35 | throw GetConvertFromException(null); 36 | case string source: 37 | return new TextBlockHighlightSource { Text = value.ToString() }; 38 | } 39 | 40 | return base.ConvertFrom(context, culture, value); 41 | } 42 | 43 | public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) 44 | { 45 | switch (value) 46 | { 47 | case TextBlockHighlightSource instance: 48 | if (destinationType == typeof(string)) 49 | { 50 | return instance.Text; 51 | } 52 | break; 53 | } 54 | 55 | return base.ConvertTo(context, culture, value, destinationType); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Helper/ValidateHelper.cs: -------------------------------------------------------------------------------- 1 | namespace AduSkin.Controls.Helper 2 | { 3 | /// 4 | /// 验证帮助类 5 | /// 6 | public class ValidateHelper 7 | { 8 | /// 9 | /// 是否在浮点数范围内 10 | /// 11 | /// 12 | /// 13 | public static bool IsInRangeOfDouble(object value) 14 | { 15 | var v = (double)value; 16 | return !(double.IsNaN(v) || double.IsInfinity(v)); 17 | } 18 | 19 | /// 20 | /// 是否在正浮点数范围内 21 | /// 22 | /// 23 | /// 24 | /// 25 | public static bool IsInRangeOfPosDouble(object value, bool includeZero = false) 26 | { 27 | var v = (double)value; 28 | return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v >= 0 : v > 0); 29 | } 30 | 31 | /// 32 | /// 是否在负浮点数范围内 33 | /// 34 | /// 35 | /// 36 | /// 37 | public static bool IsInRangeOfNegDouble(object value, bool includeZero = false) 38 | { 39 | var v = (double)value; 40 | return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v <= 0 : v < 0); 41 | } 42 | /// 43 | /// 是否在正浮点数范围内(包括0) 44 | /// 45 | /// 46 | /// 47 | public static bool IsInRangeOfPosDoubleIncludeZero(object value) 48 | { 49 | var v = (double)value; 50 | return !(double.IsNaN(v) || double.IsInfinity(v)) && v >= 0; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroVisualElement.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace AduSkin.Controls.Metro 7 | { 8 | public class MetroVisualElement: ContentControl 9 | { 10 | public static readonly DependencyProperty VisualProperty = ElementBase.Property("VisualProperty"); 11 | public static readonly DependencyProperty VisualOpacityProperty = ElementBase.Property("VisualOpacityProperty"); 12 | public static readonly DependencyProperty VisualBlurRadiusProperty = ElementBase.Property("VisualBlurRadiusProperty"); 13 | public static readonly DependencyProperty LeftProperty = ElementBase.Property("LeftProperty"); 14 | public static readonly DependencyProperty TopProperty = ElementBase.Property("TopProperty"); 15 | 16 | public Visual Visual { get { return (Visual)GetValue(VisualProperty); } set { SetValue(VisualProperty, value); } } 17 | public new double VisualOpacity { get { return (double)GetValue(VisualOpacityProperty); } set { SetValue(VisualOpacityProperty, value); } } 18 | public double VisualBlurRadius { get { return (double)GetValue(VisualBlurRadiusProperty); } set { SetValue(VisualBlurRadiusProperty, value); } } 19 | public double Left { get { return (double)GetValue(LeftProperty); } set { SetValue(LeftProperty, value); } } 20 | public double Top { get { return (double)GetValue(TopProperty); } set { SetValue(TopProperty, value); } } 21 | 22 | public MetroVisualElement() 23 | { 24 | 25 | } 26 | 27 | static MetroVisualElement() 28 | { 29 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/AduSkin/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Markup; 3 | 4 | [assembly: ThemeInfo( 5 | ResourceDictionaryLocation.None, //主题资源字典位置 6 | ResourceDictionaryLocation.SourceAssembly //常规资源字典位置 7 | )] 8 | 9 | //命名空间映射 10 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Commen")] 11 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls")] 12 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Attach")] 13 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Converter")] 14 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Data")] 15 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Data.Args")] 16 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Expression.Drawing")] 17 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Helper")] 18 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Metro")] 19 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Tools")] 20 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Tools.Extension")] 21 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Controls.Tools.Interop")] 22 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Interactivity")] 23 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Utility.AduMethod")] 24 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Utility.Computer")] 25 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Utility.Element")] 26 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Utility.Extend")] 27 | [assembly: XmlnsDefinition("https://github.com/aduskin", "AduSkin.Utility.Media")] 28 | [assembly: XmlnsDefinition("https://github.com/aduskin", " AduSkin.Themes")] -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/UploadPic.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using AduSkin.Controls.Metro; 16 | using Microsoft.Win32; 17 | 18 | namespace AduSkin.Demo.UserControls 19 | { 20 | /// 21 | /// ucUploadPic.xaml 的交互逻辑 22 | /// 23 | public partial class UploadPic : UserControl 24 | { 25 | public UploadPic() 26 | { 27 | InitializeComponent(); 28 | this.DataContext = Capture; 29 | } 30 | public ObservableCollection Capture = new ObservableCollection(); 31 | 32 | /// 33 | /// 移除截图 34 | /// 35 | /// 36 | /// 37 | private void Delete_Click(object sender, RoutedEventArgs e) 38 | { 39 | Capture.Remove(((AduPathIconButton)sender).DataContext.ToString()); 40 | } 41 | 42 | private void AduPathIconButton_Click(object sender, RoutedEventArgs e) 43 | { 44 | OpenFileDialog FileDialog = new OpenFileDialog(); 45 | FileDialog.Multiselect = true; 46 | FileDialog.Filter = "图片|*.jpg;*.png;*.bmp;*.gif"; 47 | if (FileDialog.ShowDialog() == true) 48 | { 49 | foreach (var item in FileDialog.FileNames) 50 | { 51 | if (!Capture.Contains(item)) 52 | { 53 | Capture.Add(item); 54 | } 55 | 56 | } 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/AduSkin/Controls/Helper/ChoosePathHelper.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace AduSkin.Controls.Helper 3 | { 4 | public static class ChoosePathHelper 5 | { 6 | /// 7 | /// ChooseSingleFile 8 | /// 9 | public static string ChooseSingleFile(string filter = "All File|*.*", bool isMultiselect = false) 10 | { 11 | string result = null; 12 | System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); 13 | openFileDialog.Multiselect = isMultiselect; 14 | openFileDialog.Filter = filter; 15 | if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) 16 | result = openFileDialog.FileName; 17 | return result; 18 | } 19 | /// 20 | /// ChooseSaveFile 21 | /// 22 | public static string ChooseSaveFile(string filter = "TxtFile|*.*", string defaultFileName = "NewFile", string defaultExt = ".txt") 23 | { 24 | string result = null; 25 | System.Windows.Forms.SaveFileDialog fileDialog = new System.Windows.Forms.SaveFileDialog(); 26 | fileDialog.Filter = filter; 27 | fileDialog.FileName = defaultFileName; 28 | fileDialog.DefaultExt = defaultExt; 29 | fileDialog.AddExtension = true; 30 | if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) 31 | result = fileDialog.FileName; 32 | return result; 33 | } 34 | /// 35 | /// ChooseFolder 36 | /// 37 | public static string ChooseFolder() 38 | { 39 | string result = null; 40 | System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog(); 41 | if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) 42 | result = folderDialog.SelectedPath; 43 | return result; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/AduSkin/Utility/Resource/ResourceUtility.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls; 2 | using System; 3 | using System.Reflection; 4 | using System.Windows; 5 | 6 | namespace AduSkin.Utility.Resource 7 | { 8 | public class ResourceUtility 9 | { 10 | /// 11 | /// 默认控件样式 12 | /// 13 | public static string AduSkin = "pack://application:,,,/AduSkin;component/Themes/AduSkin.xaml"; 14 | /// 15 | /// 画刷 16 | /// 17 | public static string Theme = "pack://application:,,,/AduSkin;component/Themes/Theme.xaml"; 18 | /// 19 | /// 获取主题颜色 20 | /// 21 | public static string Color = "pack://application:,,,/AduSkin;component/Themes/Colors/{0}.xaml"; 22 | /// 23 | /// 控件样式 24 | /// 25 | public static ResourceDictionary GetControlSkin() => new ResourceDictionary() { Source = new Uri(AduSkin, UriKind.Absolute) }; 26 | /// 27 | /// 获取主题 28 | /// 29 | public static ResourceDictionary GetTheme() => new ResourceDictionary() { Source = new Uri(Theme, UriKind.Absolute) }; 30 | /// 31 | ///获取自带皮肤 32 | /// 33 | public static ResourceDictionary GetSkin(SkinType skin) => new ResourceDictionary() { Source = new Uri(string.Format(Color, skin.ToString()), UriKind.Absolute) }; 34 | /// 35 | /// 获取其他程序定义的皮肤 36 | /// 37 | public static ResourceDictionary GetSkin(Assembly assembly, string themePath, SkinType skin) 38 | { 39 | try 40 | { 41 | return new ResourceDictionary { Source = new Uri($"pack://application:,,,/{assembly.GetName().Name};component/{themePath}/{skin}.xaml") }; 42 | } 43 | catch 44 | { 45 | return new ResourceDictionary { Source = new Uri(string.Format(Color, SkinType.Light.ToString()), UriKind.Absolute) }; 46 | } 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/ViewModel/DemoViewModel/NoticeDemoViewModel.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Controls; 2 | using AduSkin.Controls.Metro; 3 | using CommunityToolkit.Mvvm.ComponentModel; 4 | using CommunityToolkit.Mvvm.Input; 5 | using System.Windows.Input; 6 | 7 | namespace AduSkin.Demo.ViewModel 8 | { 9 | public partial class NoticeDemoViewModel : ObservableObject 10 | { 11 | #region 右侧弹框 12 | /// 13 | /// 命令Command 14 | /// 15 | [RelayCommand] 16 | public void OpenMsg(string e) 17 | { 18 | switch (e) 19 | { 20 | case "Error": 21 | NoticeManager.NotificationShow.AddNotification(new NotificationModel() 22 | { 23 | Title = "这是Error通知标题", 24 | Content = "这条通知不会自动关闭,需要点击关闭按钮", 25 | NotificationType = EnumPromptType.Error 26 | }); 27 | return; 28 | case "Success": 29 | NoticeManager.NotificationShow.AddNotification(new NotificationModel() 30 | { 31 | Title = "这是Success通知标题", 32 | Content = "这条通知不会自动关闭,需要点击关闭按钮这条通知不会自动关闭,需要点击关闭按钮这条通知不会自动关闭,需要点击关闭按钮", 33 | NotificationType = EnumPromptType.Success 34 | }); 35 | return; 36 | case "Warm": 37 | NoticeManager.NotificationShow.AddNotification(new NotificationModel() 38 | { 39 | Title = "这是Warn通知标题", 40 | Content = "这条通知不会自动关闭,需要点击关闭按钮", 41 | NotificationType = EnumPromptType.Warn 42 | }); 43 | return; 44 | case "Info": 45 | NoticeManager.NotificationShow.AddNotification(new NotificationModel() 46 | { 47 | Title = "这是Info通知标题", 48 | Content = "这条通知不会自动关闭" 49 | }); 50 | return; 51 | } 52 | } 53 | #endregion 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/AduSkin.Demo/UserControls/Demos/MultiFunctionTabControl.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/AduSkin/Interactivity/TransitionEffect.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | using System.Windows.Media.Effects; 4 | 5 | namespace AduSkin.Interactivity 6 | { 7 | public abstract class TransitionEffect : ShaderEffect 8 | { 9 | // Fields 10 | public static readonly DependencyProperty InputProperty = 11 | RegisterPixelShaderSamplerProperty("Input", typeof(TransitionEffect), 0, SamplingMode.NearestNeighbor); 12 | 13 | public static readonly DependencyProperty OldImageProperty = 14 | RegisterPixelShaderSamplerProperty("OldImage", typeof(TransitionEffect), 1, SamplingMode.NearestNeighbor); 15 | 16 | public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register("Progress", 17 | typeof(double), typeof(TransitionEffect), new PropertyMetadata(0.0, PixelShaderConstantCallback(0))); 18 | 19 | // Methods 20 | protected TransitionEffect() 21 | { 22 | UpdateShaderValue(InputProperty); 23 | UpdateShaderValue(OldImageProperty); 24 | UpdateShaderValue(ProgressProperty); 25 | } 26 | 27 | // Properties 28 | public Brush Input 29 | { 30 | get => 31 | (Brush) GetValue(InputProperty); 32 | set => SetValue(InputProperty, value); 33 | } 34 | 35 | public Brush OldImage 36 | { 37 | get => 38 | (Brush) GetValue(OldImageProperty); 39 | set => SetValue(OldImageProperty, value); 40 | } 41 | 42 | public double Progress 43 | { 44 | get => 45 | (double) GetValue(ProgressProperty); 46 | set => SetValue(ProgressProperty, value); 47 | } 48 | 49 | public new TransitionEffect CloneCurrentValue() 50 | { 51 | return (TransitionEffect) base.CloneCurrentValue(); 52 | } 53 | 54 | protected abstract TransitionEffect DeepCopy(); 55 | } 56 | } -------------------------------------------------------------------------------- /src/AduSkin/Controls/Metro/MetroSwitch.cs: -------------------------------------------------------------------------------- 1 | using AduSkin.Utility.Element; 2 | using System.Windows; 3 | using System.Windows.Controls.Primitives; 4 | 5 | namespace AduSkin.Controls.Metro 6 | { 7 | public class MetroSwitch : ToggleButton 8 | { 9 | public static readonly DependencyProperty TextHorizontalAlignmentProperty = ElementBase.Property("TextHorizontalAlignmentProperty", HorizontalAlignment.Left); 10 | public static readonly DependencyProperty CornerRadiusProperty = ElementBase.Property("CornerRadiusProperty", new CornerRadius(10)); 11 | public static readonly DependencyProperty BorderCornerRadiusProperty = ElementBase.Property("BorderCornerRadiusProperty", new CornerRadius(12)); 12 | 13 | public HorizontalAlignment TextHorizontalAlignment { get { return (HorizontalAlignment)GetValue(TextHorizontalAlignmentProperty); } set { SetValue(TextHorizontalAlignmentProperty, value); } } 14 | public CornerRadius CornerRadius { get { return (CornerRadius)GetValue(CornerRadiusProperty); } set { SetValue(CornerRadiusProperty, value); } } 15 | public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } 16 | 17 | public MetroSwitch() 18 | { 19 | 20 | Loaded += delegate { ElementBase.GoToState(this, (bool)IsChecked ? "OpenLoaded" : "CloseLoaded"); }; 21 | } 22 | 23 | protected override void OnChecked(RoutedEventArgs e) 24 | { 25 | base.OnChecked(e); 26 | ElementBase.GoToState(this, "Open"); 27 | } 28 | 29 | protected override void OnUnchecked(RoutedEventArgs e) 30 | { 31 | base.OnChecked(e); 32 | ElementBase.GoToState(this, "Close"); 33 | } 34 | 35 | static MetroSwitch() 36 | { 37 | ElementBase.DefaultStyle(DefaultStyleKeyProperty); 38 | } 39 | } 40 | } --------------------------------------------------------------------------------