├── .editorconfig ├── .gitattributes ├── .github └── workflows │ ├── nuget-push.yml │ └── wakatime.yml ├── .gitignore ├── .vscode ├── launch.json └── tasks.json ├── .workflow └── codecheck.yml ├── CookPopularCSharpToolkit ├── CSharp.png ├── Communal │ ├── Attributes │ │ └── MetadataAttribute.cs │ ├── Boxes │ │ └── ValueBoxes.cs │ ├── Collections │ │ ├── AsyncConcurrentQueue!.cs │ │ ├── AsyncObservableCollection!.cs │ │ ├── CastList!.cs │ │ ├── CollectionDeepObserver!.cs │ │ ├── CollectionTeaser.cs │ │ ├── EnumCollection!.cs │ │ ├── ListBase!.cs │ │ ├── ListBaseContract!.cs │ │ ├── ObservableCollectionPlus!.cs │ │ └── UIThreadCollection!.cs │ ├── Comparators │ │ ├── Comparer.cs │ │ └── MultiComparer.cs │ ├── Disposes │ │ ├── ActionDispose.cs │ │ ├── AnonymousDisposable.cs │ │ ├── DefaultDisposable.cs │ │ ├── Destructor.cs │ │ ├── Disposable.cs │ │ ├── Finalizer.cs │ │ ├── ICancelable.cs │ │ └── SerialDisposable.cs │ ├── Extensions │ │ ├── ColorBrushExtension.cs │ │ ├── DoubleExtension.cs │ │ ├── GifExtension.cs │ │ ├── IEnumerableExtension.cs │ │ ├── ImageBitmapExtension.cs │ │ ├── ObjectExtension.cs │ │ └── StringsExtension.cs │ ├── Helpers │ │ ├── ArithmeticHelper.cs │ │ ├── ComparerHelper.cs │ │ ├── ConfigurationManageHelper.cs │ │ ├── CursorHelper.cs │ │ ├── DpiHelper.cs │ │ ├── FileHelper.cs │ │ ├── FontHelper.cs │ │ ├── MathHelper.cs │ │ ├── ObjectCreateHelper.cs │ │ ├── RandomHelper.cs │ │ ├── ScreenHelper.cs │ │ ├── SortHelper.cs │ │ ├── StackTraceHelper.cs │ │ └── VerifyHelper.cs │ ├── Hook │ │ ├── ClipboardHook.cs │ │ ├── HookFactory.cs │ │ ├── KeyboardHook.cs │ │ ├── MouseHook.cs │ │ └── SyncFactory.cs │ ├── Logs │ │ └── Logger.cs │ └── Wrappers │ │ └── WrappedLock.cs ├── CookPopularCSharpToolkit.csproj ├── Properties │ └── AssemblyInfo.cs ├── Windows │ ├── Behaviors │ │ ├── AllowableCharactersInputElementBehavior.cs │ │ ├── FrameworkElementClickBehavior.cs │ │ ├── MouseDragElementBehavior.cs │ │ └── ValidationExceptionBehavior.cs │ ├── Bindings │ │ └── BindingProxy.cs │ ├── Converters │ │ ├── ToBooleanConverters.cs │ │ ├── ToBrushOrColorConverters.cs │ │ ├── ToCornerRadiusConverters.cs │ │ ├── ToDoubleConverters.cs │ │ ├── ToGeometryConverters.cs │ │ ├── ToIntConverters.cs │ │ ├── ToOrientationConverters.cs │ │ ├── ToStringConverters.cs │ │ ├── ToThicknessConverters.cs │ │ ├── ToTimeSpanConverters.cs │ │ └── ToVisibilityConverters.cs │ ├── Drawing │ │ ├── CoordinateCanvas.cs │ │ ├── DispatcherVisual.cs │ │ └── DrawingVisualElement.cs │ ├── Extensions │ │ ├── DependencyObjectExtension.cs │ │ ├── FramworkElementExtension.cs │ │ ├── GeometryExtension.cs │ │ ├── ItemsControlExtension.cs │ │ ├── LogicalTreeHelperExtension.cs │ │ ├── StoryboardExtension.cs │ │ ├── ThicknessExtension.cs │ │ ├── UIElementExtension.cs │ │ ├── VisualTreeHelperExtension.cs │ │ └── WindowExtension.cs │ ├── Helpers │ │ ├── AnimationHelper.cs │ │ ├── DispatcherHelper.cs │ │ ├── ElementClickHelper.cs │ │ ├── ResourceHelper.cs │ │ ├── RoutedEventHelper.cs │ │ └── WpfScreenHelper.cs │ ├── Interop │ │ ├── Handle │ │ │ ├── BitmapHandle.cs │ │ │ ├── CommonHandles.cs │ │ │ ├── HandleCollector.cs │ │ │ ├── IconHandle.cs │ │ │ ├── SafeFileMappingHandle.cs │ │ │ ├── SafeLocalMemoryHandle.cs │ │ │ ├── SafePipeHandle.cs │ │ │ └── WpfSafeHandle.cs │ │ ├── InteropMethods.cs │ │ └── InteropValues.cs │ ├── Listeners │ │ ├── CompositionTargetRenderingListener.cs │ │ ├── DependencyPropertyListener.cs │ │ └── StoryboardCompletionListener.cs │ ├── Managers │ │ ├── AppInstanceManager.cs │ │ └── SingletonManager.cs │ ├── Markup │ │ ├── MarkupExtenisonBase.cs │ │ └── MarkupExtensionBase`T.cs │ ├── Screenshot.cs │ ├── TaskWithThread │ │ ├── OnceTaskScheduler.cs │ │ └── SynchronizationWithAsync.cs │ ├── Transitions │ │ ├── ClothTransition.cs │ │ ├── DoorTransition.cs │ │ ├── ExplosionTransition.cs │ │ ├── FadeTransition.cs │ │ ├── FlipTransition.cs │ │ ├── PageTransition.cs │ │ ├── RotateTransition.cs │ │ ├── StoryboardTransition.cs │ │ ├── Transition3DBase.cs │ │ ├── TransitionBase.cs │ │ ├── TransitionPresenter.cs │ │ ├── TransitionSelector.cs │ │ ├── TranslateTransition.cs │ │ └── TwoWayTransitionSelector.cs │ ├── ValidationRules │ │ ├── FutureDateValidationRule.cs │ │ ├── NotNullAndEmptyValidationRule.cs │ │ ├── RangeValueValidationRule.cs │ │ ├── RegularPatternValidationRule.cs │ │ ├── RegularPatterns.cs │ │ └── ValidationRuleBase.cs │ ├── Win32 │ │ ├── MountVisual.cs │ │ └── MyShape.cs │ └── WindowParameters.cs └── log4net.config ├── CookPopularControl.sln ├── CookPopularControl ├── Communal │ ├── Attached │ │ ├── ButtonBaseAttached.cs │ │ ├── FrameworkElementBaseAttached.cs │ │ ├── SelectorAttached.cs │ │ ├── TextElementAttached.cs │ │ ├── ThumbAttached.cs │ │ └── WindowAttached.cs │ ├── Behaviors │ │ ├── ControlBorderBehavior.cs │ │ └── PasswordBoxBehavior.cs │ ├── Commands │ │ ├── CloseWindowCommand.cs │ │ ├── ControlCommands.cs │ │ ├── SetMainWindowToTopCommand.cs │ │ └── ShutdownAppCommand.cs │ ├── Converters │ │ ├── BorderClipConverter.cs │ │ ├── CircularProgressBarConverters.cs │ │ ├── ShowDefaultCloseButtonConverter.cs │ │ ├── SliderValueMessagePositionConverter.cs │ │ ├── StringToPlaySpeedConverter.cs │ │ ├── TabControlHeaderSizeConverter.cs │ │ ├── TextFieldClearButtonVisibilityConverter.cs │ │ ├── TreeViewItemMarginConverter.cs │ │ └── WaveProgressBarConverters.cs │ ├── Data │ │ ├── Args │ │ │ ├── ItemActionCallbackArgs.cs │ │ │ ├── RoutedPropertySingleEventArgs.cs │ │ │ └── ThemeChangedArg.cs │ │ ├── Enum │ │ │ ├── AlertorState.cs │ │ │ ├── BranchItem.cs │ │ │ ├── ControlBorderAnimationType.cs │ │ │ ├── DropZoneLocation.cs │ │ │ ├── EmptyHeaderSizingHint.cs │ │ │ ├── InterTabTransferReason.cs │ │ │ ├── LoadingTrack.cs │ │ │ ├── SizeGrip.cs │ │ │ └── TabEmptiedResponse.cs │ │ └── Exceptions │ │ │ └── LocationReportException.cs │ ├── StyleSelectors │ │ ├── CouldBeHeaderedStyleSelector.cs │ │ └── InternalStyle.cs │ └── ViewModel │ │ ├── HeaderedItemViewModel.cs │ │ ├── MediaViewModel.cs │ │ └── ViewModelBase.cs ├── Controls │ ├── Adorner │ │ └── AdornerBase.cs │ ├── Animation │ │ ├── AnimationPath.cs │ │ └── AnimationTilePanel.cs │ ├── Base │ │ └── WrapperElement!.cs │ ├── BlockBar │ │ ├── BlockBarBase.cs │ │ ├── BlockBarCircle.cs │ │ ├── BlockBarImage.cs │ │ └── BlockBarRect.cs │ ├── Border │ │ └── BorderAssistant.cs │ ├── Button │ │ ├── ButtonAssist.cs │ │ ├── ButtonBase3D.cs │ │ ├── RadioButtonAssistant.cs │ │ ├── SwitchButton.cs │ │ └── ToggleButtonAssistant.cs │ ├── CarouselView │ │ ├── CarouselView.cs │ │ ├── ImageAnimation.xaml │ │ └── ImageAnimation.xaml.cs │ ├── CheckBox │ │ └── CheckBoxAssistant.cs │ ├── ColorPicker │ │ ├── ColorPicker.cs │ │ ├── HexadecimalColorBehavior.cs │ │ └── HslColor.cs │ ├── DateTime │ │ ├── CalendarAssistant.cs │ │ ├── Clock.cs │ │ ├── ClockAssistant.cs │ │ └── TimePicker.cs │ ├── DialogBox │ │ ├── DialogBox.cs │ │ ├── DialogBoxContainer.cs │ │ ├── DialogExtensions.cs │ │ └── IDialog.cs │ ├── Dragables │ │ ├── Branch.cs │ │ ├── Core │ │ │ ├── AccessorExtension.cs │ │ │ ├── BranchAccessor.cs │ │ │ ├── BranchResult.cs │ │ │ ├── CanvasOrganiser.cs │ │ │ ├── ContainerCustomisations.cs │ │ │ ├── DefaultInterLayoutClient.cs │ │ │ ├── DefaultInterTabClient.cs │ │ │ ├── DefaultNewItemFactory.cs │ │ │ ├── Finder.cs │ │ │ ├── FloatTransfer.cs │ │ │ ├── FloatingItemSnapShot.cs │ │ │ ├── HorizontalOrganiser.cs │ │ │ ├── HorizontalPositionMonitor.cs │ │ │ ├── InterTabTransfer.cs │ │ │ ├── LayoutAccessor.cs │ │ │ ├── LocationReport.cs │ │ │ ├── LocationReportBuilder.cs │ │ │ ├── LocationSnapShot.cs │ │ │ ├── MoveItemRequest.cs │ │ │ ├── NewTabHost!.cs │ │ │ ├── PositionMonitor.cs │ │ │ ├── StackOrganiser.cs │ │ │ ├── StackPositionMonitor.cs │ │ │ ├── TabItemHeaderDragStartInformation.cs │ │ │ ├── VerticalOrganiser.cs │ │ │ ├── VerticalPositionMonitor.cs │ │ │ └── WrapOrganiser.cs │ │ ├── Data │ │ │ ├── Args │ │ │ │ ├── DragableDragCompletedEventArgs.cs │ │ │ │ ├── DragableDragDeltaEventArgs.cs │ │ │ │ ├── DragableDragStartedEventArgs.cs │ │ │ │ ├── DragableItemEventArgs.cs │ │ │ │ ├── LocationChangedEventArgs.cs │ │ │ │ └── OrderChangedEventArgs.cs │ │ │ └── Enum │ │ │ │ ├── AddLocationHint.cs │ │ │ │ └── SizeGrip.cs │ │ ├── DragableControls.md │ │ ├── DragableItem.cs │ │ ├── DragableItemsControl.cs │ │ ├── DragableTabControl.cs │ │ ├── DropZone.cs │ │ ├── HeaderedDragablzItem.cs │ │ ├── InterTabController.cs │ │ ├── Interface │ │ │ ├── IInterLayoutClient.cs │ │ │ ├── IInterTabClient.cs │ │ │ ├── IItemsOrganiser.cs │ │ │ ├── IManualInterTabClient.cs │ │ │ └── INewTabHost!.cs │ │ └── Trapezoid.cs │ ├── Expander │ │ └── ExpanderAssistant.cs │ ├── Fields │ │ ├── AutoGroupingText.cs │ │ ├── IHeader.cs │ │ ├── NumericUpDown.cs │ │ ├── NumericUpDownAssistant.cs │ │ ├── SearchControl.cs │ │ ├── TextBoxBaseAssistant.cs │ │ └── TextPath.cs │ ├── Grid │ │ ├── DataGridAssistant.cs │ │ ├── DataGridCellSingleClickBase.cs │ │ └── GridLinesAssistant.cs │ ├── GroupBox │ │ └── GroupBoxAssistant.cs │ ├── Icon │ │ ├── TrayIcon.Dependency.cs │ │ ├── TrayIcon.cs │ │ └── TrayIconData.cs │ ├── ItemsControl │ │ ├── ComboBoxAssistant.cs │ │ ├── ListBoxAssistant.cs │ │ ├── ListViewAssistant.cs │ │ └── TreeViewAssistant.cs │ ├── Label │ │ ├── GroupLabel.cs │ │ └── LabelAssistant.cs │ ├── Loading │ │ ├── DotCircleLoading.cs │ │ ├── DotLineLoading.cs │ │ ├── DotLoadingBase.cs │ │ ├── DotOpacityLoading.cs │ │ ├── DotPendulumLoading.cs │ │ ├── RecCircleLoading.cs │ │ ├── RecColumnLoading.cs │ │ ├── RecGridLoading.cs │ │ ├── RecLoadingBase.cs │ │ └── SimpleLoadings │ │ │ ├── BraceletLoading.cs │ │ │ ├── CharacterLoading.cs │ │ │ ├── LoadingBase.cs │ │ │ ├── PlaneLoading.cs │ │ │ └── RaindropLoading.cs │ ├── MediaPlayer │ │ ├── MediaPlayer.cs │ │ ├── MediaView.xaml │ │ └── MediaView.xaml.cs │ ├── Menus │ │ ├── CircleMenu.cs │ │ ├── PopupMenu.cs │ │ └── Spelling.cs │ ├── Notify │ │ ├── BubbleMessage.cs │ │ ├── NotifyMessageBase.cs │ │ ├── PopupMessage.cs │ │ ├── TaskbarIcon.cs │ │ └── ToastMessage.cs │ ├── Others │ │ ├── Alertor.cs │ │ ├── Badge.cs │ │ ├── EditingTag.cs │ │ ├── Layout.cs │ │ └── Shield.cs │ ├── Panels │ │ ├── AnimationPanel.cs │ │ ├── ArcPanel.cs │ │ ├── SimpleGrid.cs │ │ ├── UniformStackPanel.cs │ │ └── VirtualPanel.cs │ ├── PasswordBox │ │ └── PasswordBoxAssistant.cs │ ├── Picture │ │ └── Gif.cs │ ├── Popup │ │ └── ExtendPopup.cs │ ├── Progress │ │ ├── CircularProgressAssistant.cs │ │ ├── LinearProgressBarAssistant.cs │ │ └── WaveProgressBarAssistant.cs │ ├── PropertyGrid │ │ ├── Data │ │ │ ├── IndexAttribute.cs │ │ │ ├── NumberRangeAttribute.cs │ │ │ └── PropertyItemEditorType.cs │ │ ├── Editors │ │ │ ├── PropertyButtonEditor.cs │ │ │ ├── PropertyComboBoxEditor.cs │ │ │ ├── PropertyDatePickerEditor.cs │ │ │ ├── PropertyImageEditor.cs │ │ │ ├── PropertyItemEditorFactory.cs │ │ │ ├── PropertyNumberEditor.cs │ │ │ ├── PropertySwitchEditor.cs │ │ │ ├── PropertyTextEditor.cs │ │ │ └── PropertyTimerPickerEditor.cs │ │ ├── PropertyGrid.cs │ │ ├── PropertyItem.cs │ │ └── PropertyItemsControl.cs │ ├── QRCode │ │ └── QRCodeControl.cs │ ├── Ripple │ │ ├── Ripple.cs │ │ └── RippleAssist.cs │ ├── ScrollControl │ │ ├── ExtendedScrollViewer.cs │ │ ├── ScrollBarAssistant.cs │ │ ├── ScrollViewerAssistant.cs │ │ └── SmoothScrollViewer.cs │ ├── Shape │ │ └── DivideLine.cs │ ├── Slider │ │ └── SliderAssistant.cs │ ├── Starred │ │ └── Star.cs │ ├── Swiper │ │ ├── Swiper.cs │ │ └── SwiperItem.cs │ ├── TabControl │ │ └── TabControlAssistant.cs │ ├── ThreeDimensional │ │ ├── Alertor3D.xaml │ │ ├── Alertor3D.xaml.cs │ │ └── FlipTiles │ │ │ ├── FlipTile.cs │ │ │ └── FlipTile3D.cs │ ├── Thumb │ │ └── GridViewColumThumb.cs │ ├── TooTip │ │ └── ToolTipAssistant.cs │ ├── ToolBar │ │ └── ResourceKeyAssistant.cs │ └── Windows │ │ ├── ChromeWindowClient.cs │ │ ├── DialogWindow.cs │ │ ├── MessageDialog.cs │ │ ├── NoneTitleBarWindow.cs │ │ ├── NormalWindow.cs │ │ └── SideBarWindow.cs ├── CookPopularControl.csproj ├── CookPopularControl.xml ├── Expression │ ├── BlendSDK │ │ ├── RuntimeVersion.cs │ │ └── VersionConstants.cs │ ├── Controls │ │ ├── Callout.cs │ │ ├── CompositeContentShape.cs │ │ ├── CompositeShape.cs │ │ ├── LineArrow.cs │ │ └── PanningItems.cs │ ├── Drawing.Core │ │ ├── BezierCurveFlattener.cs │ │ ├── CommonExtensions.cs │ │ ├── GeometryHelper.cs │ │ ├── MarchLocation.cs │ │ ├── MarchStopReason.cs │ │ ├── PathFigureHelper.cs │ │ ├── PathGeometryHelper.cs │ │ ├── PathSegmentData.cs │ │ ├── PathSegmentHelper.cs │ │ ├── PolylineData.cs │ │ ├── PolylineHelper.cs │ │ ├── RandomEngine.cs │ │ ├── SimpleSegment.cs │ │ └── TransformExtensions.cs │ ├── Media │ │ ├── ArcGeometrySource.cs │ │ ├── ArrowOrientation.cs │ │ ├── ArrowType.cs │ │ ├── BlockArrowGeometrySource.cs │ │ ├── CalloutGeometrySource.cs │ │ ├── CalloutStyle.cs │ │ ├── CornerType.cs │ │ ├── DrawingPropertyChangedEventArgs.cs │ │ ├── DrawingPropertyMetadata.cs │ │ ├── DrawingPropertyMetadataOptions.cs │ │ ├── GeometryEffect.cs │ │ ├── GeometryEffectConverter.cs │ │ ├── GeometrySource'T.cs │ │ ├── IArcGeometrySourceParameters.cs │ │ ├── IBlockArrowGeometrySourceParameters.cs │ │ ├── ICalloutGeometrySourceParameters.cs │ │ ├── IGeometrySource.cs │ │ ├── IGeometrySourceExtensions.cs │ │ ├── IGeometrySourceParameters.cs │ │ ├── ILineArrowGeometrySourceParameters.cs │ │ ├── IPolygonGeometrySourceParameters.cs │ │ ├── IShape.cs │ │ ├── ITriangleGeometrySourceParameters.cs │ │ ├── InvalidateGeometryReasons.cs │ │ ├── LineArrowGeometrySource.cs │ │ ├── PolygonGeometrySource.cs │ │ ├── SketchGeometryEffect.cs │ │ ├── TriangleGeometrySource.cs │ │ └── UnitType.cs │ ├── Microsoft.Expression.Drawing.md │ └── Shapes │ │ ├── Arc.cs │ │ ├── BlockArrow.cs │ │ ├── PrimitiveShape.cs │ │ ├── RegularPolygon.cs │ │ └── Triangle.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Dictionaries │ │ ├── EffectShadow.xaml │ │ ├── FontFamily.xaml │ │ ├── GeometryFigure.xaml │ │ ├── SystemConstValue.xaml │ │ └── ValueConverter.xaml │ ├── Dropper.cur │ ├── Fonts │ │ ├── Inter │ │ │ ├── Inter-Bold.ttf │ │ │ ├── Inter-ExtraLight.ttf │ │ │ ├── Inter-Light.ttf │ │ │ ├── Inter-Medium.ttf │ │ │ ├── Inter-Regular.ttf │ │ │ ├── Inter-SemiBold.ttf │ │ │ └── Inter-Thin.ttf │ │ ├── Roboto │ │ │ ├── Roboto-Black.ttf │ │ │ ├── Roboto-BlackItalic.ttf │ │ │ ├── Roboto-Bold.ttf │ │ │ ├── Roboto-BoldItalic.ttf │ │ │ ├── Roboto-Italic.ttf │ │ │ ├── Roboto-Light.ttf │ │ │ ├── Roboto-LightItalic.ttf │ │ │ ├── Roboto-Medium.ttf │ │ │ ├── Roboto-MediumItalic.ttf │ │ │ ├── Roboto-Regular.ttf │ │ │ ├── Roboto-Thin.ttf │ │ │ ├── Roboto-ThinItalic.ttf │ │ │ ├── RobotoCondensed-Bold.ttf │ │ │ ├── RobotoCondensed-BoldItalic.ttf │ │ │ ├── RobotoCondensed-Italic.ttf │ │ │ ├── RobotoCondensed-Light.ttf │ │ │ ├── RobotoCondensed-LightItalic.ttf │ │ │ └── RobotoCondensed-Regular.ttf │ │ └── WindowIcons │ │ │ ├── iconfont.css │ │ │ ├── iconfont.eot │ │ │ ├── iconfont.js │ │ │ ├── iconfont.json │ │ │ ├── iconfont.svg │ │ │ ├── iconfont.ttf │ │ │ ├── iconfont.woff │ │ │ └── iconfont.woff2 │ └── Images │ │ ├── CookCSharp.ico │ │ ├── CookCSharp.png │ │ ├── CookCSharpTransparent.ico │ │ ├── MediaPlayerBackground.png │ │ └── WpfControl.png └── Themes │ ├── AlertorStyle.xaml │ ├── AnimationPathStyle.xaml │ ├── AutoGroupingTextStyle.xaml │ ├── BaseStyle │ ├── ButtonBaseStyle.xaml │ ├── CalenderBaseStyle.xaml │ ├── CheckBoxBaseStyle.xaml │ ├── ComboBoxBaseStyle.xaml │ ├── ControlBaseStyle.xaml │ ├── DataGridBaseStyle.xaml │ ├── DatePickerBaseStyle.xaml │ ├── DragableControlBaseStyle.xaml │ ├── ListBoxBaseStyle.xaml │ ├── OtherControlTemplate.xaml │ ├── Others │ │ ├── BadgeStyle.xaml │ │ ├── BranchStyle.xaml │ │ ├── DropZoneStyle.xaml │ │ ├── EditingTagStyle.xaml │ │ └── LayoutStyle.xaml │ ├── PasswordBoxBaseStyle.xaml │ ├── ProgressBarBaseStyle.xaml │ ├── RippleStyle.xaml │ ├── SliderBaseStyle.xaml │ ├── SwitchButtonBaseStyle.xaml │ ├── TabControlBaseStyle.xaml │ ├── TextBoxBaseBaseStyle.xaml │ ├── TimePickerBaseStyle.xaml │ ├── TreeViewBaseStyle.xaml │ └── ValidationErrorBaseTemplate.xaml │ ├── BorderStyle.xaml │ ├── ButtonStyle.xaml │ ├── CarouselViewStyle.xaml │ ├── CheckBoxStyle.xaml │ ├── ColorPickerStyle.xaml │ ├── ComboBoxStyle.xaml │ ├── CookColors │ ├── AquaColor.xaml │ ├── BaseColor.xaml │ ├── BlueColor.xaml │ ├── ColorManipulation │ │ └── ThemeProvider.cs │ ├── DarkColor.xaml │ ├── DodgerBlueColor.xaml │ ├── GreenColor.xaml │ ├── LightColor.xaml │ ├── OrangeColor.xaml │ ├── PurpleColor.xaml │ ├── RedColor.xaml │ └── YellowColor.xaml │ ├── DataGridStyle.xaml │ ├── DateTimePickerStyle.xaml │ ├── DefaultPopularColor.xaml │ ├── DefaultPopularControl.xaml │ ├── DialogBoxStyle.xaml │ ├── DragableControlStyle.xaml │ ├── ExpanderStyle.xaml │ ├── GroupBoxStyle.xaml │ ├── LabelStyle.xaml │ ├── ListBoxStyle.xaml │ ├── ListViewStyle.xaml │ ├── LoadingStyle.xaml │ ├── MediaPlayerStyle.xaml │ ├── MenuStyle.xaml │ ├── MessageDialogStyle.xaml │ ├── NotifyStyle.xaml │ ├── NumericUpDownStyle.xaml │ ├── OtherControlStyle.xaml │ ├── PasswordBoxStyle.xaml │ ├── ProgressBarStyle.xaml │ ├── PropertyGridStyle.xaml │ ├── QRCodeControlStyle.xaml │ ├── RadioButtonStyle.xaml │ ├── RichTextBoxStyle.xaml │ ├── ScrollBarStyle.xaml │ ├── ScrollViewerStyle.xaml │ ├── SearchBarStyle.xaml │ ├── ShapeStyle.xaml │ ├── SliderStyle.xaml │ ├── StarredStyle.xaml │ ├── SwiperStyle.xaml │ ├── SwitchButtonStyle.xaml │ ├── TabControlStyle.xaml │ ├── TextBlockStyle.xaml │ ├── TextBoxStyle.xaml │ ├── TextPathStyle.xaml │ ├── ThreeDimensionalStyle.xaml │ ├── ThumbStyle.xaml │ ├── ToggleButtonStyle.xaml │ ├── ToolBarStyle.xaml │ ├── ToolTipStyle.xaml │ ├── TreeViewStyle.xaml │ └── WindowStyle.xaml ├── Directory.Build.props ├── LICENSE ├── MvvmTestDemo ├── App.xaml ├── App.xaml.cs ├── Bootstrapper.cs ├── Commumal │ ├── IL │ │ ├── DynamicGeneratorDll.cs │ │ └── DynamicProxy.cs │ ├── ObjectFactory.cs │ └── ViewModelBase.cs ├── CookCSharp.ico ├── DemoDragables │ ├── QuickStartWindow.xaml │ └── QuickStartWindow.xaml.cs ├── DemoModels │ └── TreeViewModel.cs ├── DemoViewModels │ ├── AdornerViewModel.cs │ ├── AnimationDemoViewModel.cs │ ├── DragableControlsDemoViewModel.cs │ ├── OverViewDemoViewModel.cs │ └── TreeViewDemoViewModel.cs ├── DemoViews │ ├── AnimationDemo.xaml │ ├── AnimationDemo.xaml.cs │ ├── BlockBarDemo.xaml │ ├── BlockBarDemo.xaml.cs │ ├── ButtonDemo.xaml │ ├── ButtonDemo.xaml.cs │ ├── CarouselViewDemo.xaml │ ├── CarouselViewDemo.xaml.cs │ ├── CheckBoxDemo.xaml │ ├── CheckBoxDemo.xaml.cs │ ├── ColorPickerDemo.xaml │ ├── ColorPickerDemo.xaml.cs │ ├── ComboBoxDemo.xaml │ ├── ComboBoxDemo.xaml.cs │ ├── DataGridDemo.xaml │ ├── DataGridDemo.xaml.cs │ ├── DateTimePickerDemo.xaml │ ├── DateTimePickerDemo.xaml.cs │ ├── DialogBoxDemo.xaml │ ├── DialogBoxDemo.xaml.cs │ ├── DocumentViewerDemo.xaml │ ├── DocumentViewerDemo.xaml.cs │ ├── DragableControlsDemo.xaml │ ├── DragableControlsDemo.xaml.cs │ ├── ExpanderDemo.xaml │ ├── ExpanderDemo.xaml.cs │ ├── FieldsDemo.xaml │ ├── FieldsDemo.xaml.cs │ ├── GridDemo.xaml │ ├── GridDemo.xaml.cs │ ├── GroupBoxDemo.xaml │ ├── GroupBoxDemo.xaml.cs │ ├── GroupControlsDemo.xaml │ ├── GroupControlsDemo.xaml.cs │ ├── LabelsDemo.xaml │ ├── LabelsDemo.xaml.cs │ ├── ListsDemo.xaml │ ├── ListsDemo.xaml.cs │ ├── LoadingDemo.xaml │ ├── LoadingDemo.xaml.cs │ ├── MediaPlayerDemo.xaml │ ├── MediaPlayerDemo.xaml.cs │ ├── MenuDemo.xaml │ ├── MenuDemo.xaml.cs │ ├── MessageDialogDemo.xaml │ ├── MessageDialogDemo.xaml.cs │ ├── NotifyDemo.xaml │ ├── NotifyDemo.xaml.cs │ ├── OtherControlsDemo.xaml │ ├── OtherControlsDemo.xaml.cs │ ├── PanelDemo.xaml │ ├── PanelDemo.xaml.cs │ ├── PasswordBoxDemo.xaml │ ├── PasswordBoxDemo.xaml.cs │ ├── PictureDemo.xaml │ ├── PictureDemo.xaml.cs │ ├── PopupDemo.xaml │ ├── PopupDemo.xaml.cs │ ├── ProgressBarDemo.xaml │ ├── ProgressBarDemo.xaml.cs │ ├── PropertyGridDemo.xaml │ ├── PropertyGridDemo.xaml.cs │ ├── QRCodeControlDemo.xaml │ ├── QRCodeControlDemo.xaml.cs │ ├── RadioButtonDemo.xaml │ ├── RadioButtonDemo.xaml.cs │ ├── ScrollViewerDemo.xaml │ ├── ScrollViewerDemo.xaml.cs │ ├── SliderDemo.xaml │ ├── SliderDemo.xaml.cs │ ├── StarredDemo.xaml │ ├── StarredDemo.xaml.cs │ ├── SwiperDemo.xaml │ ├── SwiperDemo.xaml.cs │ ├── SwitchButtonDemo.xaml │ ├── SwitchButtonDemo.xaml.cs │ ├── TabControlDemo.xaml │ ├── TabControlDemo.xaml.cs │ ├── ThreeDimensionalControlsDemo.xaml │ ├── ThreeDimensionalControlsDemo.xaml.cs │ ├── ToggleButtonDemo.xaml │ ├── ToggleButtonDemo.xaml.cs │ ├── ToolBarDemo.xaml │ ├── ToolBarDemo.xaml.cs │ ├── TreeViewDemo.xaml │ ├── TreeViewDemo.xaml.cs │ ├── WindowsDemo.xaml │ └── WindowsDemo.xaml.cs ├── FodyWeavers.xml ├── FodyWeavers.xsd ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── MainWindowViewModel.cs ├── MvvmTestDemo.csproj ├── Obfuscar.xml ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── CarouselViewImages │ │ ├── 1.jpg │ │ ├── 2.jpg │ │ ├── 3.jpg │ │ ├── 4.jpg │ │ ├── 5.jpg │ │ ├── 6.jpg │ │ ├── 7.jpg │ │ ├── 8.jpg │ │ └── 9.jpg │ ├── Effect │ │ ├── Alertor.gif │ │ ├── AnimationPath.gif │ │ ├── Animations.gif │ │ ├── BlockBars.png │ │ ├── Button.gif │ │ ├── CarouselView.gif │ │ ├── CheckBox.png │ │ ├── ColorPicker.png │ │ ├── ComboBox.gif │ │ ├── DataGrid.png │ │ ├── DateTimePicker.png │ │ ├── DialogBox.gif │ │ ├── Expander.gif │ │ ├── Fields.png │ │ ├── Grid.png │ │ ├── GroupBox.png │ │ ├── GroupControls.png │ │ ├── Labels.png │ │ ├── Lists.png │ │ ├── Loading.gif │ │ ├── MediaPlayer.gif │ │ ├── Menu.gif │ │ ├── MessageDialog.png │ │ ├── Notify.png │ │ ├── NotifyIcon.png │ │ ├── OtherControls.png │ │ ├── Overview.png │ │ ├── PasswordBox.gif │ │ ├── ProgressBar.gif │ │ ├── PropertyGrid.png │ │ ├── QRCode.gif │ │ ├── RadioButton.png │ │ ├── ScrollViewer.png │ │ ├── Slider.gif │ │ ├── Star.png │ │ ├── Swiper.gif │ │ ├── SwitchButton.png │ │ ├── TabControl.png │ │ ├── Theme.gif │ │ ├── ThreeDimensionalControls.gif │ │ ├── ToggleButton.gif │ │ ├── ToolBar.png │ │ └── TreeView.png │ ├── Gif │ │ ├── C.png │ │ ├── CookCSharp.ico │ │ ├── GifBitmapEncoder.gif │ │ ├── cook.gif │ │ ├── programmer.gif │ │ ├── timg.jpg │ │ └── tomcat.jpg │ └── MediaPlayerVideo │ │ ├── Video1.mp4 │ │ ├── Video2.mp4 │ │ └── Video3.mp4 ├── UserControls │ ├── Adorner.xaml │ ├── Adorner.xaml.cs │ ├── Animation.xaml │ ├── Animation.xaml.cs │ ├── HomePageView.xaml │ ├── HomePageView.xaml.cs │ ├── NotifyDemoWindow.xaml │ ├── NotifyDemoWindow.xaml.cs │ ├── OverViewDemo.xaml │ └── OverViewDemo.xaml.cs └── Windows │ ├── DemoDialogWindow.xaml │ ├── DemoDialogWindow.xaml.cs │ ├── FixedSizeWindow.xaml │ ├── FixedSizeWindow.xaml.cs │ ├── NoneWindow.xaml │ ├── NoneWindow.xaml.cs │ └── Printers │ ├── NoKeypadDocumentViewer.cs │ ├── PrintPreviewWindow.xaml │ └── PrintPreviewWindow.xaml.cs ├── NuGet.Config ├── ReadMe.md ├── Settings.XamlStyler ├── Version.md └── Version.props /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # CS1591: 缺少对公共可见类型或成员的 XML 注释 4 | dotnet_diagnostic.CS1591.severity = silent 5 | 6 | # CA1416: 验证平台兼容性 7 | dotnet_diagnostic.CA1416.severity = silent 8 | 9 | # CS8618: 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。 10 | dotnet_diagnostic.CS8618.severity = silent 11 | 12 | # CS0809: 过时成员重写未过时成员 13 | dotnet_diagnostic.CS0809.severity = silent 14 | 15 | # CS8602: 解引用可能出现空引用。 16 | dotnet_diagnostic.CS8602.severity = silent 17 | 18 | # CS8603: 可能的 null 引用返回。 19 | dotnet_diagnostic.CS8603.severity = silent 20 | 21 | # CS8601: 可能的 null 引用赋值。 22 | dotnet_diagnostic.CS8601.severity = none 23 | 24 | # CS8524: switch 表达式不会处理其输入类型的某些值(它不是穷举),这包括未命名的枚举值。 25 | dotnet_diagnostic.CS8524.severity = silent 26 | 27 | # IDE0072: 添加缺失的事例 28 | dotnet_diagnostic.IDE0072.severity = suggestion 29 | 30 | # IDE0022: 使用方法的程序块主体 31 | dotnet_diagnostic.IDE0022.severity = none 32 | 33 | # IDE0059: 不需要赋值 34 | csharp_style_unused_value_assignment_preference = unused_local_variable 35 | 36 | # CS8625: 无法将 null 文本转换为不可为 null 的引用类型。 37 | dotnet_diagnostic.CS8625.severity = none 38 | 39 | # CS8632: 只能在 "#nullable" 注释上下文内的代码中使用可为 null 的引用类型的注释。 40 | dotnet_diagnostic.CS8632.severity = none 41 | 42 | # CS8604: 可能的 null 引用参数。 43 | dotnet_diagnostic.CS8604.severity = none 44 | 45 | # CS3003: 类型不符合 CLS 46 | dotnet_diagnostic.CS3003.severity = none 47 | 48 | # CS3009: 基类型不符合 CLS 49 | dotnet_diagnostic.CS3009.severity = none 50 | 51 | # CS3001: 参数类型不符合 CLS 52 | dotnet_diagnostic.CS3001.severity = none 53 | -------------------------------------------------------------------------------- /.github/workflows/nuget-push.yml: -------------------------------------------------------------------------------- 1 | name: Nuget Publish 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | # branches: [ chance_dev ] 8 | # pull_request: 9 | # branches: [ chance_dev ] 10 | 11 | jobs: 12 | build: 13 | runs-on: windows-latest 14 | 15 | steps: 16 | - name: CheckOut 17 | uses: actions/checkout@v2 18 | 19 | - name: Setup .NET Core 20 | uses: actions/setup-dotnet@v1 21 | with: 22 | dotnet-version: '6.0.x' 23 | 24 | - name: Install dependencies 25 | run: dotnet restore 26 | 27 | - name: Build 28 | run: dotnet build --configuration Release 29 | 30 | - name: Install nuget 31 | uses: nuget/setup-nuget@v1 32 | with: 33 | nuget-version: '5.x' 34 | 35 | - name: Add to github package 36 | run: | 37 | nuget sources add -name github -Source https://nuget.pkg.github.com/CookCSharp/index.json -Username CookCSharp -Password ${{ secrets.GITHUBACCESSTOKEN }} 38 | 39 | - name: Publish package to nuget 40 | run: | 41 | nuget push .\Output\bin\Release\*.nupkg -Source github -SkipDuplicate 42 | nuget push .\Output\bin\Release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGETAPIKEY }} -NoSymbols -------------------------------------------------------------------------------- /.github/workflows/wakatime.yml: -------------------------------------------------------------------------------- 1 | name: WakaTime 2 | 3 | on: 4 | push: 5 | branches: 6 | - chance_dev 7 | schedule: 8 | - cron: '0 0 * * *' 9 | 10 | jobs: 11 | update-readme: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: athul/waka-readme@master 15 | with: 16 | WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }} 17 | # GH_TOKEN: ${{ secrets.GH_TOKEN }} 18 | # REPOSITORY: 19 | # SHOW_TITLE: true 20 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": ".NET Core Attach", 9 | "type": "coreclr", 10 | "request": "attach" 11 | }, 12 | { 13 | "name": ".NET Core Launch (console)", 14 | "type": "coreclr", 15 | "request": "launch", 16 | "preLaunchTask": "build", 17 | "program": "${workspaceFolder}/MvvmTestDemo/Output/bin/MvvmTestDemo/net6.0-windows/MvvmTestDemo.exe", 18 | "args": [], 19 | "cwd": "${workspaceFolder}/MvvmTestDemo", 20 | "console": "internalConsole", 21 | "stopAtEntry": false 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/CookPopularControl.sln", 11 | "/property:GenerateFullPaths=true", 12 | "/consoleloggerparameters:NoSummary" 13 | ], 14 | "problemMatcher": "$msCompile" 15 | }, 16 | { 17 | "label": "publish", 18 | "command": "dotnet", 19 | "type": "process", 20 | "args": [ 21 | "publish", 22 | "${workspaceFolder}/CookPopularControl.sln", 23 | "/property:GenerateFullPaths=true", 24 | "/consoleloggerparameters:NoSummary" 25 | ], 26 | "problemMatcher": "$msCompile" 27 | }, 28 | { 29 | "label": "watch", 30 | "command": "dotnet", 31 | "type": "process", 32 | "args": [ 33 | "watch", 34 | "run", 35 | "--project", 36 | "${workspaceFolder}/CookPopularControl.sln" 37 | ], 38 | "problemMatcher": "$msCompile" 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/CSharp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/CSharp.png -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Attributes/MetadataAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Composition; 3 | using System.Windows; 4 | 5 | 6 | 7 | /* 8 | * Copyright (c) 2021 All Rights Reserved. 9 | * Description:MetadataAttribute 10 | * Author: Chance_写代码的厨子 11 | * Create Time:2021-08-05 11:14:52 12 | */ 13 | namespace CookPopularCSharpToolkit.Communal 14 | { 15 | /// 16 | /// 指定为某个类型的导出提供元数据的自定义特性 17 | /// 18 | [MetadataAttribute] 19 | [AttributeUsage(AttributeTargets.Class)] 20 | [PartCreationPolicy(CreationPolicy.NonShared)] 21 | public class ControlMetadataAttribute : ExportAttribute 22 | { 23 | public ControlMetadataAttribute(string name) : this(name, string.Empty) { } 24 | public ControlMetadataAttribute(string name, string description) : base(ControlContractName, typeof(FrameworkElement)) 25 | { 26 | Name = name; 27 | Description = description; 28 | } 29 | 30 | public string Name { get; private set; } 31 | public string Description { get; private set; } 32 | 33 | public const string ControlContractName = "CookPopularControlLib"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Collections/ListBaseContract!.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.Contracts; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:ListBaseContract_ 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-08-05 16:55:36 10 | */ 11 | namespace CookPopularCSharpToolkit.Communal 12 | { 13 | [ContractClassFor(typeof(ListBase<>))] 14 | public abstract class ListBaseContract : ListBase 15 | { 16 | protected override T GetItem(int index) 17 | { 18 | Contract.Requires(index >= 0); 19 | Contract.Requires(index < Count); 20 | return default(T); 21 | } 22 | 23 | public override int Count 24 | { 25 | get 26 | { 27 | Contract.Ensures(Contract.Result() >= 0); 28 | return default(int); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Disposes/AnonymousDisposable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:AnonymousDisposable 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-11 11:37:32 11 | */ 12 | namespace CookPopularCSharpToolkit.Communal 13 | { 14 | /// 15 | /// 匿名可释放对象 16 | /// 17 | internal sealed class AnonymousDisposable : ICancelable, IDisposable 18 | { 19 | private volatile Action _dispose; 20 | 21 | public bool IsDisposed 22 | { 23 | get 24 | { 25 | return this._dispose == null; 26 | } 27 | } 28 | 29 | public AnonymousDisposable(Action dispose) 30 | { 31 | this._dispose = dispose; 32 | } 33 | 34 | public void Dispose() 35 | { 36 | var action = Interlocked.Exchange(ref _dispose, null); 37 | if (action == null) 38 | return; 39 | action(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Disposes/DefaultDisposable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:DefaultDisposable 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-08-11 11:37:45 10 | */ 11 | namespace CookPopularCSharpToolkit.Communal 12 | { 13 | /// 14 | /// 默认可释放对象 15 | /// 16 | internal sealed class DefaultDisposable : IDisposable 17 | { 18 | public static readonly DefaultDisposable Instance = new DefaultDisposable(); 19 | 20 | static DefaultDisposable() 21 | { 22 | } 23 | 24 | private DefaultDisposable() 25 | { 26 | } 27 | 28 | public void Dispose() 29 | { 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Disposes/Destructor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:Destructor 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-07-23 10:59:54 11 | */ 12 | namespace CookPopularCSharpToolkit.Communal 13 | { 14 | /// 15 | /// 析构器 16 | /// 17 | public class DestructorHandle 18 | { 19 | // 释放非托管资源 20 | [DllImport("Kernel32", CharSet = CharSet.Auto, SetLastError = true)] 21 | [return: MarshalAs(UnmanagedType.Bool)] 22 | private extern static bool CloseHandle(IntPtr handle); 23 | 24 | 25 | private IntPtr handle; //保存一个非托管资源的win32句柄 26 | 27 | 28 | public DestructorHandle(IntPtr handle) 29 | { 30 | this.handle = handle; 31 | } 32 | 33 | //当垃圾收集执行的时候,下面的析构器(Finalize)方法 34 | //将被调用,它将关闭非托管资源句柄。 35 | ~DestructorHandle() 36 | { 37 | CloseHandle(handle); 38 | } 39 | 40 | // 返回所有封装的handle句柄 41 | public IntPtr ToHandle() 42 | { 43 | return handle; 44 | } 45 | 46 | // 隐式转换操作符也用于返回所封装的Handle句柄 47 | public static implicit operator IntPtr(DestructorHandle osHandle) 48 | { 49 | return osHandle.ToHandle(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Disposes/Disposable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:Disposable 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-08-11 11:36:55 10 | */ 11 | namespace CookPopularCSharpToolkit.Communal 12 | { 13 | /// 14 | /// 标准可释放对象 15 | /// 16 | internal static class Disposable 17 | { 18 | public static IDisposable Empty 19 | { 20 | get 21 | { 22 | return DefaultDisposable.Instance; 23 | } 24 | } 25 | 26 | public static IDisposable Create(Action dispose) 27 | { 28 | if (dispose == null) 29 | throw new ArgumentNullException("dispose"); 30 | else 31 | return new AnonymousDisposable(dispose); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Disposes/ICancelable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:ICancelable 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-08-11 10:43:55 10 | */ 11 | namespace CookPopularCSharpToolkit.Communal 12 | { 13 | internal interface ICancelable : IDisposable 14 | { 15 | bool IsDisposed { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Helpers/ComparerHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.Contracts; 4 | using System.Globalization; 5 | 6 | 7 | 8 | /* 9 | * Copyright (c) 2021 All Rights Reserved. 10 | * Description:ComparerHelper 11 | * Author: Chance_写代码的厨子 12 | * Create Time:2021-08-05 16:34:45 13 | */ 14 | namespace CookPopularCSharpToolkit.Communal 15 | { 16 | public static class ComparerHelper 17 | { 18 | public static IEqualityComparer ToEqualityComparer(this Func func) 19 | { 20 | Contract.Requires(func != null); 21 | return new FuncEqualityComparer(func); 22 | } 23 | 24 | public static IComparer ToComparer(this Func compareFunction) 25 | { 26 | Contract.Requires(compareFunction != null); 27 | return new FuncComparer(compareFunction); 28 | } 29 | 30 | public static IComparer ToComparer(this Comparison compareFunction) 31 | { 32 | Contract.Requires(compareFunction != null); 33 | return new ComparisonComparer(compareFunction); 34 | } 35 | 36 | public static IComparer ToComparer(this CompareInfo compareInfo) 37 | { 38 | Contract.Requires(compareInfo != null); 39 | return new FuncComparer(compareInfo.Compare); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Helpers/RandomHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.Contracts; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:RandomHelper 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-05 17:02:24 11 | */ 12 | namespace CookPopularCSharpToolkit.Communal 13 | { 14 | public class RandomHelper 15 | { 16 | private static readonly WeakReference _random = new WeakReference(null); 17 | public static Random Rnd 18 | { 19 | get 20 | { 21 | Contract.Ensures(Contract.Result() != null); 22 | var r = (Random)_random.Target; 23 | if (r == null) 24 | { 25 | _random.Target = r = new Random(); 26 | } 27 | return r; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Communal/Hook/HookFactory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description:HookFactory 3 | * Author: Chance.Zheng 4 | * Create Time: 2022-11-03 17:46:39 5 | * .Net Version: 4.6 6 | * CLR Version: 4.0.30319.42000 7 | * Copyright (c) CookCSharp 2020-2022 All Rights Reserved. 8 | */ 9 | 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Threading.Tasks; 16 | 17 | 18 | namespace CookPopularCSharpToolkit.Communal 19 | { 20 | public class HookFactory : IDisposable 21 | { 22 | private readonly SyncFactory syncFactory = new SyncFactory(); 23 | 24 | //public ApplicationWatcher GetApplicationWatcher() 25 | //{ 26 | // return new ApplicationWatcher(syncFactory); 27 | //} 28 | 29 | public KeyboardWatcher GetKeyboardWatcher() 30 | { 31 | return new KeyboardWatcher(syncFactory); 32 | } 33 | 34 | public MouseWatcher GetMouseWatcher() 35 | { 36 | return new MouseWatcher(syncFactory); 37 | } 38 | 39 | public ClipboardWatcher GetClipboardWatcher() 40 | { 41 | return new ClipboardWatcher(syncFactory); 42 | } 43 | 44 | //public PrintWatcher GetPrintWatcher() 45 | //{ 46 | // return new PrintWatcher(syncFactory); 47 | //} 48 | 49 | public void Dispose() 50 | { 51 | syncFactory.Dispose(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Communal; 2 | using System; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows.Markup; 6 | 7 | // 在此类的 SDK 样式项目中,现在,在此文件中早前定义的几个程序集属性将在生成期间自动添加,并使用在项目属性中定义的值进行填充。有关包含的属性以及如何定制此过程的详细信息,请参阅 8 | // https://aka.ms/assembly-info-properties 9 | 10 | 11 | // 将 ComVisible 设置为 false 会使此程序集中的类型对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,请将该类型的 ComVisible 12 | // 属性设置为 true。 13 | [assembly: ComVisible(false)] 14 | [assembly: CLSCompliant(true)] 15 | [assembly: InternalsVisibleTo("CookPopularControl")] 16 | [assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)] 17 | 18 | // 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID。 19 | [assembly: Guid("969067b6-6d85-40df-b024-7d9eca442855")] 20 | 21 | [assembly: XmlnsPrefix("https://Chance.CookPopularCSharpToolkit/2021/xaml", "pt")] 22 | [assembly: XmlnsDefinition("https://Chance.CookPopularCSharpToolkit/2021/xaml", "CookPopularCSharpToolkit")] 23 | [assembly: XmlnsDefinition("https://Chance.CookPopularCSharpToolkit/2021/xaml", "CookPopularCSharpToolkit.Communal")] 24 | [assembly: XmlnsDefinition("https://Chance.CookPopularCSharpToolkit/2021/xaml", "CookPopularCSharpToolkit.Windows")] 25 | [assembly: XmlnsDefinition("https://Chance.CookPopularCSharpToolkit/2021/xaml", "CookPopularCSharpToolkit.Windows.Transitions")] 26 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Bindings/BindingProxy.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:BindingProxy 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-05-28 10:02:29 10 | */ 11 | namespace CookPopularCSharpToolkit.Windows 12 | { 13 | /// 14 | /// 绑定代理 15 | /// 16 | /// 17 | /// 适用于控件自身是视觉树的根节点,即使通过RelativeSource.FindAncestor也找不到要传递的参数,例如ContextMenu 18 | /// 传递参数时:可以通过PlacementTarget解决。微软对PlacementTarget的解释是:获取或设置UIElement,当它打开时相对于它确定ContextMenu的位置 19 | /// 20 | /// 21 | /// 22 | public class BindingProxy : Freezable 23 | { 24 | protected override Freezable CreateInstanceCore() => new BindingProxy(); 25 | 26 | public object? Data 27 | { 28 | get { return GetValue(DataProperty); } 29 | set { SetValue(DataProperty, value); } 30 | } 31 | public static readonly DependencyProperty DataProperty = 32 | DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(default(object))); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Converters/ToIntConverters.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 | using System.Windows.Markup; 10 | 11 | 12 | 13 | /* 14 | * Description:ToIntConverters 15 | * Author: Chance_写代码的厨子 16 | * Company: Chance 17 | * Create Time:2021-11-16 13:50:24 18 | * .NET Version: 4.6 19 | * CLR Version: 4.0.30319.42000 20 | * Copyright (c) Chance 2021 All Rights Reserved. 21 | */ 22 | namespace CookPopularCSharpToolkit.Windows 23 | { 24 | [MarkupExtensionReturnType(typeof(int))] 25 | [Localizability(LocalizationCategory.NeverLocalize)] 26 | public class EnumToIntConverter : MarkupExtensionBase, IValueConverter 27 | { 28 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 29 | { 30 | if (value is Enum t) 31 | { 32 | if (Enum.IsDefined(value.GetType(), value) == true) 33 | return t.GetHashCode(); 34 | } 35 | 36 | return DependencyProperty.UnsetValue; 37 | } 38 | 39 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 40 | { 41 | return Enum.Parse(targetType, value.ToString()); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Converters/ToStringConverters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | using System.Windows.Markup; 6 | 7 | 8 | 9 | /* 10 | * Copyright (c) 2021 All Rights Reserved. 11 | * Description:ToStringConverters 12 | * Author: Chance_写代码的厨子 13 | * Create Time:2021-11-06 22:05:00 14 | */ 15 | namespace CookPopularCSharpToolkit.Windows 16 | { 17 | [MarkupExtensionReturnType(typeof(object))] 18 | [Localizability(LocalizationCategory.NeverLocalize)] 19 | public class DoubleToStringConverter : MarkupExtensionBase, IValueConverter 20 | { 21 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | if (value is double v1 && parameter == null) 24 | return v1.ToString(); 25 | else if (value is double v2 && parameter is double param) 26 | return v2.ToString($"N{(int)param}"); 27 | 28 | return default; 29 | } 30 | 31 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Converters/ToTimeSpanConverters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | using System.Windows.Markup; 6 | 7 | 8 | 9 | /* 10 | * Copyright (c) 2021 All Rights Reserved. 11 | * Description:ToTimeSpanConverters 12 | * Author: Chance_写代码的厨子 13 | * Create Time:2021-11-06 22:08:43 14 | */ 15 | namespace CookPopularCSharpToolkit.Windows 16 | { 17 | [MarkupExtensionReturnType(typeof(TimeSpan))] 18 | [Localizability(LocalizationCategory.NeverLocalize)] 19 | [ValueConversion(typeof(double), typeof(TimeSpan))] 20 | public class DoubleToTimeSpanConverter : MarkupExtensionBase, IValueConverter 21 | { 22 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | if (value is double d) 25 | return TimeSpan.FromSeconds(Math.Round(d, 0)); 26 | 27 | return TimeSpan.Zero; 28 | } 29 | 30 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | return Binding.DoNothing; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Extensions/ItemsControlExtension.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Windows.Controls; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:ItemsControlExtension 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-11 14:29:18 11 | */ 12 | namespace CookPopularCSharpToolkit.Windows 13 | { 14 | public static class ItemsControlExtension 15 | { 16 | public static IEnumerable Containers(this ItemsControl itemsControl) where TContainer : class 17 | { 18 | #if NET40 19 | var fieldInfo = typeof(ItemContainerGenerator).GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance); 20 | var list = (IList)fieldInfo.GetValue(itemsControl.ItemContainerGenerator); 21 | for (var i = 0; i < list.Count; i++) 22 | #else 23 | for (var i = 0; i < itemsControl.ItemContainerGenerator.Items.Count; i++) 24 | #endif 25 | { 26 | var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as TContainer; 27 | if (container != null) 28 | yield return container; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Extensions/StoryboardExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Media.Animation; 4 | 5 | 6 | 7 | /* 8 | * Copyright (c) 2021 All Rights Reserved. 9 | * Description:StoryboardExtension 10 | * Author: Chance_写代码的厨子 11 | * Create Time:2021-08-11 15:08:05 12 | */ 13 | namespace CookPopularCSharpToolkit.Windows 14 | { 15 | public static class StoryboardExtension 16 | { 17 | private static readonly IDictionary> ContinuationIndex = new Dictionary>(); 18 | 19 | public static void WhenComplete(this Storyboard storyboard, Action continuation) 20 | { 21 | // ReSharper disable once ObjectCreationAsStatement 22 | new StoryboardCompletionListener(storyboard, continuation); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Extensions/ThicknessExtension.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Communal; 2 | using System.Windows; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:ThicknessExtension 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-05-24 17:44:39 11 | */ 12 | namespace CookPopularCSharpToolkit.Windows 13 | { 14 | public static class ThicknessExtension 15 | { 16 | public static Thickness Add(this Thickness a, Thickness b) => new Thickness(a.Left + b.Left, a.Top + b.Top, a.Right + b.Right, a.Bottom + b.Bottom); 17 | 18 | public static bool IsZero(this Thickness thickness) 19 | => MathHelper.IsZero(thickness.Left) 20 | && MathHelper.IsZero(thickness.Top) 21 | && MathHelper.IsZero(thickness.Right) 22 | && MathHelper.IsZero(thickness.Bottom); 23 | 24 | public static bool IsUniform(this Thickness thickness) 25 | => MathHelper.AreClose(thickness.Left, thickness.Top) 26 | && MathHelper.AreClose(thickness.Left, thickness.Right) 27 | && MathHelper.AreClose(thickness.Left, thickness.Bottom); 28 | 29 | public static bool IsNaN(this double value) => double.IsNaN(value); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Extensions/UIElementExtension.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:UIElementExtension 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-05-24 11:06:23 10 | */ 11 | namespace CookPopularCSharpToolkit.Windows 12 | { 13 | public static class UIElementExtension 14 | { 15 | /// 16 | /// 显示元素 17 | /// 18 | /// 19 | public static void ToVisible(this UIElement element) => element.Visibility = Visibility.Visible; 20 | 21 | /// 22 | /// 不显示元素,但保留空间 23 | /// 24 | /// 25 | public static void ToHide(this UIElement element) => element.Visibility = Visibility.Hidden; 26 | 27 | /// 28 | /// 不显示元素,且不保留空间 29 | /// 30 | /// 31 | public static void ToCollapse(this UIElement element) => element.Visibility = Visibility.Collapsed; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Helpers/DispatcherHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Threading; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:DispatcherHelper 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-05-12 11:22:37 11 | */ 12 | namespace CookPopularCSharpToolkit.Windows 13 | { 14 | public class DispatcherHelper 15 | { 16 | /// 17 | /// 循环执行 18 | /// 19 | public static void DoEvents() 20 | { 21 | DispatcherFrame frame = new DispatcherFrame(); 22 | DispatcherOperation exitOperation = Dispatcher.CurrentDispatcher.InvokeAsync(new Action(() => frame.Continue = false), DispatcherPriority.Background); 23 | //DispatcherOperation exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(t => (t as DispatcherFrame)!.Continue = false), frame); 24 | Dispatcher.PushFrame(frame); 25 | 26 | if (exitOperation.Status != DispatcherOperationStatus.Executing) 27 | { 28 | exitOperation.Abort(); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Helpers/ResourceHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:ResourceHelper 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-04-13 20:24:26 10 | */ 11 | namespace CookPopularCSharpToolkit.Windows 12 | { 13 | public class ResourceHelper 14 | { 15 | /// 16 | /// 根据Key获取资源 17 | /// 18 | /// 19 | /// 20 | /// 21 | public static TResource GetResource(string resourceKey) 22 | { 23 | if (Application.Current.TryFindResource(resourceKey) is TResource resource) 24 | return resource; 25 | 26 | return default(TResource); 27 | } 28 | 29 | /// 30 | /// 根据Key获取资源 31 | /// 32 | /// 33 | /// 34 | /// 35 | public static TResource GetResource(object resourceKey) 36 | { 37 | if (Application.Current.TryFindResource(resourceKey) is TResource resource) 38 | return resource; 39 | 40 | return default(TResource); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Interop/Handle/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 | namespace CookPopularCSharpToolkit.Windows.Interop 8 | { 9 | [SuppressMessage("ReSharper", "UnusedMember.Local")] 10 | public sealed class BitmapHandle : WpfSafeHandle 11 | { 12 | [SecurityCritical] 13 | private BitmapHandle() : this(true) 14 | { 15 | //请不要删除此构造函数,否则当使用自定义ico文件时会报错 16 | } 17 | 18 | [SecurityCritical] 19 | private BitmapHandle(bool ownsHandle) : base(ownsHandle, CommonHandles.GDI) 20 | { 21 | } 22 | 23 | [SecurityCritical] 24 | [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] 25 | protected override bool ReleaseHandle() 26 | { 27 | return InteropMethods.DeleteObject(handle); 28 | } 29 | 30 | [SecurityCritical] 31 | internal HandleRef MakeHandleRef(object obj) 32 | { 33 | return new HandleRef(obj, handle); 34 | } 35 | 36 | [SecurityCritical] 37 | internal static BitmapHandle CreateFromHandle(IntPtr hbitmap, bool ownsHandle = true) 38 | { 39 | return new BitmapHandle(ownsHandle) 40 | { 41 | handle = hbitmap, 42 | }; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Interop/Handle/CommonHandles.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace CookPopularCSharpToolkit.Windows.Interop 4 | { 5 | [SuppressMessage("ReSharper", "InconsistentNaming")] 6 | public static class CommonHandles 7 | { 8 | public static readonly int Icon = HandleCollector.RegisterType(nameof(Icon), 20, 500); 9 | 10 | public static readonly int HDC = HandleCollector.RegisterType(nameof(HDC), 100, 2); 11 | 12 | public static readonly int GDI = HandleCollector.RegisterType(nameof(GDI), 50, 500); 13 | 14 | public static readonly int Kernel = HandleCollector.RegisterType(nameof(Kernel), 0, 1000); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Interop/Handle/IconHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.ConstrainedExecution; 3 | using System.Security; 4 | 5 | namespace CookPopularCSharpToolkit.Windows.Interop 6 | { 7 | public 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 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Interop/Handle/SafeLocalMemoryHandle.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32.SafeHandles; 2 | using System; 3 | using System.Runtime.ConstrainedExecution; 4 | using System.Runtime.InteropServices; 5 | using System.Security; 6 | using System.Security.Permissions; 7 | 8 | 9 | 10 | /* 11 | * Copyright (c) 2021 All Rights Reserved. 12 | * Description:SafeLocalMemoryHandle 13 | * Author: Chance_写代码的厨子 14 | * Create Time:2021-08-27 11:17:32 15 | */ 16 | namespace CookPopularCSharpToolkit.Windows.Interop 17 | { 18 | /// 19 | /// Represents a warpper class for a local memory pointer 20 | /// 21 | [SuppressUnmanagedCodeSecurity(), 22 | HostProtection(SecurityAction.LinkDemand, MayLeakOnAbort = true)] 23 | public class SafeLocalMemoryHandle : SafeHandleZeroOrMinusOneIsInvalid 24 | { 25 | public SafeLocalMemoryHandle() : base(true) 26 | { 27 | 28 | } 29 | 30 | public SafeLocalMemoryHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) 31 | { 32 | base.SetHandle(preexistingHandle); 33 | } 34 | 35 | 36 | 37 | protected override bool ReleaseHandle() 38 | { 39 | return InteropMethods.LocalFree(base.handle) == IntPtr.Zero; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Interop/Handle/WpfSafeHandle.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32.SafeHandles; 2 | using System.Security; 3 | 4 | namespace CookPopularCSharpToolkit.Windows.Interop 5 | { 6 | public 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 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Listeners/StoryboardCompletionListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Media.Animation; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:StoryboardCompletionListener 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-11 15:05:23 11 | */ 12 | namespace CookPopularCSharpToolkit.Windows 13 | { 14 | public class StoryboardCompletionListener 15 | { 16 | private readonly Storyboard _storyboard; 17 | private readonly Action _continuation; 18 | 19 | public StoryboardCompletionListener(Storyboard storyboard, Action continuation) 20 | { 21 | if (storyboard == null) throw new ArgumentNullException("storyboard"); 22 | if (continuation == null) throw new ArgumentNullException("continuation"); 23 | 24 | _storyboard = storyboard; 25 | _continuation = continuation; 26 | 27 | _storyboard.Completed += StoryboardOnCompleted; 28 | } 29 | 30 | private void StoryboardOnCompleted(object sender, EventArgs eventArgs) 31 | { 32 | _storyboard.Completed -= StoryboardOnCompleted; 33 | _continuation(_storyboard); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Markup/MarkupExtenisonBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Markup; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:MarkupExtenisonBase 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-03-11 13:51:52 11 | */ 12 | namespace CookPopularCSharpToolkit.Windows 13 | { 14 | /// 15 | /// 为可以由.NET Framework XAML服务及其他XAML读取器和XAML编写器支持的XAML标记扩展实现提供基类 16 | /// 17 | public abstract class MarkupExtensionBase : MarkupExtension 18 | { 19 | protected MarkupExtensionBase() 20 | { 21 | } 22 | 23 | public override object ProvideValue(IServiceProvider serviceProvider) 24 | { 25 | return this; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/TaskWithThread/OnceTaskScheduler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | 7 | 8 | /* 9 | * Copyright (c) 2021 All Rights Reserved. 10 | * Description:OnceTaskScheduler 11 | * Author: Chance_写代码的厨子 12 | * Create Time:2021-04-13 19:39:33 13 | */ 14 | namespace CookPopularCSharpToolkit.Windows 15 | { 16 | /// 17 | /// 每个代表一个 18 | /// 19 | /// 是基于基础上的封装 20 | public class OnceTaskScheduler : TaskScheduler 21 | { 22 | protected override void QueueTask(Task task) 23 | { 24 | new Thread(() => TryExecuteTask(task)).Start(); 25 | } 26 | 27 | protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) 28 | { 29 | throw new NotImplementedException(); 30 | } 31 | 32 | protected override IEnumerable GetScheduledTasks() 33 | { 34 | throw new NotImplementedException(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/ClothTransition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/ClothTransition.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/DoorTransition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/DoorTransition.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/ExplosionTransition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/ExplosionTransition.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/FadeTransition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/FadeTransition.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/FlipTransition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/FlipTransition.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/PageTransition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/PageTransition.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/RotateTransition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/RotateTransition.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/StoryboardTransition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/StoryboardTransition.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/Transition3DBase.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/Transition3DBase.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/TransitionBase.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/TransitionBase.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/TransitionPresenter.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/TransitionPresenter.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/TransitionSelector.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/TransitionSelector.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/TranslateTransition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/TranslateTransition.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/Transitions/TwoWayTransitionSelector.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CookCSharp/CookPopularControl/338c8e42d201096f0bd0f0b26d1c7d53e55f0972/CookPopularCSharpToolkit/Windows/Transitions/TwoWayTransitionSelector.cs -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/ValidationRules/FutureDateValidationRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | 5 | 6 | 7 | /* 8 | * Copyright (c) 2021 All Rights Reserved. 9 | * Description:FutureDateValidationRule 10 | * Author: Chance_写代码的厨子 11 | * Create Time:2021-04-06 15:27:31 12 | */ 13 | namespace CookPopularCSharpToolkit.Windows 14 | { 15 | /// 16 | /// 针对只允许选中大于等于当前日期的时间规则 17 | /// 18 | public class FutureDateValidationRule : ValidationRuleBase 19 | { 20 | private string _errorMessage = "必须选择今天之后的日期"; 21 | public override string ErrorMessage { get => _errorMessage; set => _errorMessage = value; } 22 | 23 | public override ValidationResult ValidateBase(object value, CultureInfo cultureInfo) 24 | { 25 | if (!DateTime.TryParse((value ?? string.Empty).ToString(), CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal | DateTimeStyles.AllowWhiteSpaces, out DateTime dateTime)) 26 | return new ValidationResult(false, ErrorMessage); 27 | 28 | return dateTime.Date < DateTime.Now.Date ? new ValidationResult(false, ErrorMessage) : ValidationResult.ValidResult; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CookPopularCSharpToolkit/Windows/ValidationRules/ValidationRuleBase.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Windows.Controls; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:ValidationRuleBase 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-03-22 09:04:36 11 | */ 12 | namespace CookPopularCSharpToolkit.Windows 13 | { 14 | /// 15 | /// 提供数据验证基类 16 | /// 17 | public abstract class ValidationRuleBase : ValidationRule 18 | { 19 | /// 20 | /// 错误提示信息 21 | /// 22 | public abstract string ErrorMessage { get; set; } 23 | 24 | protected ValidationRuleBase() 25 | { 26 | 27 | } 28 | 29 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 30 | { 31 | return ValidateBase(value, cultureInfo); 32 | } 33 | 34 | /// 35 | /// 自定义验证方法基类 36 | /// 37 | /// 38 | /// 39 | /// 40 | public abstract ValidationResult ValidateBase(object value, CultureInfo cultureInfo); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Attached/ButtonBaseAttached.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Communal; 2 | using System.Windows; 3 | using System.Windows.Controls.Primitives; 4 | using System.Windows.Media; 5 | 6 | 7 | /* 8 | * Copyright (c) 2021 All Rights Reserved. 9 | * Description:提供ButtonBase的附加属性 10 | * Author: Chance_写代码的厨子 11 | * Create Time:2021-02-20 11:05:19 12 | */ 13 | namespace CookPopularControl.Communal 14 | { 15 | /// 16 | /// 提供的附加属性 17 | /// 18 | public class ButtonBaseAttached 19 | { 20 | public static bool GetIsShowRipple(DependencyObject obj) => (bool)obj.GetValue(IsShowRippleProperty); 21 | public static void SetIsShowRipple(DependencyObject obj, bool value) => obj.SetValue(IsShowRippleProperty, ValueBoxes.BooleanBox(value)); 22 | /// 23 | /// 是否显示按钮点击的波纹效果 24 | /// 25 | public static readonly DependencyProperty IsShowRippleProperty = 26 | DependencyProperty.RegisterAttached("IsShowRipple", typeof(bool), typeof(ButtonBaseAttached), new PropertyMetadata(ValueBoxes.TrueBox)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Commands/CloseWindowCommand.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description:CloseWindowCommand 3 | * Author: Chance.Zheng 4 | * Create Time: 2023-03-08 14:53:02 5 | * .Net Version: 4.6 6 | * CLR Version: 4.0.30319.42000 7 | * Copyright (c) CookCSharp 2023 All Rights Reserved. 8 | */ 9 | 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Threading.Tasks; 16 | using System.Windows; 17 | using System.Windows.Input; 18 | 19 | namespace CookPopularControl.Communal 20 | { 21 | public class CloseWindowCommand : ICommand 22 | { 23 | public bool CanExecute(object parameter) => true; 24 | 25 | public void Execute(object parameter) 26 | { 27 | if (parameter is DependencyObject dependencyObject) 28 | { 29 | if (Window.GetWindow(dependencyObject) is { } window) 30 | { 31 | window.Close(); 32 | } 33 | } 34 | } 35 | 36 | public event EventHandler CanExecuteChanged; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Commands/SetMainWindowToTopCommand.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description:SetMainWindowToTopCommand 3 | * Author: Chance.Zheng 4 | * Create Time: 2023-03-08 14:43:51 5 | * .Net Version: 4.6 6 | * CLR Version: 4.0.30319.42000 7 | * Copyright (c) CookCSharp 2023 All Rights Reserved. 8 | */ 9 | 10 | 11 | using CookPopularCSharpToolkit.Windows; 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Threading.Tasks; 17 | using System.Windows; 18 | using System.Windows.Input; 19 | 20 | namespace CookPopularControl.Communal 21 | { 22 | public class SetMainWindowToTopCommand : ICommand 23 | { 24 | public bool CanExecute(object parameter) => true; 25 | 26 | public void Execute(object parameter) 27 | { 28 | if (Application.Current.MainWindow != null && Application.Current.MainWindow.Visibility != Visibility.Visible) 29 | { 30 | Application.Current.MainWindow.Show(); 31 | Application.Current.MainWindow.SafeActivate(); 32 | } 33 | } 34 | 35 | public event EventHandler CanExecuteChanged; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Commands/ShutdownAppCommand.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description:ShutdownAppCommand 3 | * Author: Chance.Zheng 4 | * Create Time: 2023-03-08 14:42:22 5 | * .Net Version: 4.6 6 | * CLR Version: 4.0.30319.42000 7 | * Copyright (c) CookCSharp 2023 All Rights Reserved. 8 | */ 9 | 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Threading.Tasks; 16 | using System.Windows; 17 | using System.Windows.Input; 18 | 19 | namespace CookPopularControl.Communal 20 | { 21 | public class ShutdownAppCommand : ICommand 22 | { 23 | public bool CanExecute(object parameter) => true; 24 | 25 | public void Execute(object parameter) => Application.Current.Shutdown(); 26 | 27 | public event EventHandler CanExecuteChanged; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Converters/StringToPlaySpeedConverter.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Windows; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | using System.Windows.Markup; 6 | 7 | 8 | 9 | /* 10 | * Copyright (c) 2021 All Rights Reserved. 11 | * Description:StringToPlaySpeedConverter 12 | * Author: Chance_写代码的厨子 13 | * Create Time:2021-04-27 20:00:48 14 | */ 15 | namespace CookPopularControl.Communal 16 | { 17 | [MarkupExtensionReturnType(typeof(string))] 18 | public class StringToPlaySpeedConverter : MarkupExtensionBase, IValueConverter 19 | { 20 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | return value == null ? string.Empty : value.ToString(); 23 | } 24 | 25 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 26 | { 27 | throw new NotImplementedException(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Converters/TextFieldClearButtonVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Communal; 2 | using CookPopularCSharpToolkit.Windows; 3 | using System; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | using System.Windows.Markup; 9 | 10 | 11 | 12 | /* 13 | * Copyright (c) 2021 All Rights Reserved. 14 | * Description:TextFieldClearButtonVisibilityConverter 15 | * Author: Chance_写代码的厨子 16 | * Create Time:2021-03-19 17:27:36 17 | */ 18 | namespace CookPopularControl.Communal 19 | { 20 | /// 21 | /// 文本清除按钮 22 | /// 23 | [MarkupExtensionReturnType(typeof(Visibility))] 24 | public class TextFieldClearButtonVisibilityConverter : MarkupExtensionBase, IMultiValueConverter 25 | { 26 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 27 | { 28 | if (values.Count() < 2) return Visibility.Collapsed; 29 | if ((bool)values[0] && !string.IsNullOrEmpty(values[1] == null ? string.Empty : values[1].ToString())) 30 | return ValueBoxes.VisibleBox; 31 | else 32 | return ValueBoxes.CollapsedBox; 33 | } 34 | 35 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 36 | { 37 | throw new NotImplementedException(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Converters/WaveProgressBarConverters.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Windows; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | using System.Windows.Markup; 6 | 7 | 8 | 9 | /* 10 | * Copyright (c) 2021 All Rights Reserved. 11 | * Description:WaveProgressBarConverter 12 | * Author: Chance_写代码的厨子 13 | * Create Time:2021-03-15 16:37:20 14 | */ 15 | namespace CookPopularControl.Communal 16 | { 17 | [MarkupExtensionReturnType(typeof(double))] 18 | public class ProgressBarValueToTranslateTransformY : MarkupExtensionBase, IValueConverter 19 | { 20 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | if (value is double v) 23 | { 24 | return -v / 100D; 25 | } 26 | 27 | return double.NaN; 28 | } 29 | 30 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | throw new NotImplementedException(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Args/ThemeChangedArg.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description:ThemeChangedArg 3 | * Author: Chance.Zheng 4 | * Create Time: 2022-11-01 14:33:37 5 | * .Net Version: 4.6 6 | * CLR Version: 4.0.30319.42000 7 | * Copyright (c) CookCSharp 2020-2022 All Rights Reserved. 8 | */ 9 | 10 | 11 | using CookPopularControl.Expression; 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Threading.Tasks; 17 | using System.Windows; 18 | 19 | namespace CookPopularControl.Communal.Data 20 | { 21 | public delegate void ThemeEventHandler(object sender, ThemeChangedArg e); 22 | 23 | public class ThemeChangedArg : RoutedEventArgs 24 | { 25 | public TDictionary ThemeDictionary { get; private set; } 26 | 27 | public ThemeChangedArg(TDictionary dictionary) : base() 28 | { 29 | ThemeDictionary = dictionary; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Enum/AlertorState.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:AlertorState 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-06-10 10:43:29 6 | */ 7 | namespace CookPopularControl.Communal.Data 8 | { 9 | /// 10 | /// 警报器状态 11 | /// 12 | public enum AlertorState 13 | { 14 | Normal, 15 | Success, 16 | Warning, 17 | Error, 18 | Fatal 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Enum/BranchItem.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:BranchItem 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-08-12 08:46:17 6 | */ 7 | namespace CookPopularControl.Communal.Data 8 | { 9 | public enum BranchItem 10 | { 11 | First, 12 | Second 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Enum/ControlBorderAnimationType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:ControlBorderAni 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-07-30 16:38:38 6 | */ 7 | namespace CookPopularControl.Communal.Data 8 | { 9 | /// 10 | /// 表示枚举类型 11 | /// 12 | public enum ControlBorderAnimationType 13 | { 14 | /// 15 | /// 同时变化 16 | /// 17 | Thickness, 18 | /// 19 | /// 下,右,上,左有序变化 20 | /// 21 | OrderThickness, 22 | /// 23 | /// 路径 24 | /// 25 | Path, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Enum/DropZoneLocation.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:DropZoneLocation 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-08-11 17:12:25 6 | */ 7 | namespace CookPopularControl.Communal.Data 8 | { 9 | public enum DropZoneLocation 10 | { 11 | Top, 12 | Right, 13 | Bottom, 14 | Left, 15 | Floating 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Enum/EmptyHeaderSizingHint.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:EmptyHeaderSizingHint 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-08-11 17:49:21 6 | */ 7 | namespace CookPopularControl.Communal.Data 8 | { 9 | /// 10 | /// Provide a hint for how the header should size itself if there are no tabs left (and a Window is still open). 11 | /// 12 | public enum EmptyHeaderSizingHint 13 | { 14 | /// 15 | /// The header size collapses to zero along the correct axis. 16 | /// 17 | Collapse, 18 | /// 19 | /// The header size remains that of the last tab prior to the tab header becoming empty. 20 | /// 21 | PreviousTab, 22 | //TODO implement EmptyHeaderSizingHint.Stretch 23 | /// 24 | /// The header stretches along the according axis. 25 | /// 26 | //Stretch 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Enum/InterTabTransferReason.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:InterTabTransferReason 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-08-11 18:05:40 6 | */ 7 | namespace CookPopularControl.Communal.Data 8 | { 9 | internal enum InterTabTransferReason 10 | { 11 | Breach, 12 | Reentry 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Enum/LoadingTrack.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:$Do something$ 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-03-01 15:46:27 6 | */ 7 | namespace CookPopularControl.Communal.Data 8 | { 9 | /// 10 | /// 加载缓动画类型 11 | /// 12 | public enum DotLoadingTrack 13 | { 14 | /// 15 | /// 圆 16 | /// 17 | Circle, 18 | /// 19 | /// 直线 20 | /// 21 | Line, 22 | /// 23 | /// 钟摆 24 | /// 25 | Pendulum 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Enum/SizeGrip.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:SizeGrip 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-08-11 10:54:01 6 | */ 7 | namespace CookPopularControl.Communal.Data 8 | { 9 | /// 10 | /// 标识的方位控制 11 | /// 12 | public enum SizeGrip 13 | { 14 | NotApplicable, 15 | Left, 16 | TopLeft, 17 | Top, 18 | TopRight, 19 | Right, 20 | BottomRight, 21 | Bottom, 22 | BottomLeft 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Enum/TabEmptiedResponse.cs: -------------------------------------------------------------------------------- 1 | using CookPopularControl.Controls.Dragables; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:TabEmptiedResponse 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-08-11 17:36:49 10 | */ 11 | namespace CookPopularControl.Communal.Data 12 | { 13 | public enum TabEmptiedResponse 14 | { 15 | /// 16 | /// Allow the Window to be closed automatically. 17 | /// 18 | CloseWindowOrLayoutBranch, 19 | /// 20 | /// The window will not be closed by the , probably meaning the implementor will close the window manually 21 | /// 22 | DoNothing 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/Data/Exceptions/LocationReportException.cs: -------------------------------------------------------------------------------- 1 | using CookPopularControl.Controls.Dragables; 2 | using System; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:LocationReportException 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-12 08:52:50 11 | */ 12 | namespace CookPopularControl.Communal.Data 13 | { 14 | /// 15 | /// 提供关于 16 | /// 17 | public class LocationReportException : Exception 18 | { 19 | public LocationReportException() 20 | { 21 | } 22 | 23 | public LocationReportException(string message) : base(message) 24 | { 25 | } 26 | 27 | public LocationReportException(string message, Exception innerException) : base(message, innerException) 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/StyleSelectors/CouldBeHeaderedStyleSelector.cs: -------------------------------------------------------------------------------- 1 | using CookPopularControl.Controls.Dragables; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | 6 | 7 | /* 8 | * Copyright (c) 2021 All Rights Reserved. 9 | * Description:CouldBeHeaderedStyleSelector 10 | * Author: Chance_写代码的厨子 11 | * Create Time:2021-08-11 16:05:06 12 | */ 13 | namespace CookPopularControl.Communal 14 | { 15 | public class CouldBeHeaderedStyleSelector : StyleSelector 16 | { 17 | public Style NonHeaderedStyle { get; set; } 18 | 19 | public Style HeaderedStyle { get; set; } 20 | 21 | public override Style SelectStyle(object item, DependencyObject container) 22 | { 23 | return container is HeaderedDragableItem || container is HeaderedContentControl 24 | ? HeaderedStyle 25 | : NonHeaderedStyle; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CookPopularControl/Communal/StyleSelectors/InternalStyle.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description:InternalStyle 3 | * Author: Chance.Zheng 4 | * Create Time: 2022-10-21 11:48:50 5 | * .Net Version: 4.6 6 | * CLR Version: 4.0.30319.42000 7 | * Copyright (c) CookCSharp 2020-2022 All Rights Reserved. 8 | */ 9 | 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Threading.Tasks; 16 | using System.Windows; 17 | 18 | 19 | namespace CookPopularControl.Communal 20 | { 21 | internal class InternalStyle : Style 22 | { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Adorner/AdornerBase.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xaml.Behaviors.Layout; 2 | using System.Windows; 3 | using System.Windows.Documents; 4 | using OriginAdorner = System.Windows.Documents.Adorner; 5 | 6 | 7 | 8 | /* 9 | * Copyright (c) 2021 All Rights Reserved. 10 | * Description:AdornerBase 11 | * Author: Chance_写代码的厨子 12 | * Create Time:2021-04-12 11:13:11 13 | */ 14 | namespace CookPopularControl.Controls 15 | { 16 | /// 17 | /// 将装饰器绑定到元素的基类 18 | /// 19 | public class AdornerBase : OriginAdorner 20 | { 21 | public AdornerBase(UIElement adornerElement) : base(adornerElement) 22 | { 23 | 24 | } 25 | 26 | public void AddAdornerElement() 27 | { 28 | var layer = AdornerLayer.GetAdornerLayer(AdornedElement); 29 | layer?.Add(new AdornerContainer(AdornedElement)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Button/ButtonBase3D.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls.Primitives; 3 | using System.Windows.Input; 4 | 5 | 6 | 7 | /* 8 | * Copyright (c) 2021 All Rights Reserved. 9 | * Description:ButtonBase3D 10 | * Author: Chance_写代码的厨子 11 | * Create Time:2021-08-10 14:44:41 12 | */ 13 | namespace CookPopularControl.Controls 14 | { 15 | public class ButtonBase3D : UIElement3D 16 | { 17 | public static readonly RoutedEvent ClickEvent = ButtonBase.ClickEvent.AddOwner(typeof(ButtonBase3D)); 18 | 19 | public event RoutedEventHandler Click 20 | { 21 | add { base.AddHandler(ClickEvent, value); } 22 | remove { base.AddHandler(ClickEvent, value); } 23 | } 24 | 25 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) 26 | { 27 | base.OnMouseLeftButtonDown(e); 28 | 29 | OnClick(); 30 | e.Handled = true; 31 | } 32 | 33 | private void OnClick() 34 | { 35 | RoutedEventArgs args = new RoutedEventArgs(ClickEvent, this); 36 | base.RaiseEvent(args); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/ColorPicker/HexadecimalColorBehavior.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Windows; 2 | using System.Windows.Controls; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:HexadecimalColorBehavior 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-06-09 19:20:42 11 | */ 12 | namespace CookPopularControl.Controls 13 | { 14 | public class HexadecimalColorBehavior : AllowableCharactersInputElementBehavior 15 | { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/DialogBox/DialogBoxContainer.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Documents; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:DialogBoxContainer 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-04-12 15:37:55 10 | */ 11 | namespace CookPopularControl.Controls 12 | { 13 | /// 14 | /// 承载对话框内容的对话容器 15 | /// 16 | public class DialogBoxContainer : AdornerDecorator 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/DialogBox/IDialog.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description:IDialog 3 | * Author: Chance.Zheng 4 | * Create Time: 2023-03-08 14:58:25 5 | * .Net Version: 4.6 6 | * CLR Version: 4.0.30319.42000 7 | * Copyright (c) CookCSharp 2023 All Rights Reserved. 8 | */ 9 | 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Threading.Tasks; 16 | using System.Windows; 17 | 18 | namespace CookPopularControl.Controls 19 | { 20 | public interface IDialog 21 | { 22 | /// 23 | /// 对话框是否关闭 24 | /// 25 | public bool IsClosed { get; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/BranchResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:BranchResult 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-08-11 16:26:14 10 | */ 11 | namespace CookPopularControl.Controls.Dragables 12 | { 13 | public class BranchResult 14 | { 15 | private readonly Branch _branch; 16 | private readonly DragableTabControl _tabablzControl; 17 | 18 | public BranchResult(Branch branch, DragableTabControl tabablzControl) 19 | { 20 | if (branch == null) throw new ArgumentNullException("branch"); 21 | if (tabablzControl == null) throw new ArgumentNullException("tabablzControl"); 22 | 23 | _branch = branch; 24 | _tabablzControl = tabablzControl; 25 | } 26 | 27 | /// 28 | /// The new branch. 29 | /// 30 | public Branch Branch 31 | { 32 | get { return _branch; } 33 | } 34 | 35 | /// 36 | /// The new tab control. 37 | /// 38 | public DragableTabControl TabablzControl 39 | { 40 | get { return _tabablzControl; } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/DefaultNewItemFactory.cs: -------------------------------------------------------------------------------- 1 | using CookPopularControl.Communal.ViewModel; 2 | using System; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:DefaultNewItemFactory 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-13 10:02:48 11 | */ 12 | namespace CookPopularControl.Controls.Dragables 13 | { 14 | internal class DefaultNewItemFactory 15 | { 16 | public static Func DefaultItemFactory 17 | { 18 | get 19 | { 20 | return () => 21 | { 22 | var dateTime = DateTime.Now; 23 | 24 | return new HeaderedItemViewModel() 25 | { 26 | Header = dateTime.ToString("yyyy"), 27 | Content = dateTime.ToString("R") 28 | }; 29 | }; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/HorizontalOrganiser.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:HorizontalOrganiser 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-08-11 17:19:10 10 | */ 11 | namespace CookPopularControl.Controls.Dragables 12 | { 13 | public class HorizontalOrganiser : StackOrganiser 14 | { 15 | public HorizontalOrganiser() : base(Orientation.Horizontal) 16 | { } 17 | 18 | public HorizontalOrganiser(double itemOffset) : base(Orientation.Horizontal, itemOffset) 19 | { } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/HorizontalPositionMonitor.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:VerticalPositionMonitor 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-09-03 17:02:38 10 | */ 11 | namespace CookPopularControl.Controls.Dragables 12 | { 13 | public class HorizontalPositionMonitor : StackPositionMonitor 14 | { 15 | public HorizontalPositionMonitor() : base(Orientation.Horizontal) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/LocationSnapShot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:LocationSnapShot 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-11 15:51:22 11 | */ 12 | namespace CookPopularControl.Controls.Dragables 13 | { 14 | internal class LocationSnapShot 15 | { 16 | private readonly double _width; 17 | private readonly double _height; 18 | 19 | public static LocationSnapShot Take(FrameworkElement frameworkElement) 20 | { 21 | if (frameworkElement == null) throw new ArgumentNullException("frameworkElement"); 22 | 23 | return new LocationSnapShot(frameworkElement.Width, frameworkElement.Height); 24 | } 25 | 26 | private LocationSnapShot(double width, double height) 27 | { 28 | _width = width; 29 | _height = height; 30 | } 31 | 32 | public void Apply(FrameworkElement frameworkElement) 33 | { 34 | if (frameworkElement == null) throw new ArgumentNullException("frameworkElement"); 35 | 36 | frameworkElement.SetCurrentValue(FrameworkElement.WidthProperty, _width); 37 | frameworkElement.SetCurrentValue(FrameworkElement.HeightProperty, _height); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/MoveItemRequest.cs: -------------------------------------------------------------------------------- 1 | using CookPopularControl.Communal.Data; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:MoveItemRequest 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-08-11 14:03:12 10 | */ 11 | namespace CookPopularControl.Controls.Dragables 12 | { 13 | public class MoveItemRequest 14 | { 15 | private readonly object _item; 16 | private readonly object _context; 17 | private readonly AddLocationHint _addLocationHint; 18 | 19 | public MoveItemRequest(object item, object context, AddLocationHint addLocationHint) 20 | { 21 | _item = item; 22 | _context = context; 23 | _addLocationHint = addLocationHint; 24 | } 25 | 26 | public object Item => _item; 27 | 28 | public object Context => _context; 29 | 30 | public AddLocationHint AddLocationHint => _addLocationHint; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/NewTabHost!.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:NewTabHost 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-11 17:40:28 11 | */ 12 | namespace CookPopularControl.Controls.Dragables 13 | { 14 | public class NewTabHost : INewTabHost where TElement : UIElement 15 | { 16 | private readonly TElement _container; 17 | private readonly DragableTabControl _tabableControl; 18 | 19 | public NewTabHost(TElement container, DragableTabControl tabableControl) 20 | { 21 | if (container == null) throw new ArgumentNullException("container"); 22 | if (tabableControl == null) throw new ArgumentNullException("tabablzControl"); 23 | 24 | _container = container; 25 | _tabableControl = tabableControl; 26 | } 27 | 28 | public TElement Container 29 | { 30 | get { return _container; } 31 | } 32 | 33 | public DragableTabControl DragableTabControl 34 | { 35 | get { return _tabableControl; } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/PositionMonitor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Threading.Tasks; 4 | 5 | 6 | namespace CookPopularControl.Controls.Dragables 7 | { 8 | /// 9 | /// Consumers can provide a position monitor to receive updates regarding the location of an item. 10 | /// 11 | /// 12 | /// A can be used to listen to changes 13 | /// instead of routed events, which can be easier in a MVVM scenario. 14 | /// 15 | public class PositionMonitor 16 | { 17 | /// 18 | /// Raised when the X,Y coordinate of a changes. 19 | /// 20 | public event EventHandler LocationChanged; 21 | 22 | internal virtual void OnLocationChanged(LocationChangedEventArgs e) 23 | { 24 | if (e == null) throw new ArgumentNullException("e"); 25 | 26 | var handler = LocationChanged; 27 | handler?.Invoke(this, e); 28 | } 29 | 30 | internal virtual void ItemsChanged() { } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/VerticalOrganiser.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:VerticalOrganiser 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-08-11 15:20:16 10 | */ 11 | namespace CookPopularControl.Controls.Dragables 12 | { 13 | public class VerticalOrganiser : StackOrganiser 14 | { 15 | public VerticalOrganiser() : base(Orientation.Vertical) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Core/VerticalPositionMonitor.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:VerticalPositionMonitor 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-09-03 17:02:38 10 | */ 11 | namespace CookPopularControl.Controls.Dragables 12 | { 13 | public class VerticalPositionMonitor : StackPositionMonitor 14 | { 15 | public VerticalPositionMonitor() : base(Orientation.Vertical) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Data/Args/DragableItemEventArgs.cs: -------------------------------------------------------------------------------- 1 | using CookPopularControl.Controls.Dragables; 2 | using System; 3 | using System.Windows; 4 | using System.Windows.Controls.Primitives; 5 | 6 | namespace CookPopularControl.Controls.Dragables 7 | { 8 | public delegate void DragableItemEventHandler(object sender, DragableItemEventArgs e); 9 | 10 | public class DragableItemEventArgs : RoutedEventArgs 11 | { 12 | private readonly DragableItem _dragableItem; 13 | 14 | public DragableItemEventArgs(DragableItem dragableItem) 15 | { 16 | if (dragableItem == null) throw new ArgumentNullException("dragableItem"); 17 | 18 | _dragableItem = dragableItem; 19 | } 20 | 21 | public DragableItemEventArgs(RoutedEvent routedEvent, DragableItem dragableItem) 22 | : base(routedEvent) 23 | { 24 | _dragableItem = dragableItem; 25 | } 26 | 27 | public DragableItemEventArgs(RoutedEvent routedEvent, object source, DragableItem dragableItem) 28 | : base(routedEvent, source) 29 | { 30 | _dragableItem = dragableItem; 31 | } 32 | 33 | public DragableItem DragableItem 34 | { 35 | get { return _dragableItem; } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Data/Args/LocationChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace CookPopularControl.Controls.Dragables 5 | { 6 | public class LocationChangedEventArgs : EventArgs 7 | { 8 | private readonly object _item; 9 | private readonly Point _location; 10 | 11 | public LocationChangedEventArgs(object item, Point location) 12 | { 13 | if (item == null) throw new ArgumentNullException("item"); 14 | 15 | _item = item; 16 | _location = location; 17 | } 18 | 19 | public object Item 20 | { 21 | get { return _item; } 22 | } 23 | 24 | public Point Location 25 | { 26 | get { return _location; } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Data/Args/OrderChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CookPopularControl.Controls.Dragables 4 | { 5 | public class OrderChangedEventArgs : EventArgs 6 | { 7 | private readonly object[] _previousOrder; 8 | private readonly object[] _newOrder; 9 | 10 | public OrderChangedEventArgs(object[] previousOrder, object[] newOrder) 11 | { 12 | if (newOrder == null) throw new ArgumentNullException("newOrder"); 13 | 14 | _previousOrder = previousOrder; 15 | _newOrder = newOrder; 16 | } 17 | 18 | public object[] PreviousOrder 19 | { 20 | get { return _previousOrder; } 21 | } 22 | 23 | public object[] NewOrder 24 | { 25 | get { return _newOrder; } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Data/Enum/AddLocationHint.cs: -------------------------------------------------------------------------------- 1 | namespace CookPopularControl.Controls.Dragables 2 | { 3 | /// 4 | /// Specifies where an item should appear when added to tab control, as the headers order do not 5 | /// specifically correlate to the order of the the source items. 6 | /// 7 | public enum AddLocationHint 8 | { 9 | /// 10 | /// Display item in the first position. 11 | /// 12 | First, 13 | /// 14 | /// Display item in the first position. 15 | /// 16 | Last, 17 | /// 18 | /// Display an item prior to the selected, or specified item. 19 | /// 20 | Prior, 21 | /// 22 | /// Display an item after the selected, or specified item. 23 | /// 24 | After 25 | } 26 | } -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Data/Enum/SizeGrip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | 9 | /* 10 | * Description:Class1 11 | * Author: Chance_写代码的厨子 12 | * Company: Chance 13 | * Create Time:2021-11-14 00:59:06 14 | * .NET Version: 4.6 15 | * CLR Version: 4.0.30319.42000 16 | * Copyright (c) Chance 2021 All Rights Reserved. 17 | */ 18 | namespace CookPopularControl.Controls.Dragables 19 | { 20 | public enum SizeGrip 21 | { 22 | NotApplicable, 23 | Left, 24 | TopLeft, 25 | Top, 26 | TopRight, 27 | Right, 28 | BottomRight, 29 | Bottom, 30 | BottomLeft 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/DragableControls.md: -------------------------------------------------------------------------------- 1 | #### 参照[Dragablz](https://github.com/ButchersBoy/Dragablz)更改 -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Interface/IInterLayoutClient.cs: -------------------------------------------------------------------------------- 1 | using CookPopularControl.Controls.Dragables; 2 | using System.Windows; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:IInterLayoutClient 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-12 08:55:14 11 | */ 12 | namespace CookPopularControl.Controls.Dragables 13 | { 14 | /// 15 | /// Implementors should provide a mechanism to provide a new host control which contains a new . 16 | /// 17 | public interface IInterLayoutClient 18 | { 19 | /// 20 | /// Provide a new host control and tab into which will be placed into a newly created layout branch. 21 | /// 22 | /// Provides the partition where the drag operation was initiated. 23 | /// The source control where a dragging operation was initiated. 24 | /// 25 | INewTabHost GetNewHost(object partition, DragableTabControl source); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Interface/IManualInterTabClient.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:IManualInterTabClient 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-08-11 17:50:32 6 | */ 7 | namespace CookPopularControl.Controls.Dragables 8 | { 9 | public interface IManualInterTabClient : IInterTabClient 10 | { 11 | void Add(object item); 12 | void Remove(object item); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Dragables/Interface/INewTabHost!.cs: -------------------------------------------------------------------------------- 1 | using CookPopularControl.Controls.Dragables; 2 | using System.Windows; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:INewTabHost 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-08-11 17:35:45 11 | */ 12 | namespace CookPopularControl.Controls.Dragables 13 | { 14 | public interface INewTabHost where TElement : UIElement 15 | { 16 | TElement Container { get; } 17 | DragableTabControl DragableTabControl { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Fields/IHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | /* 9 | * Description:IHeader 10 | * Author: Chance.Zheng 11 | * Create Time: 2022-06-20 17:34:35 12 | * .Net Version: 4.6 13 | * CLR Version: 4.0.30319.42000 14 | * Copyright (c) CookCSharp 2020-2022 All Rights Reserved. 15 | */ 16 | namespace CookPopularControl.Controls 17 | { 18 | public interface IHeader 19 | { 20 | object Header { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Menus/Spelling.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:Spelling 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-09-28 16:25:53 10 | */ 11 | namespace CookPopularControl.Controls 12 | { 13 | public static class Spelling 14 | { 15 | public static ResourceKey SuggestionMenuItemStyleKey { get; } = new ComponentResourceKey(typeof(Spelling), ResourceKeyId.SpellingSuggestionMenuItemStyle); 16 | public static ResourceKey IgnoreAllMenuItemStyleKey { get; } = new ComponentResourceKey(typeof(Spelling), ResourceKeyId.SpellingIgnoreAllMenuItemStyle); 17 | public static ResourceKey NoSuggestionsMenuItemStyleKey { get; } = new ComponentResourceKey(typeof(Spelling), ResourceKeyId.SpellingNoSuggestionsMenuItemStyle); 18 | public static ResourceKey SeparatorStyleKey { get; } = new ComponentResourceKey(typeof(Spelling), ResourceKeyId.SpellingSeparatorStyle); 19 | } 20 | 21 | internal enum ResourceKeyId 22 | { 23 | SpellingSuggestionMenuItemStyle, 24 | SpellingIgnoreAllMenuItemStyle, 25 | SpellingNoSuggestionsMenuItemStyle, 26 | SpellingSeparatorStyle, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Others/Shield.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 All Rights Reserved. 3 | * Description:Shield 4 | * Author: Chance_写代码的厨子 5 | * Create Time:2021-10-21 18:30:56 6 | */ 7 | namespace CookPopularControl.Controls 8 | { 9 | public class Shield 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Panels/SimpleGrid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:$Do something$ 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-02-20 10:14:22 11 | */ 12 | namespace CookPopularControl.Controls 13 | { 14 | /// 15 | /// 重叠面板 16 | /// 17 | /// 用于代替Grid 18 | public class SimpleGrid : Panel 19 | { 20 | protected override Size MeasureOverride(Size availableSize) 21 | { 22 | var size = new Size(); 23 | 24 | foreach (UIElement child in InternalChildren) 25 | { 26 | if (child != null) 27 | { 28 | child.Measure(availableSize); 29 | size.Width = Math.Max(size.Width, child.DesiredSize.Width); 30 | size.Height = Math.Max(size.Height, child.DesiredSize.Height); 31 | } 32 | } 33 | 34 | return size; 35 | } 36 | 37 | protected override Size ArrangeOverride(Size finalSize) 38 | { 39 | foreach (UIElement child in InternalChildren) 40 | { 41 | child?.Arrange(new Rect(finalSize)); 42 | } 43 | 44 | return finalSize; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Progress/CircularProgressAssistant.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Communal; 2 | using System.Windows; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:CircularProgress 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-03-11 17:57:20 11 | */ 12 | namespace CookPopularControl.Controls 13 | { 14 | /// 15 | /// 表示圆形进度条的附加属性类 16 | /// 17 | public class CircularProgressAssistant 18 | { 19 | public static double GetArcThickness(DependencyObject obj) => (double)obj.GetValue(ArcThicknessProperty); 20 | public static void SetArcThickness(DependencyObject obj, double value) => obj.SetValue(ArcThicknessProperty, value); 21 | public static readonly DependencyProperty ArcThicknessProperty = 22 | DependencyProperty.RegisterAttached("ArcThickness", typeof(double), typeof(CircularProgressAssistant), new FrameworkPropertyMetadata(ValueBoxes.Double5Box, FrameworkPropertyMetadataOptions.Inherits)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Data/IndexAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | 9 | /* 10 | * Description:IndexAttribute 11 | * Author: Chance(a cook of write code) 12 | * Company: CookCSharp 13 | * Create Time:2022-01-10 19:49:13 14 | * .NET Version: 4.6 15 | * CLR Version: 4.0.30319.42000 16 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 17 | */ 18 | namespace CookPopularControl.Controls 19 | { 20 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)] 21 | public class IndexAttribute : Attribute 22 | { 23 | public int SelectedIndex { get; set; } 24 | 25 | public IndexAttribute(int selectedIndex) 26 | { 27 | SelectedIndex = selectedIndex; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Data/NumberRangeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | 9 | /* 10 | * Description:NumberRangeAttribute 11 | * Author: Chance(a cook of write code) 12 | * Company: CookCSharp 13 | * Create Time:2022-01-10 17:42:54 14 | * .NET Version: 4.6 15 | * CLR Version: 4.0.30319.42000 16 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 17 | */ 18 | namespace CookPopularControl.Controls 19 | { 20 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)] 21 | public class NumberRangeAttribute : Attribute 22 | { 23 | public double MinValue { get; set; } = double.MinValue; 24 | public double MaxValue { get; set; } = double.MaxValue; 25 | 26 | public NumberRangeAttribute() 27 | { 28 | 29 | } 30 | 31 | public NumberRangeAttribute(double minValue, double maxValue) 32 | { 33 | MinValue = minValue; 34 | MaxValue = maxValue; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Data/PropertyItemEditorType.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.Controls; 7 | 8 | 9 | 10 | /* 11 | * Description:PropertyItemEditorType 12 | * Author: Chance(a cook of write code) 13 | * Company: CookCSharp 14 | * Create Time:2022-01-05 17:28:45 15 | * .NET Version: 4.6 16 | * CLR Version: 4.0.30319.42000 17 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 18 | */ 19 | namespace CookPopularControl.Controls 20 | { 21 | /// 22 | /// 指定元素类型 23 | /// 24 | public enum PropertyItemEditorType 25 | { 26 | PlainText, 27 | Number, 28 | SwitchBar, 29 | DateTime, 30 | Button, 31 | Image, 32 | HorizontalAlignment, 33 | VerticalAlignment, 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Editors/PropertyButtonEditor.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 | 9 | 10 | /* 11 | * Description:PropertyButtonEditor 12 | * Author: Chance(a cook of write code) 13 | * Company: CookCSharp 14 | * Create Time:2022-01-10 11:34:20 15 | * .NET Version: 4.6 16 | * CLR Version: 4.0.30319.42000 17 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 18 | */ 19 | namespace CookPopularControl.Controls 20 | { 21 | public class PropertyButtonEditor : PropertyItemEditorFactory 22 | { 23 | public override FrameworkElement GetElement(PropertyItem propertyItem) => new System.Windows.Controls.Button 24 | { 25 | IsEnabled = !propertyItem.IsReadOnly, 26 | }; 27 | 28 | public override DependencyProperty GetDependencyProperty() => System.Windows.Controls.Button.ContentProperty; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Editors/PropertyComboBoxEditor.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Windows; 2 | using System; 3 | using System.Collections; 4 | using System.Windows; 5 | using System.Windows.Controls.Primitives; 6 | 7 | 8 | /* 9 | * Description:PropertyComboBoxEditor 10 | * Author: Chance(a cook of write code) 11 | * Company: CookCSharp 12 | * Create Time:2022-01-09 14:04:38 13 | * .NET Version: 4.6 14 | * CLR Version: 4.0.30319.42000 15 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 16 | */ 17 | namespace CookPopularControl.Controls 18 | { 19 | public class PropertyComboBoxEditor : PropertyItemEditorFactory 20 | { 21 | public int SelectedIndex { get; private set; } 22 | 23 | public PropertyComboBoxEditor(int selectedIndex) 24 | { 25 | SelectedIndex = selectedIndex; 26 | } 27 | 28 | public override FrameworkElement GetElement(PropertyItem propertyItem) => new System.Windows.Controls.ComboBox 29 | { 30 | IsEnabled = !propertyItem.IsReadOnly, 31 | SelectedIndex = SelectedIndex, 32 | ItemsSource = propertyItem.PropertyType.BaseType == typeof(Enum) ? Enum.GetValues(propertyItem.PropertyType) : propertyItem.Value as IEnumerable, 33 | }; 34 | 35 | public override DependencyProperty GetDependencyProperty() => Selector.SelectedItemProperty; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Editors/PropertyDatePickerEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | 5 | /* 6 | * Description:PropertyDatePickerEditor 7 | * Author: Chance(a cook of write code) 8 | * Company: CookCSharp 9 | * Create Time:2022-01-09 14:01:38 10 | * .NET Version: 4.6 11 | * CLR Version: 4.0.30319.42000 12 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 13 | */ 14 | namespace CookPopularControl.Controls 15 | { 16 | public class PropertyDatePickerEditor : PropertyItemEditorFactory 17 | { 18 | public override FrameworkElement GetElement(PropertyItem propertyItem) => new DatePicker 19 | { 20 | IsEnabled = !propertyItem.IsReadOnly 21 | }; 22 | 23 | public override DependencyProperty GetDependencyProperty() => DatePicker.SelectedDateProperty; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Editors/PropertyImageEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Data; 5 | using System.Windows.Media; 6 | using System.Windows.Media.Imaging; 7 | 8 | 9 | /* 10 | * Description:PropertyTimerPickerEditor 11 | * Author: Chance(a cook of write code) 12 | * Company: CookCSharp 13 | * Create Time:2022-01-09 14:10:38 14 | * .NET Version: 4.6 15 | * CLR Version: 4.0.30319.42000 16 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 17 | */ 18 | namespace CookPopularControl.Controls 19 | { 20 | public class PropertyImageEditor : PropertyItemEditorFactory 21 | { 22 | public override FrameworkElement GetElement(PropertyItem propertyItem) => new Image 23 | { 24 | IsEnabled = !propertyItem.IsReadOnly, 25 | Width = 60, 26 | Height = 60, 27 | Stretch = Stretch.Uniform, 28 | StretchDirection = StretchDirection.Both, 29 | HorizontalAlignment = HorizontalAlignment.Left 30 | }; 31 | 32 | public override BindingMode GetBindingMode(PropertyItem propertyItem) => BindingMode.OneWay; 33 | 34 | public override DependencyProperty GetDependencyProperty() => Image.SourceProperty; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Editors/PropertyNumberEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | 4 | /* 5 | * Description:PropertyNumberEditor 6 | * Author: Chance(a cook of write code) 7 | * Company: CookCSharp 8 | * Create Time:2022-01-09 14:08:38 9 | * .NET Version: 4.6 10 | * CLR Version: 4.0.30319.42000 11 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 12 | */ 13 | namespace CookPopularControl.Controls 14 | { 15 | public class PropertyNumberEditor : PropertyItemEditorFactory 16 | { 17 | public PropertyNumberEditor() 18 | { 19 | 20 | } 21 | 22 | public PropertyNumberEditor(double minimum, double maximum) 23 | { 24 | Minimum = minimum; 25 | Maximum = maximum; 26 | } 27 | 28 | public double Minimum { get; set; } 29 | 30 | public double Maximum { get; set; } 31 | 32 | public override FrameworkElement GetElement(PropertyItem propertyItem) => new NumericUpDown 33 | { 34 | IsReadOnly = propertyItem.IsReadOnly, 35 | Minimum = Minimum, 36 | Maximum = Maximum 37 | }; 38 | 39 | public override DependencyProperty GetDependencyProperty() => NumericUpDown.ValueProperty; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Editors/PropertyTextEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | 4 | /* 5 | * Description:PropertyTextEditor 6 | * Author: Chance(a cook of write code) 7 | * Company: CookCSharp 8 | * Create Time:2022-01-09 14:06:38 9 | * .NET Version: 4.6 10 | * CLR Version: 4.0.30319.42000 11 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 12 | */ 13 | namespace CookPopularControl.Controls 14 | { 15 | public class PropertyTextEditor : PropertyItemEditorFactory 16 | { 17 | public bool IsReadOnly { get; set; } 18 | 19 | public PropertyTextEditor(bool isReadOnly= false) 20 | { 21 | IsReadOnly = isReadOnly; 22 | } 23 | 24 | public override FrameworkElement GetElement(PropertyItem propertyItem) => new System.Windows.Controls.TextBox 25 | { 26 | IsReadOnly = IsReadOnly 27 | }; 28 | 29 | public override DependencyProperty GetDependencyProperty() => System.Windows.Controls.TextBox.TextProperty; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/Editors/PropertyTimerPickerEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | 4 | /* 5 | * Description:PropertyTimerPickerEditor 6 | * Author: Chance(a cook of write code) 7 | * Company: CookCSharp 8 | * Create Time:2022-01-09 14:02:38 9 | * .NET Version: 4.6 10 | * CLR Version: 4.0.30319.42000 11 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 12 | */ 13 | namespace CookPopularControl.Controls 14 | { 15 | public class PropertyTimerPickerEditor : PropertyItemEditorFactory 16 | { 17 | public override FrameworkElement GetElement(PropertyItem propertyItem) => new TimePicker 18 | { 19 | IsEnabled = !propertyItem.IsReadOnly 20 | }; 21 | 22 | public override DependencyProperty GetDependencyProperty() => TimePicker.CurrentTimeProperty; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/PropertyGrid/PropertyItemsControl.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.Controls; 7 | using System.Windows.Controls.Primitives; 8 | using System.Windows.Input; 9 | 10 | 11 | 12 | /* 13 | * Description:PropertyItemsControl 14 | * Author: Chance(a cook of write code) 15 | * Company: CookCSharp 16 | * Create Time:2022-01-07 14:48:08 17 | * .NET Version: 4.6 18 | * CLR Version: 4.0.30319.42000 19 | * Copyright (c) CookCSharp 2022 All Rights Reserved. 20 | */ 21 | namespace CookPopularControl.Controls 22 | { 23 | public class PropertyItemsControl : ListBox 24 | { 25 | protected override bool IsItemItsOwnContainerOverride(object item) => item is PropertyItem; 26 | 27 | public PropertyItemsControl() 28 | { 29 | ScrollViewer.SetCanContentScroll(this, false); 30 | VirtualizingPanel.SetIsVirtualizingWhenGrouping(this, true); 31 | VirtualizingPanel.SetScrollUnit(this, ScrollUnit.Pixel); 32 | 33 | this.Loaded += PropertyItemsControl_Loaded; 34 | } 35 | 36 | private void PropertyItemsControl_Loaded(object sender, System.Windows.RoutedEventArgs e) 37 | { 38 | if (this.Items.Count > 0) 39 | SelectedIndex = 0; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/ScrollControl/ExtendedScrollViewer.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using System.Windows.Input; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:ExtendedScrollViewer 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-03-26 22:27:17 11 | */ 12 | namespace CookPopularControl.Controls 13 | { 14 | /// 15 | /// 解决滚动条劫持(scroll-wheel-hijack)的问题 16 | /// 17 | public class ExtendedScrollViewer : ScrollViewer 18 | { 19 | protected override void OnMouseWheel(MouseWheelEventArgs e) 20 | { 21 | if (ViewportHeight + VerticalOffset >= ExtentHeight && e.Delta <= 0) 22 | return; 23 | if (VerticalOffset == 0 && e.Delta >= 0) 24 | return; 25 | 26 | base.OnMouseWheel(e); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Swiper/SwiperItem.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:SwiperItem 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-04-25 15:42:21 10 | */ 11 | namespace CookPopularControl.Controls 12 | { 13 | public class SwiperItem : ContentControl 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Thumb/GridViewColumThumb.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Input; 3 | 4 | 5 | 6 | /* 7 | * Copyright (c) 2021 All Rights Reserved. 8 | * Description:GridViewColumThumb 9 | * Author: Chance_写代码的厨子 10 | * Create Time:2021-03-30 10:52:48 11 | */ 12 | namespace CookPopularControl.Controls 13 | { 14 | /// 15 | /// GridViewColumThumb 16 | /// 17 | public class GridViewColumThumb : System.Windows.Controls.Primitives.Thumb 18 | { 19 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) 20 | { 21 | Mouse.OverrideCursor = Cursors.SizeWE; 22 | base.OnMouseLeftButtonDown(e); 23 | } 24 | 25 | protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) 26 | { 27 | base.OnMouseLeftButtonUp(e); 28 | Mouse.OverrideCursor = null; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/ToolBar/ResourceKeyAssistant.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | 4 | 5 | /* 6 | * Copyright (c) 2021 All Rights Reserved. 7 | * Description:ResourceKeyAssistant 8 | * Author: Chance_写代码的厨子 9 | * Create Time:2021-09-28 16:31:21 10 | */ 11 | namespace CookPopularControl.Controls 12 | { 13 | public static class ResourceKeyAssistant 14 | { 15 | public static ResourceKey MenuItemStyleKey { get; } = new ComponentResourceKey(typeof(ResourceKeyAssistant), "MenuItemStyleKey"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CookPopularControl/Controls/Windows/NoneTitleBarWindow.cs: -------------------------------------------------------------------------------- 1 | using CookPopularCSharpToolkit.Windows; 2 | using System.Windows; 3 | using System.Windows.Input; 4 | 5 | 6 | 7 | /* 8 | * Copyright (c) 2021 All Rights Reserved. 9 | * Description:NoneTitleBarWindow 10 | * Author: Chance_写代码的厨子 11 | * Create Time:2021-09-27 16:38:22 12 | */ 13 | namespace CookPopularControl.Windows 14 | { 15 | /// 16 | /// 标识没有标题的窗体 17 | /// 18 | public class NoneTitleBarWindow : NormalWindow 19 | { 20 | public static readonly RoutedCommand MoveWindowCommand = new RoutedCommand(nameof(MoveWindowCommand), typeof(NoneTitleBarWindow)); 21 | 22 | static NoneTitleBarWindow() 23 | { 24 | StyleProperty.OverrideMetadata(typeof(NoneTitleBarWindow), new FrameworkPropertyMetadata(default, (s, e) => ResourceHelper.GetResource 15 | 16 | -------------------------------------------------------------------------------- /CookPopularControl/Themes/CarouselViewStyle.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /CookPopularControl/Themes/DefaultPopularColor.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CookPopularControl/Themes/DialogBoxStyle.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /CookPopularControl/Themes/DragableControlStyle.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /CookPopularControl/Themes/StarredStyle.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /CookPopularControl/Themes/SwitchButtonStyle.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /CookPopularControl/Themes/TabControlStyle.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 16 | 17 | -------------------------------------------------------------------------------- /CookPopularControl/Themes/ThreeDimensionalStyle.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 |