├── .gitignore ├── LICENSE.md ├── README.md └── src └── LayuiPack ├── Core └── Layui.Core │ ├── AppHelper │ ├── DownloadFileInfo.cs │ ├── FileHelper.cs │ └── NetworkHelper.cs │ ├── Base │ └── LayuiViewModelBase.cs │ ├── Language │ ├── ILayLanguage.cs │ └── LayLanguage.cs │ ├── Layui.Core.csproj │ ├── Log │ ├── ILayLogger.cs │ └── LayLogger.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SystemResource.cs │ └── packages.config ├── LayUI.Wpf ├── Controls │ ├── Badge │ │ └── LayBadge.cs │ ├── Button │ │ └── LayButton.cs │ ├── Canvas │ │ └── LaySliderCanvas.cs │ ├── Carousel │ │ ├── LayCarouselItem.cs │ │ └── LayGradientCarousel.cs │ ├── Cascader │ │ ├── Cascader.cs │ │ └── CascaderItem.cs │ ├── CheckBox │ │ └── LayCheckBox.cs │ ├── CodeBox │ │ └── LayCodeBox.cs │ ├── ComboBox │ │ ├── LayComboBox.cs │ │ ├── LayComboBoxItem.cs │ │ ├── LayMultipleComboBox.cs │ │ └── LayMultipleComboBoxItem.cs │ ├── DataGrid │ │ └── LayDataGrid.cs │ ├── DatePicker │ │ ├── LayDatePicker.cs │ │ └── LayDateRangePicker.cs │ ├── DateTimePicker │ │ ├── LayDateTimePicker.cs │ │ └── LayDateTimeRangePicker.cs │ ├── DialogHost │ │ └── LayDialogHost.cs │ ├── DrawerHost │ │ ├── LayDrawerHost.cs │ │ └── LayDrawerItem.cs │ ├── DropDown │ │ └── LayDropDown.cs │ ├── EditText │ │ └── LayEditText.cs │ ├── Expander │ │ ├── LayExpander.cs │ │ ├── LayNavExpander.cs │ │ └── LayNavExpanderPanel.cs │ ├── GroupBox │ │ └── LayGroupBox.cs │ ├── HwndHost │ │ └── LayHwndHost.cs │ ├── ILayControl.cs │ ├── Image │ │ ├── LayGifImage.cs │ │ ├── LayImage.cs │ │ ├── LayImageViewer.cs │ │ ├── LaySVGImage.cs │ │ ├── LayVRImage.cs │ │ └── SVG │ │ │ ├── Animation │ │ │ ├── Animate.cs │ │ │ ├── AnimateColor.cs │ │ │ ├── AnimateMotion.cs │ │ │ ├── AnimateTransform.cs │ │ │ ├── AnimateTransformType.cs │ │ │ └── AnimationBase.cs │ │ │ ├── CSS │ │ │ ├── StyleItem.cs │ │ │ └── StyleParser.cs │ │ │ ├── ClipArtElement.cs │ │ │ ├── FileLoaders │ │ │ ├── FileSystemLoader.cs │ │ │ └── IExternalFileLoader.cs │ │ │ ├── Fill.cs │ │ │ ├── PaintServer │ │ │ ├── CurrentColorPaintServer.cs │ │ │ ├── GradientColorPaintServer.cs │ │ │ ├── InheritPaintServer.cs │ │ │ ├── LinearGradientColorPaintServer.cs │ │ │ ├── PaintServer.cs │ │ │ ├── PaintServerManager.cs │ │ │ ├── PatternPaintServer.cs │ │ │ ├── RadialGradientColorPaintServer.cs │ │ │ └── SolidColorPaintServer.cs │ │ │ ├── SVG.cs │ │ │ ├── SVGFeatures.cs │ │ │ ├── SVGRender.cs │ │ │ ├── SVGTags.cs │ │ │ ├── ShapeUtil.cs │ │ │ ├── Shapes │ │ │ ├── CircleShape.cs │ │ │ ├── Clip.cs │ │ │ ├── EllipseShape.cs │ │ │ ├── Filter │ │ │ │ ├── Filter.cs │ │ │ │ ├── FilterBaseFe.cs │ │ │ │ └── FilterFeGaussianBlur.cs │ │ │ ├── Group.cs │ │ │ ├── ImageShape.cs │ │ │ ├── LineShape.cs │ │ │ ├── PathShape.cs │ │ │ ├── PolygonShape.cs │ │ │ ├── PolylineShape.cs │ │ │ ├── RectangleShape.cs │ │ │ ├── Shape.cs │ │ │ ├── Text.cs │ │ │ └── UseShape.cs │ │ │ ├── Stroke.cs │ │ │ ├── SvgIconBase.cs │ │ │ ├── SvgIconConverterExtension.cs │ │ │ ├── SvgIconExtension.cs │ │ │ ├── TextRender.cs │ │ │ └── TextStyle.cs │ ├── ItemsControl │ │ └── LayFlowItemsControl.cs │ ├── Keyboard │ │ └── LayKeyboard.cs │ ├── Legend │ │ └── LayLegend.cs │ ├── ListBox │ │ ├── LayListBox.cs │ │ └── LayListBoxItem.cs │ ├── Loading │ │ └── LayLoading.cs │ ├── Menu │ │ ├── LayContextMenu.cs │ │ └── LayMenu.cs │ ├── MenuItem │ │ └── LayMenuItem.cs │ ├── Message │ │ ├── LayMessageControl.cs │ │ └── LayMessageHost.cs │ ├── NoticeBar │ │ └── LayNoticeBar.cs │ ├── Notification │ │ ├── LayNotificationControl.cs │ │ └── LayNotificationHost.cs │ ├── NumericUpDown │ │ └── LayNumericUpDown.cs │ ├── Pagination │ │ └── LayPagination.cs │ ├── Panel │ │ ├── LayBorder.cs │ │ ├── LayCard.cs │ │ └── LayWaterfallPanel.cs │ ├── Password │ │ └── LayPasswordBox.cs │ ├── PopupBox │ │ └── LayPopupBox.cs │ ├── ProgressBar │ │ └── LayProgressBar.cs │ ├── PropertyGrid │ │ └── LayPropertyGrid.cs │ ├── RadioButton │ │ └── LayRadioButton.cs │ ├── RichTextBox │ │ └── LayRichTextBox.cs │ ├── Ripple │ │ └── LayRipple.cs │ ├── Skeleton │ │ └── LaySkeleton.cs │ ├── Slider │ │ └── LaySlider.cs │ ├── Switch │ │ └── LaySwitch.cs │ ├── TabControl │ │ └── LayTabControl.cs │ ├── TabItem │ │ └── LayTabItem.cs │ ├── TextBlock │ │ ├── LayDecimalText.cs │ │ └── LayTextBlock.cs │ ├── TextBox │ │ ├── LayAutoCompleteTextBox.cs │ │ ├── LayTagTextBox.cs │ │ ├── LayTagTextBoxPanel.cs │ │ └── LayTextBox.cs │ ├── TextView │ │ └── LayTextView.cs │ ├── TimePicker │ │ └── LayTimePicker.cs │ ├── Timeline │ │ ├── LayTimelineItem.cs │ │ └── LayTimelinePanel.cs │ ├── Timer │ │ └── LayTimer.cs │ ├── ToggleButton │ │ ├── LaySimpleToggleButton.cs │ │ └── LayToggleButton.cs │ ├── ToolTip │ │ └── LayToolTip.cs │ ├── Transitions │ │ └── LayTransition.cs │ ├── TreeView │ │ ├── LayTreeSelect.cs │ │ └── LayTreeView.cs │ ├── TreeViewItem │ │ ├── LayTreeSelectItem.cs │ │ └── LayTreeViewItem.cs │ ├── Upload │ │ └── LayUpload.cs │ ├── VerificationBox │ │ └── LayVerificationBox.cs │ └── Window │ │ ├── IWindowAware.cs │ │ ├── LayTitleBar.cs │ │ └── LayWindow.cs ├── Converters │ ├── Base │ │ ├── CornerRadiusClipConverter.cs │ │ ├── ElementAutoNumberConverter.cs │ │ ├── ElementOffsetConverter.cs │ │ ├── ItemsControlToIndexConverter.cs │ │ ├── MedianConverter.cs │ │ └── SimpleCornerRadiusToClipConverter.cs │ ├── CodeBox │ │ └── CodeBoxLineBreakCharacterToIndexsConverter.cs │ ├── DrawerHost │ │ └── DrawerHostOffsetConverter.cs │ ├── NumericUpDown │ │ └── DecimalToStringFormatConverter.cs │ ├── Switch │ │ └── SwitchWidthConverter.cs │ └── ToolTip │ │ └── ToolTipOffsetConverter.cs ├── Dialog │ └── Interface │ │ └── ILayDialog.cs ├── Enum │ ├── Badge │ │ └── BadgeStyle.cs │ ├── Base │ │ └── LayAnimation.cs │ ├── Button │ │ └── ButtonStyle.cs │ ├── Carousel │ │ └── CarouselArrow.cs │ ├── CheckBox │ │ └── CheckBoxStyle.cs │ ├── Dialog │ │ └── ButtonResult.cs │ ├── DrawerHost │ │ └── DrawerHostStyle.cs │ ├── GroupBox │ │ └── GroupBoxStyle.cs │ ├── Legend │ │ └── LegendStyle.cs │ ├── Loading │ │ └── LoadingStyle.cs │ ├── Message │ │ └── MessageType.cs │ ├── Notification │ │ └── NotificationType.cs │ ├── Ripple │ │ └── RippleStyle.cs │ ├── Skeleton │ │ └── SkeletonStyle.cs │ ├── Slider │ │ └── SliderTipsPosition.cs │ ├── TabControl │ │ └── TabControlStyle.cs │ ├── TextBox │ │ └── InputType.cs │ ├── TooplTip │ │ └── PlacementStyle.cs │ └── Transitions │ │ └── AnimationType.cs ├── Event │ ├── LayFunctionEventArgs.cs │ └── LaySelectionDatesChangedEventArgs.cs ├── Extend │ ├── Animation │ │ └── LayAnimationsHelper.cs │ ├── Base │ │ ├── LayBindingProperty.cs │ │ └── LayControlsBaseHelper.cs │ ├── DataGrid │ │ └── LayDataGridHelper.cs │ ├── DatePicker │ │ └── LayDatePickerHelper.cs │ ├── Image │ │ └── LayImageHelper.cs │ ├── ItemsControl │ │ └── LayItemsControlHelper.cs │ └── TextBox │ │ └── LayTextBoxHelper.cs ├── Fonts │ ├── fontawesome-webfont.ttf │ └── iconfont.ttf ├── Global │ ├── Dialog │ │ ├── Interface │ │ │ ├── ILayDialogAware.cs │ │ │ ├── ILayDialogParameter.cs │ │ │ ├── ILayDialogResult.cs │ │ │ ├── ILayDialogUserControlWindow.cs │ │ │ ├── ILayDialogUserControlWindowExtensions.cs │ │ │ ├── ILayDialogWindow.cs │ │ │ ├── ILayDialogWindowAware.cs │ │ │ └── ILayDialogWindowExtensions.cs │ │ ├── LayDialog.cs │ │ ├── LayDialogParameter.cs │ │ ├── LayDialogResult.cs │ │ ├── LayDialogUserControlWindow.cs │ │ └── LayParametersExtensions.cs │ ├── Message │ │ └── LayMessage.cs │ └── Notification │ │ └── LayNotification.cs ├── LayUI.Wpf.csproj ├── Mvvm │ ├── LayBindableBase.cs │ └── LayDelegateCommand.cs ├── Style │ └── Default │ │ ├── BadgeStyle.xaml │ │ ├── ButtonStyle.xaml │ │ ├── CardStyle.xaml │ │ ├── CarouselItemStyle.xaml │ │ ├── CarouselStyle.xaml │ │ ├── CascaderItemStyle.xaml │ │ ├── CascaderStyle.xaml │ │ ├── CheckBoxStyle.xaml │ │ ├── CheckCardStyle.xaml │ │ ├── CodeBoxStyle.xaml │ │ ├── ColorStyle.xaml │ │ ├── ComboBoxItemStyle.xaml │ │ ├── ComboBoxStyle.xaml │ │ ├── ContextMenuStyle.xaml │ │ ├── ControlBaseStyle.xaml │ │ ├── DataGridStyle.xaml │ │ ├── DatePickerStyle.xaml │ │ ├── DateRangePickerStyle.xaml │ │ ├── DateTimePickerStyle.xaml │ │ ├── DateTimeRangePickerStyle.xaml │ │ ├── DecimalTextStyle.xaml │ │ ├── DialogStyle.xaml │ │ ├── DrawerHostStyle.xaml │ │ ├── DrawerItemStyle.xaml │ │ ├── EditTextStyle.xaml │ │ ├── ExpanderStyle.xaml │ │ ├── FontsStyle.xaml │ │ ├── Geometries.xaml │ │ ├── GifImageStyle.xaml │ │ ├── GroupBoxStyle.xaml │ │ ├── ImageStyle.xaml │ │ ├── ItemsControlStyle.xaml │ │ ├── KeyboardStyle.xaml │ │ ├── LegendStyle.xaml │ │ ├── ListBoxStyle.xaml │ │ ├── LoadingStyle.xaml │ │ ├── MenuItemStyle.xaml │ │ ├── MenuStyle.xaml │ │ ├── MessageStyle.xaml │ │ ├── MultipleComboBoxItemStyle.xaml │ │ ├── MultipleComboBoxStyle.xaml │ │ ├── NoticeBarStyle.xaml │ │ ├── NotificationHostStyle.xaml │ │ ├── NumericUpDownStyle.xaml │ │ ├── PaginationStyle.xaml │ │ ├── PanelStyle.xaml │ │ ├── PasswordBoxStyle.xaml │ │ ├── PopupBoxStyle.xaml │ │ ├── ProgressBarStyle.xaml │ │ ├── PropertyGridStyle.xaml │ │ ├── RadioButtonStyle.xaml │ │ ├── RichTextBoxStyle.xaml │ │ ├── RippleStyle.xaml │ │ ├── ScaleImageStyle.xaml │ │ ├── ScrollViewer.xaml │ │ ├── SkeletonStyle.xaml │ │ ├── SliderStyle.xaml │ │ ├── SvgImageStyle.xaml │ │ ├── SwitchStyle.xaml │ │ ├── TabControlStyle.xaml │ │ ├── TabItemStyle.xaml │ │ ├── TagTextBoxStyle.xaml │ │ ├── TextBoxStyle.xaml │ │ ├── TimePickerStyle.xaml │ │ ├── TimelineItemStyle.xaml │ │ ├── TimelineStyle.xaml │ │ ├── TimerStyle.xaml │ │ ├── TitleBarStyle.xaml │ │ ├── ToggleButtonStyle.xaml │ │ ├── ToolTipStyle.xaml │ │ ├── TransitionControlStyle.xaml │ │ ├── TreeSelectStyle.xaml │ │ ├── TreeViewItemStyle.xaml │ │ ├── TreeViewStyle.xaml │ │ ├── VRImageStyle.xaml │ │ ├── VerificationBoxStyle.xaml │ │ └── WindowStyle.xaml ├── Themes │ └── Default.xaml └── Tools │ ├── LayAnimationHelper.cs │ ├── LayBindingHelper.cs │ ├── LayFontsHelper.cs │ ├── LayGeometryHelper.cs │ ├── LayKeyboardKeyHelper.cs │ ├── LayResourceHelper.cs │ ├── LayUIElementHelper.cs │ ├── LayVisualTreeHelper.cs │ ├── LayWebBrowserHelper.cs │ └── System │ ├── DoubleUtil.cs │ └── Radii.cs ├── LayuiApp ├── App.xaml ├── App.xaml.cs ├── Images │ └── Svg │ │ ├── cn.svg │ │ └── um.svg ├── Languaes │ ├── en_US.xaml │ └── zh_CN.xaml ├── LayUI.jpg ├── Layui.png ├── LayuiApp.csproj ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── R-C.jpg ├── ViewModels │ └── MainWindowViewModel.cs ├── Views │ ├── DialogWindowBase.xaml │ ├── DialogWindowBase.xaml.cs │ ├── MainWindow.xaml │ └── MainWindow.xaml.cs └── app.config ├── LayuiAutoUpdateTool ├── App.xaml ├── App.xaml.cs ├── LayuiAutoUpdateTool.csproj ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ViewModels │ └── MainWindowViewModel.cs ├── Views │ ├── MainWindow.xaml │ └── MainWindow.xaml.cs ├── app.config └── 微软雅黑.ttf ├── LayuiPack.sln ├── Models ├── LayuiComponentExample │ ├── Images │ │ ├── 1.jpeg │ │ └── 2.jpg │ ├── LayuiComponentExample.csproj │ ├── LayuiComponentExampleModule.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ViewModels │ │ ├── AnimationCommandViewModel.cs │ │ ├── BadgeViewModel.cs │ │ ├── CarouselViewModel.cs │ │ ├── CascaderViewModel.cs │ │ ├── CodeBoxViewModel.cs │ │ ├── DataGridViewModel.cs │ │ ├── DateTimeViewModel.cs │ │ ├── DecimalTextViewModel.cs │ │ ├── DefaultDialogViewModel.cs │ │ ├── DialogAlertViewModel.cs │ │ ├── DialogMessageViewModel.cs │ │ ├── DialogViewModel.cs │ │ ├── DrawerViewModel.cs │ │ ├── FlowItemsControlViewModel.cs │ │ ├── IconViewModel.cs │ │ ├── LayDialogWindowTookenViewModel.cs │ │ ├── MessageViewModel.cs │ │ ├── NoticeBarViewModel.cs │ │ ├── NotificationViewModel.cs │ │ ├── PaginationViewModel.cs │ │ ├── PopupBoxViewModel.cs │ │ ├── PropertyGridViewModel.cs │ │ ├── RippleViewModel.cs │ │ ├── SliderViewModel.cs │ │ ├── TagViewModel.cs │ │ ├── ToolTipViewModel.cs │ │ ├── TreeSelectViewModel.cs │ │ ├── UploadViewModel.cs │ │ ├── VRViewModel.cs │ │ └── WaterfallPanelViewModel.cs │ └── Views │ │ ├── AnimationCommand.xaml │ │ ├── AnimationCommand.xaml.cs │ │ ├── Badge.xaml │ │ ├── Badge.xaml.cs │ │ ├── Carousel.xaml │ │ ├── Carousel.xaml.cs │ │ ├── Cascader.xaml │ │ ├── Cascader.xaml.cs │ │ ├── CodeBox.xaml │ │ ├── CodeBox.xaml.cs │ │ ├── DataGrid.xaml │ │ ├── DataGrid.xaml.cs │ │ ├── DateTime.xaml │ │ ├── DateTime.xaml.cs │ │ ├── DecimalText.xaml │ │ ├── DecimalText.xaml.cs │ │ ├── DefaultDialog.xaml │ │ ├── DefaultDialog.xaml.cs │ │ ├── Dialog.xaml │ │ ├── Dialog.xaml.cs │ │ ├── DialogAlert.xaml │ │ ├── DialogAlert.xaml.cs │ │ ├── DialogMessageView.xaml │ │ ├── DialogMessageView.xaml.cs │ │ ├── Drawer.xaml │ │ ├── Drawer.xaml.cs │ │ ├── FlowItemsControl.xaml │ │ ├── FlowItemsControl.xaml.cs │ │ ├── Icon.xaml │ │ ├── Icon.xaml.cs │ │ ├── Message.xaml │ │ ├── Message.xaml.cs │ │ ├── NoticeBar.xaml │ │ ├── NoticeBar.xaml.cs │ │ ├── NotificationView.xaml │ │ ├── NotificationView.xaml.cs │ │ ├── Pagination.xaml │ │ ├── Pagination.xaml.cs │ │ ├── PopupBox.xaml │ │ ├── PopupBox.xaml.cs │ │ ├── PropertyGrid.xaml │ │ ├── PropertyGrid.xaml.cs │ │ ├── Ripple.xaml │ │ ├── Ripple.xaml.cs │ │ ├── Slider.xaml │ │ ├── Slider.xaml.cs │ │ ├── Tag.xaml │ │ ├── Tag.xaml.cs │ │ ├── TestDialogView.xaml │ │ ├── TestDialogView.xaml.cs │ │ ├── ToolTip.xaml │ │ ├── ToolTip.xaml.cs │ │ ├── TreeSelect.xaml │ │ ├── TreeSelect.xaml.cs │ │ ├── Upload.xaml │ │ ├── Upload.xaml.cs │ │ ├── VR.xaml │ │ ├── VR.xaml.cs │ │ ├── WaterfallPanel.xaml │ │ └── WaterfallPanel.xaml.cs ├── LayuiFundamentalElement │ ├── Images │ │ ├── GIF │ │ │ └── v2-30156325f3b931600dc40e119d6a12cc_b.gif │ │ └── SVG │ │ │ └── 购物车空空如也.svg │ ├── LayuiFundamentalElement.csproj │ ├── LayuiFundamentalElementModule.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ViewModels │ │ ├── AuxiliaryElementViewModel.cs │ │ ├── ButtonViewModel.cs │ │ ├── ExpanderViewModel.cs │ │ ├── FormViewModel.cs │ │ ├── ImageViewModel.cs │ │ ├── KeyboardViewModel.cs │ │ ├── LoadingViewModel.cs │ │ ├── MenuViewModel.cs │ │ ├── PanelViewModel.cs │ │ ├── ProgressBarViewModel.cs │ │ ├── ScaleImageViewModel.cs │ │ ├── SkeletonViewModel.cs │ │ ├── TabControlViewModel.cs │ │ ├── TimelineViewModel.cs │ │ ├── TransitionControlViewModel.cs │ │ ├── TreeViewModel.cs │ │ └── VerificationBoxViewModel.cs │ └── Views │ │ ├── AuxiliaryElement.xaml │ │ ├── AuxiliaryElement.xaml.cs │ │ ├── Button.xaml │ │ ├── Button.xaml.cs │ │ ├── Expander.xaml │ │ ├── Expander.xaml.cs │ │ ├── Form.xaml │ │ ├── Form.xaml.cs │ │ ├── GIFImage.xaml │ │ ├── GIFImage.xaml.cs │ │ ├── Keyboard.xaml │ │ ├── Keyboard.xaml.cs │ │ ├── Loading.xaml │ │ ├── Loading.xaml.cs │ │ ├── Menu.xaml │ │ ├── Menu.xaml.cs │ │ ├── Panel.xaml │ │ ├── Panel.xaml.cs │ │ ├── ProgressBar.xaml │ │ ├── ProgressBar.xaml.cs │ │ ├── ScaleImage.xaml │ │ ├── ScaleImage.xaml.cs │ │ ├── Skeleton.xaml │ │ ├── Skeleton.xaml.cs │ │ ├── TabControl.xaml │ │ ├── TabControl.xaml.cs │ │ ├── Timeline.xaml │ │ ├── Timeline.xaml.cs │ │ ├── TransitionControl.xaml │ │ ├── TransitionControl.xaml.cs │ │ ├── TreeView.xaml │ │ ├── TreeView.xaml.cs │ │ ├── VerificationBox.xaml │ │ └── VerificationBox.xaml.cs └── LayuiHome │ ├── LayuiHome.csproj │ ├── LayuiHomeModule.cs │ ├── Models │ └── MenuItemModel.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── Selector │ └── MenuItemDataTemplateSelector.cs │ ├── ViewModels │ ├── HomeViewModel.cs │ └── TestViewModel.cs │ └── Views │ ├── Home.xaml │ └── Home.xaml.cs └── Utils └── Layui.Wpf.Utils ├── Layui.Wpf.Utils.csproj ├── Properties └── AssemblyInfo.cs ├── Thread └── LayuiDispatcher.cs └── packages.config /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Coolkeke 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/LayuiPack/Core/Layui.Core/AppHelper/DownloadFileInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Layui.Core.AppHelper 8 | { 9 | /// 10 | /// 文件下载详情 11 | /// 创建者:YWK 12 | /// 创建时间:2022-05-10 下午 3:20:12 13 | /// 14 | public class DownloadFileInfo 15 | { 16 | /// 17 | /// 请求地址 18 | /// 19 | public string RequestUriString { get; set; } 20 | /// 21 | /// 保存地址(全路径,包括文件后缀名) 22 | /// 23 | public string SaveFileUriString { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/LayuiPack/Core/Layui.Core/Language/ILayLanguage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace Layui.Core 9 | { 10 | public interface ILayLanguage 11 | { 12 | /// 13 | /// 查找当前字典中翻译文字 14 | /// 15 | /// 16 | /// 17 | object GetValue(string key); 18 | /// 19 | /// 根据Key在当前程序中查找翻译文件 20 | /// 21 | /// 22 | void LoadResourceKey(string key); 23 | /// 24 | /// 根据路径加载翻译文件 25 | /// 26 | /// 27 | void LoadPath(string path); 28 | /// 29 | /// 加载翻译文件 30 | /// 31 | /// 32 | void LoadDictionary(ResourceDictionary languageDictionary); 33 | /// 34 | /// 刷新视图翻译效果 35 | /// 36 | void Refresh(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/LayuiPack/Core/Layui.Core/Language/LayLanguage.cs: -------------------------------------------------------------------------------- 1 | using LayUI.Wpf.Extensions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace Layui.Core 10 | { 11 | public class LayLanguage : ILayLanguage 12 | { 13 | 14 | public object GetValue(string key) => LanguageExtension.GetValue(key); 15 | 16 | public void LoadDictionary(ResourceDictionary languageDictionary)=> LanguageExtension.LoadDictionary(languageDictionary); 17 | 18 | public void LoadPath(string path)=> LanguageExtension.LoadPath(path); 19 | 20 | public void LoadResourceKey(string key)=> LanguageExtension.LoadResourceKey(key); 21 | 22 | public void Refresh()=>LanguageExtension.Refresh(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/LayuiPack/Core/Layui.Core/Log/ILayLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Layui.Core.Log 8 | { 9 | /// 10 | /// ILayLogger 11 | /// 创建者:YWK 12 | /// 创建时间:2022-08-17 下午 3:51:01 13 | /// 14 | public interface ILayLogger 15 | { 16 | /// 17 | /// 详情 18 | /// 19 | /// 20 | void Info(string message); 21 | /// 22 | /// 异常日志 23 | /// 24 | /// 25 | void Error(Exception exception); 26 | /// 27 | /// 警告 28 | /// 29 | /// 30 | void Warn(string message); 31 | /// 32 | /// Debug 33 | /// 34 | /// 35 | void Debug(string message); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/LayuiPack/Core/Layui.Core/Log/LayLogger.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using log4net.Core; 3 | using log4net.Repository; 4 | using Prism.Logging; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Reflection; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace Layui.Core.Log 13 | { 14 | /// 15 | /// 日志 16 | /// 创建者:YWK 17 | /// 创建时间:2022-08-17 下午 3:44:16 18 | /// 19 | public class LayLogger : ILayLogger 20 | { 21 | public void Debug(string message) 22 | { 23 | LogManager.GetLogger($"==>").Debug(message); 24 | } 25 | 26 | public void Error(Exception exception) 27 | { 28 | LogManager.GetLogger($"==>").Error(exception); 29 | } 30 | 31 | public void Info(string message) 32 | { 33 | LogManager.GetLogger($"==>").Info(message); 34 | } 35 | 36 | public void Warn(string message) 37 | { 38 | LogManager.GetLogger($"==>").Warn(message); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/LayuiPack/Core/Layui.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Layui.Core")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Layui.Core")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("b867ed96-1955-45c5-9381-a21dbae85529")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/LayuiPack/Core/Layui.Core/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Carousel/LayCarouselItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Collections.Specialized; 6 | using System.ComponentModel; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows; 11 | using System.Windows.Controls; 12 | using System.Windows.Markup; 13 | 14 | namespace LayUI.Wpf.Controls 15 | { 16 | /// 17 | /// LayCarouselItem 18 | /// 创建者:YWK 19 | /// 创建时间:2022-06-07 下午 4:12:39 20 | /// 21 | public class LayCarouselItem : System.Windows.Controls.ListBoxItem 22 | { 23 | 24 | public override void OnApplyTemplate() 25 | { 26 | base.OnApplyTemplate(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/ComboBox/LayComboBoxItem.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 | namespace LayUI.Wpf.Controls 9 | { 10 | /// 11 | /// LayComboBoxItem 12 | /// 创建者:YWK 13 | /// 创建时间:2022-06-20 上午 9:19:59 14 | /// 15 | public class LayComboBoxItem: ComboBoxItem 16 | { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/ComboBox/LayMultipleComboBoxItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Controls.Primitives; 10 | 11 | namespace LayUI.Wpf.Controls 12 | { 13 | public class LayMultipleComboBoxItem:ListViewItem, ILayControl 14 | { 15 | /// 16 | /// 圆角 17 | /// 18 | [Bindable(true)] 19 | public CornerRadius CornerRadius 20 | { 21 | get { return (CornerRadius)GetValue(CornerRadiusProperty); } 22 | set { SetValue(CornerRadiusProperty, value); } 23 | } 24 | 25 | // Using a DependencyProperty as the backing store for CornerRadius. This enables animation, styling, binding, etc... 26 | public static readonly DependencyProperty CornerRadiusProperty = 27 | DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(LayMultipleComboBoxItem)); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/DropDown/LayDropDown.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 | namespace LayUI.Wpf.Controls 9 | { 10 | /// 11 | /// LayDropDown 12 | /// 创建者:YWK 13 | /// 创建时间:2022-05-05 下午 4:38:24 14 | /// 15 | public class LayDropDown:ContentControl 16 | { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Expander/LayNavExpanderPanel.cs: -------------------------------------------------------------------------------- 1 | using LayUI.Wpf.Tools; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Media; 11 | 12 | namespace LayUI.Wpf.Controls 13 | { 14 | /// 15 | /// LayExpanderPanel 16 | /// 创建者:YWK 17 | /// 创建时间:2022-04-19 下午 5:56:27 18 | /// 19 | public class LayNavExpanderPanel : StackPanel 20 | { 21 | 22 | [Bindable(true)] 23 | public bool IsAutoFold 24 | { 25 | get { return (bool)GetValue(IsAutoFoldProperty); } 26 | set { SetValue(IsAutoFoldProperty, value); } 27 | } 28 | 29 | // Using a DependencyProperty as the backing store for IsAutoFold. This enables animation, styling, binding, etc... 30 | public static readonly DependencyProperty IsAutoFoldProperty = 31 | DependencyProperty.Register("IsAutoFold", typeof(bool), typeof(LayNavExpanderPanel), new PropertyMetadata(false)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/GroupBox/LayGroupBox.cs: -------------------------------------------------------------------------------- 1 | using LayUI.Wpf.Enum; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | 11 | namespace LayUI.Wpf.Controls 12 | { 13 | public class LayGroupBox: GroupBox 14 | { 15 | /// 16 | /// 类型 17 | /// 18 | [Bindable(true)] 19 | public GroupBoxStyle Type 20 | { 21 | get { return (GroupBoxStyle)GetValue(TypeProperty); } 22 | set { SetValue(TypeProperty, value); } 23 | } 24 | 25 | // Using a DependencyProperty as the backing store for Type. This enables animation, styling, binding, etc... 26 | public static readonly DependencyProperty TypeProperty = 27 | DependencyProperty.Register("Type", typeof(GroupBoxStyle), typeof(LayGroupBox)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/HwndHost/LayHwndHost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Interop; 10 | 11 | namespace LayUI.Wpf.Controls.HwndHost 12 | { 13 | public class LayHwndHost : Control 14 | { 15 | private Window _window = new Window(); 16 | public LayHwndHost() 17 | { 18 | IntPtr hwnd = new WindowInteropHelper(_window).Handle; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/ILayControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace LayUI.Wpf.Controls 9 | { 10 | /// 11 | /// 控件通用属性 12 | /// 13 | internal interface ILayControl 14 | { 15 | /// 16 | /// 圆角 17 | /// 18 | CornerRadius CornerRadius { get; set ; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Animation/Animate.cs: -------------------------------------------------------------------------------- 1 | using System.Xml; 2 | using LayUI.Wpf.Controls.SVG; 3 | using LayUI.Wpf.Controls.SVG.Shapes; 4 | 5 | namespace LayUI.Wpf.Controls.SVG.Animation 6 | { 7 | public class Animate : AnimationBase 8 | { 9 | public string AttributeName { get; set; } 10 | 11 | public string From { get; set; } 12 | 13 | public string To { get; set; } 14 | 15 | public string RepeatType { get; set; } 16 | 17 | public string Values { get; set; } 18 | 19 | public string hRef { get; set; } 20 | 21 | public Animate(global::LayUI.Wpf.Controls.SVG.SVG svg, XmlNode node, Shape parent) 22 | : base(svg, node, parent) 23 | { 24 | this.From = XmlUtil.AttrValue(node, "from", null); 25 | this.To = XmlUtil.AttrValue(node, "to", null); 26 | this.AttributeName = XmlUtil.AttrValue(node, "attributeName", null); 27 | this.RepeatType = XmlUtil.AttrValue(node, "repeatCount", "indefinite"); 28 | this.Values = XmlUtil.AttrValue(node, "values", null); 29 | 30 | this.hRef = XmlUtil.AttrValue(node, "xlink:href", string.Empty); 31 | if (this.hRef.StartsWith("#")) this.hRef = this.hRef.Substring(1); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Animation/AnimateColor.cs: -------------------------------------------------------------------------------- 1 | using System.Xml; 2 | using LayUI.Wpf.Controls.SVG.Shapes; 3 | 4 | namespace LayUI.Wpf.Controls.SVG.Animation 5 | { 6 | public class AnimateColor : AnimationBase 7 | { 8 | public AnimateColor(global::LayUI.Wpf.Controls.SVG.SVG svg, XmlNode node, Shape parent) 9 | : base(svg, node, parent) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Animation/AnimateMotion.cs: -------------------------------------------------------------------------------- 1 | using System.Xml; 2 | using LayUI.Wpf.Controls.SVG.Shapes; 3 | 4 | namespace LayUI.Wpf.Controls.SVG.Animation 5 | { 6 | public class AnimateMotion : AnimationBase 7 | { 8 | public AnimateMotion(global::LayUI.Wpf.Controls.SVG.SVG svg, XmlNode node, Shape parent) 9 | : base(svg, node, parent) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Animation/AnimateTransform.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | using LayUI.Wpf.Controls.SVG; 4 | using LayUI.Wpf.Controls.SVG.Shapes; 5 | 6 | namespace LayUI.Wpf.Controls.SVG.Animation 7 | { 8 | public class AnimateTransform : AnimationBase 9 | { 10 | public string AttributeName { get; set; } 11 | 12 | public AnimateTransformType Type { get; set; } 13 | 14 | public string From { get; set; } 15 | 16 | public string To { get; set; } 17 | 18 | public string Values { get; set; } 19 | 20 | public string RepeatType { get; set; } 21 | 22 | public AnimateTransform(global::LayUI.Wpf.Controls.SVG.SVG svg, XmlNode node, Shape parent) 23 | : base(svg, node, parent) 24 | { 25 | this.Type = (AnimateTransformType)System.Enum.Parse(typeof(AnimateTransformType), XmlUtil.AttrValue(node, "type", "translate"), true); 26 | this.From = XmlUtil.AttrValue(node, "from", null); 27 | this.To = XmlUtil.AttrValue(node, "to", null); 28 | this.AttributeName = XmlUtil.AttrValue(node, "attributeName", null); 29 | this.RepeatType = XmlUtil.AttrValue(node, "repeatCount", "indefinite"); 30 | this.Values = XmlUtil.AttrValue(node, "values", null); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Animation/AnimateTransformType.cs: -------------------------------------------------------------------------------- 1 | namespace LayUI.Wpf.Controls.SVG.Animation 2 | { 3 | public enum AnimateTransformType 4 | { 5 | Translate, 6 | Scale, 7 | Rotate, 8 | SkewX, 9 | SkewY 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Animation/AnimationBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | using LayUI.Wpf.Controls.SVG; 4 | using LayUI.Wpf.Controls.SVG.Shapes; 5 | 6 | namespace LayUI.Wpf.Controls.SVG.Animation 7 | { 8 | public class AnimationBase : Shape 9 | { 10 | //https://www.mediaevent.de/tutorial/svg-animate-attribute.html 11 | public TimeSpan Duration { get; set; } 12 | 13 | public AnimationBase(global::LayUI.Wpf.Controls.SVG.SVG svg, XmlNode node, Shape parent) 14 | : base(svg, node, parent) 15 | { 16 | var d = XmlUtil.AttrValue(node, "dur", ""); 17 | if (d.EndsWith("ms")) 18 | Duration = TimeSpan.FromMilliseconds(double.Parse(d.Substring(0, d.Length - 2))); 19 | else if (d.EndsWith("s")) 20 | Duration = TimeSpan.FromSeconds(double.Parse(d.Substring(0, d.Length - 1))); 21 | else 22 | Duration = TimeSpan.FromSeconds(double.Parse(d)); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/CSS/StyleItem.cs: -------------------------------------------------------------------------------- 1 | namespace LayUI.Wpf.Controls.SVG 2 | { 3 | public partial class XmlUtil 4 | { 5 | public class StyleItem 6 | { 7 | public string Name { get; set; } 8 | 9 | public string Value { get; set; } 10 | 11 | public StyleItem(string name, string value) 12 | { 13 | this.Name = name; 14 | this.Value = value; 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/CSS/StyleParser.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace LayUI.Wpf.Controls.SVG 5 | { 6 | public static class StyleParser 7 | { 8 | private static Regex _regexStyle = 9 | new Regex("([\\.,<>a-zA-Z0-9: \\-#]*){([^}]*)}", RegexOptions.Compiled | RegexOptions.Singleline); 10 | 11 | public static void ParseStyle(SVG svg, string style) 12 | { 13 | var svgStyles = svg.Styles; 14 | 15 | var match = _regexStyle.Match(style); 16 | while (match.Success) 17 | { 18 | var name = match.Groups[1].Value.Trim(); 19 | var value = match.Groups[2].Value.Trim(); 20 | foreach (var nm in name.Split(',')) 21 | { 22 | if (!svgStyles.ContainsKey(nm)) 23 | { 24 | svgStyles.Add(nm, new List()); 25 | } 26 | foreach (ShapeUtil.Attribute styleitem in XmlUtil.SplitStyle(svg, value)) 27 | { 28 | svgStyles[nm].Add(new XmlUtil.StyleItem(styleitem.Name, styleitem.Value)); 29 | } 30 | } 31 | 32 | match = match.NextMatch(); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/ClipArtElement.cs: -------------------------------------------------------------------------------- 1 | using System.Xml; 2 | 3 | namespace LayUI.Wpf.Controls.SVG 4 | { 5 | public class ClipArtElement 6 | { 7 | public string Id { get; protected set; } 8 | 9 | public ClipArtElement(XmlNode node) 10 | { 11 | if (node == null) 12 | this.Id = ""; 13 | else 14 | this.Id = XmlUtil.AttrValue(node, "id"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/FileLoaders/FileSystemLoader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Diagnostics; 4 | 5 | namespace LayUI.Wpf.Controls.SVG.FileLoaders 6 | { 7 | public class FileSystemLoader : IExternalFileLoader 8 | { 9 | static FileSystemLoader() 10 | { 11 | Instance = new FileSystemLoader(); 12 | } 13 | 14 | public static FileSystemLoader Instance { get; } 15 | 16 | public Stream LoadFile(string hRef, string svgFilename) 17 | { 18 | var path = Environment.CurrentDirectory; 19 | if (!string.IsNullOrEmpty(svgFilename)) 20 | { 21 | path = Path.GetDirectoryName(svgFilename); 22 | } 23 | string filename = Path.Combine(path, hRef); 24 | if (File.Exists(filename)) 25 | return File.OpenRead(filename); 26 | 27 | // For the issue #43 : Environment.CurrentDirectory prevents msix packaging 28 | path = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); 29 | filename = Path.Combine(path, hRef); 30 | if (File.Exists(filename)) 31 | return File.OpenRead(filename); 32 | 33 | Trace.TraceWarning("Unresolved URI: " + hRef); 34 | 35 | return null; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/FileLoaders/IExternalFileLoader.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace LayUI.Wpf.Controls.SVG.FileLoaders 4 | { 5 | public interface IExternalFileLoader 6 | { 7 | Stream LoadFile(string hRef, string svgFilename); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/PaintServer/CurrentColorPaintServer.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace LayUI.Wpf.Controls.SVG.PaintServer 5 | { 6 | public class CurrentColorPaintServer : PaintServer 7 | { 8 | public CurrentColorPaintServer(PaintServerManager owner) 9 | : base(owner) 10 | { 11 | } 12 | 13 | public override Brush GetBrush(double opacity, SVG svg, SVGRender svgRender, Rect bounds) 14 | { 15 | return null; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/PaintServer/InheritPaintServer.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace LayUI.Wpf.Controls.SVG.PaintServer 5 | { 6 | public class InheritPaintServer : PaintServer 7 | { 8 | public InheritPaintServer(PaintServerManager owner) 9 | : base(owner) 10 | { 11 | } 12 | 13 | public override Brush GetBrush(double opacity, SVG svg, SVGRender svgRender, Rect bounds) 14 | { 15 | return null; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/PaintServer/PaintServer.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace LayUI.Wpf.Controls.SVG.PaintServer 5 | { 6 | // http://www.w3.org/TR/SVGTiny12/painting.html#PaintServers 7 | public class PaintServer 8 | { 9 | public PaintServerManager Owner { get; private set; } 10 | 11 | protected Brush Brush = null; 12 | 13 | public PaintServer(PaintServerManager owner) 14 | { 15 | this.Owner = owner; 16 | } 17 | 18 | public PaintServer(PaintServerManager owner, Brush newBrush) 19 | { 20 | this.Owner = owner; 21 | this.Brush = newBrush; 22 | } 23 | 24 | public virtual Brush GetBrush(double opacity, SVG svg, SVGRender svgRender, Rect bounds) 25 | { 26 | return Brush; 27 | } 28 | 29 | public Brush GetBrush() 30 | { 31 | return Brush; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/PaintServer/SolidColorPaintServer.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace LayUI.Wpf.Controls.SVG.PaintServer 5 | { 6 | public class SolidColorPaintServer : PaintServer 7 | { 8 | public Color Color { get; set; } 9 | 10 | public SolidColorPaintServer(PaintServerManager owner, Color c) 11 | : base(owner) 12 | { 13 | this.Color = c; 14 | } 15 | 16 | public SolidColorPaintServer(PaintServerManager owner, Brush newBrush) : base(owner) 17 | { 18 | Brush = newBrush; 19 | } 20 | 21 | public override Brush GetBrush(double opacity, SVG svg, SVGRender svgRender, Rect bounds) 22 | { 23 | if (Brush != null) return Brush; 24 | byte a = (byte)(255 * opacity / 100); 25 | Color c = this.Color; 26 | Color newcol = Color.FromArgb(a, c.R, c.G, c.B); 27 | Brush = new SolidColorBrush(newcol); 28 | return Brush; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/CircleShape.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | 4 | namespace LayUI.Wpf.Controls.SVG.Shapes 5 | { 6 | public class CircleShape : Shape 7 | { 8 | public double CX { get; set; } 9 | 10 | public double CY { get; set; } 11 | 12 | public double R { get; set; } 13 | 14 | public CircleShape(SVG svg, XmlNode node) : base(svg, node) 15 | { 16 | this.CX = XmlUtil.AttrValue(node, "cx", 0, svg.ViewBox.HasValue ? svg.ViewBox.Value.Width : svg.Size.Width); 17 | this.CY = XmlUtil.AttrValue(node, "cy", 0, svg.ViewBox.HasValue ? svg.ViewBox.Value.Height : svg.Size.Height); 18 | var diagRef = Math.Sqrt(svg.Size.Width * svg.Size.Width + svg.Size.Height * svg.Size.Height) / Math.Sqrt(2); // see https://oreillymedia.github.io/Using_SVG/extras/ch05-percentages.html 19 | if (svg.ViewBox.HasValue) 20 | diagRef = Math.Sqrt(svg.ViewBox.Value.Width * svg.ViewBox.Value.Width + svg.ViewBox.Value.Height * svg.ViewBox.Value.Height) / Math.Sqrt(2); 21 | this.R = XmlUtil.AttrValue(node, "r", 0, diagRef); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/Clip.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | using System.Xml; 4 | 5 | namespace LayUI.Wpf.Controls.SVG.Shapes 6 | { 7 | public class Clip : Group 8 | { 9 | public Clip(SVG svg, XmlNode node, Shape parent) 10 | : base(svg, node, parent) 11 | { 12 | } 13 | 14 | private Geometry clpGeo = null; 15 | 16 | public Geometry ClipGeometry 17 | { 18 | get 19 | { 20 | if (clpGeo != null) return clpGeo; 21 | 22 | var retVal = this.getGeoForShape(this.Elements[0]); 23 | 24 | if (this.Elements.Count > 1) 25 | foreach (var element in this.Elements) 26 | { 27 | retVal = new CombinedGeometry(retVal, this.getGeoForShape(element)); 28 | } 29 | 30 | clpGeo = retVal; 31 | return clpGeo; 32 | } 33 | } 34 | 35 | private Geometry getGeoForShape(Shape shp) 36 | { 37 | if (shp is RectangleShape) 38 | { 39 | var r = shp as RectangleShape; 40 | var g = new RectangleGeometry(new Rect(r.RX, r.RY, r.Width, r.Height)); 41 | r.geometryElement = g; 42 | return g; 43 | } 44 | if (shp is CircleShape) 45 | { 46 | var c = shp as CircleShape; 47 | var g = new EllipseGeometry(new Point(c.CX, c.CY), c.R, c.R); 48 | c.geometryElement = g; 49 | return g; 50 | } 51 | return null; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/EllipseShape.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | 4 | namespace LayUI.Wpf.Controls.SVG.Shapes 5 | { 6 | public class EllipseShape : Shape 7 | { 8 | public double CX { get; set; } 9 | 10 | public double CY { get; set; } 11 | 12 | public double RX { get; set; } 13 | 14 | public double RY { get; set; } 15 | 16 | public EllipseShape(SVG svg, XmlNode node) 17 | : base(svg, node) 18 | { 19 | this.CX = XmlUtil.AttrValue(node, "cx", 0, svg.ViewBox.HasValue ? svg.ViewBox.Value.Width : svg.Size.Width); 20 | this.CY = XmlUtil.AttrValue(node, "cy", 0, svg.ViewBox.HasValue ? svg.ViewBox.Value.Height : svg.Size.Height); 21 | var diagRef = Math.Sqrt(svg.Size.Width * svg.Size.Width + svg.Size.Height * svg.Size.Height) / Math.Sqrt(2); 22 | if (svg.ViewBox.HasValue) 23 | diagRef = Math.Sqrt(svg.ViewBox.Value.Width * svg.ViewBox.Value.Width + svg.ViewBox.Value.Height * svg.ViewBox.Value.Height) / Math.Sqrt(2); 24 | this.RX = XmlUtil.AttrValue(node, "rx", 0, diagRef); 25 | this.RY = XmlUtil.AttrValue(node, "ry", 0, diagRef); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/Filter/Filter.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Media.Effects; 2 | using System.Xml; 3 | using LayUI.Wpf.Controls.SVG.Shapes; 4 | 5 | namespace LayUI.Wpf.Controls.SVG.Shapes.Filter 6 | { 7 | public class Filter : Group 8 | { 9 | public Filter(global::LayUI.Wpf.Controls.SVG.SVG svg, XmlNode node, Shape parent) 10 | : base(svg, node, parent) 11 | { 12 | 13 | } 14 | 15 | public BitmapEffect GetBitmapEffect() 16 | { 17 | var beg = new BitmapEffectGroup(); 18 | foreach (FilterBaseFe element in this.Elements) 19 | { 20 | beg.Children.Add(element.GetBitmapEffect()); 21 | } 22 | 23 | return beg; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/Filter/FilterBaseFe.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Media.Effects; 2 | using System.Xml; 3 | using LayUI.Wpf.Controls.SVG.Shapes; 4 | 5 | namespace LayUI.Wpf.Controls.SVG.Shapes.Filter 6 | { 7 | public abstract class FilterBaseFe : Shape 8 | { 9 | public FilterBaseFe(global::LayUI.Wpf.Controls.SVG.SVG svg, XmlNode node, Shape parent) 10 | : base(svg, node, parent) 11 | { 12 | 13 | } 14 | 15 | public abstract BitmapEffect GetBitmapEffect(); 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/Filter/FilterFeGaussianBlur.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Media.Effects; 2 | using System.Xml; 3 | using LayUI.Wpf.Controls.SVG; 4 | using LayUI.Wpf.Controls.SVG.Shapes; 5 | 6 | namespace LayUI.Wpf.Controls.SVG.Shapes.Filter 7 | { 8 | public class FilterFeGaussianBlur : FilterBaseFe 9 | { 10 | public string In { get; set; } 11 | 12 | public double StdDeviationX { get; set; } 13 | 14 | public double StdDeviationY { get; set; } 15 | 16 | public FilterFeGaussianBlur(global::LayUI.Wpf.Controls.SVG.SVG svg, XmlNode node, Shape parent) 17 | : base(svg, node, parent) 18 | { 19 | StdDeviationX = StdDeviationY = XmlUtil.AttrValue(node, "stdDeviation", 0); 20 | } 21 | 22 | public override BitmapEffect GetBitmapEffect() 23 | { 24 | return new BlurBitmapEffect() {Radius = StdDeviationX}; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/LineShape.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Xml; 3 | 4 | namespace LayUI.Wpf.Controls.SVG.Shapes 5 | { 6 | public class LineShape : Shape 7 | { 8 | public Point P1 { get; private set; } 9 | 10 | public Point P2 { get; private set; } 11 | 12 | public LineShape(SVG svg, XmlNode node) : base(svg, node) 13 | { 14 | double x1 = XmlUtil.AttrValue(node, "x1", 0, svg.Size.Width); 15 | double y1 = XmlUtil.AttrValue(node, "y1", 0, svg.Size.Height); 16 | double x2 = XmlUtil.AttrValue(node, "x2", 0, svg.Size.Width); 17 | double y2 = XmlUtil.AttrValue(node, "y2", 0, svg.Size.Height); 18 | this.P1 = new Point(x1, y1); 19 | this.P2 = new Point(x2, y2); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/PathShape.cs: -------------------------------------------------------------------------------- 1 | using System.Xml; 2 | using LayUI.Wpf.Controls.SVG.Shapes; 3 | 4 | namespace LayUI.Wpf.Controls.SVG 5 | { 6 | public class PathShape : Shape 7 | { 8 | static Fill DefaultFill = null; 9 | 10 | public override Fill Fill 11 | { 12 | get 13 | { 14 | Fill f = base.Fill; 15 | if (f == null) 16 | f = DefaultFill; 17 | return f; 18 | } 19 | } 20 | 21 | public bool ClosePath { get; private set; } 22 | 23 | public string Data { get; private set; } 24 | 25 | // http://apike.ca/prog_svg_paths.html 26 | public PathShape(SVG svg, XmlNode node, Shape parent) : base(svg, node, parent) 27 | { 28 | if (DefaultFill == null) 29 | { 30 | DefaultFill = new Fill(svg); 31 | DefaultFill.PaintServerKey = svg.PaintServers.Parse("black"); 32 | } 33 | 34 | this.ClosePath = false; 35 | string path = XmlUtil.AttrValue(node, "d", string.Empty); 36 | this.Data = path; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/PolygonShape.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Windows; 3 | using System.Xml; 4 | 5 | namespace LayUI.Wpf.Controls.SVG.Shapes 6 | { 7 | public class PolygonShape : Shape 8 | { 9 | private static Fill DefaultFill = null; 10 | 11 | public override Fill Fill 12 | { 13 | get 14 | { 15 | Fill f = base.Fill; 16 | if (f == null) f = DefaultFill; 17 | return f; 18 | } 19 | } 20 | 21 | public Point[] Points { get; private set; } 22 | 23 | public PolygonShape(SVG svg, XmlNode node) 24 | : base(svg, node) 25 | { 26 | if (DefaultFill == null) 27 | { 28 | DefaultFill = new Fill(svg); 29 | DefaultFill.PaintServerKey = svg.PaintServers.Parse("black"); 30 | } 31 | 32 | string points = XmlUtil.AttrValue(node, SVGTags.sPoints, string.Empty); 33 | ShapeUtil.StringSplitter split = new ShapeUtil.StringSplitter(points); 34 | List list = new List(); 35 | while (split.More) 36 | { 37 | list.Add(split.ReadNextPoint()); 38 | } 39 | this.Points = list.ToArray(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/PolylineShape.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Windows; 3 | using System.Xml; 4 | 5 | namespace LayUI.Wpf.Controls.SVG.Shapes 6 | { 7 | public class PolylineShape : Shape 8 | { 9 | public Point[] Points { get; private set; } 10 | 11 | public PolylineShape(SVG svg, XmlNode node) 12 | : base(svg, node) 13 | { 14 | string points = XmlUtil.AttrValue(node, SVGTags.sPoints, string.Empty); 15 | ShapeUtil.StringSplitter split = new ShapeUtil.StringSplitter(points); 16 | List list = new List(); 17 | while (split.More) 18 | { 19 | list.Add(split.ReadNextPoint()); 20 | } 21 | this.Points = list.ToArray(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/Shapes/UseShape.cs: -------------------------------------------------------------------------------- 1 | using System.Xml; 2 | 3 | namespace LayUI.Wpf.Controls.SVG.Shapes 4 | { 5 | public class UseShape : Shape 6 | { 7 | public double X { get; set; } 8 | 9 | public double Y { get; set; } 10 | 11 | public string hRef { get; set; } 12 | 13 | public UseShape(SVG svg, XmlNode node) : base(svg, node) 14 | { } 15 | 16 | protected override void Parse(SVG svg, string name, string value) 17 | { 18 | if (name.Contains(":")) 19 | name = name.Split(':')[1]; 20 | 21 | if (name == SVGTags.sHref) 22 | { 23 | this.hRef = value; 24 | if (this.hRef.StartsWith("#")) 25 | this.hRef = this.hRef.Substring(1); 26 | return; 27 | } 28 | if (name == "x") 29 | { 30 | this.X = XmlUtil.GetDoubleValue(value, svg.Size.Width); 31 | return; 32 | } 33 | if (name == "y") 34 | { 35 | this.Y = XmlUtil.GetDoubleValue(value, svg.Size.Height); 36 | return; 37 | } 38 | 39 | base.Parse(svg, name, value); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Image/SVG/TextStyle.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | using LayUI.Wpf.Controls.SVG.Shapes; 4 | 5 | namespace LayUI.Wpf.Controls.SVG 6 | { 7 | public class TextStyle 8 | { 9 | public string FontFamily {get; set;} 10 | public double FontSize {get; set;} 11 | public FontWeight Fontweight {get; set;} 12 | public FontStyle Fontstyle {get; set;} 13 | public TextDecorationCollection TextDecoration {get; set;} 14 | public TextAlignment TextAlignment {get; set;} 15 | public double WordSpacing {get; set;} 16 | public double LetterSpacing {get; set;} 17 | public string BaseLineShift {get; set;} 18 | public void Copy(TextStyle aCopy) 19 | { 20 | if (aCopy == null) 21 | return; 22 | this.FontFamily = aCopy.FontFamily; 23 | this.FontSize = aCopy.FontSize; 24 | this.Fontweight = aCopy.Fontweight; 25 | this.Fontstyle = aCopy.Fontstyle;; 26 | this.TextAlignment = aCopy.TextAlignment; 27 | this.WordSpacing = aCopy.WordSpacing; 28 | this.LetterSpacing = aCopy.LetterSpacing; 29 | this.BaseLineShift = aCopy.BaseLineShift; 30 | } 31 | public TextStyle(TextStyle aCopy) 32 | { 33 | this.Copy(aCopy); 34 | } 35 | public TextStyle(SVG svg, Shape owner) 36 | { 37 | this.FontFamily = "Arial Unicode MS, Verdana"; 38 | this.FontSize = 12; 39 | this.Fontweight = FontWeights.Normal; 40 | this.Fontstyle = FontStyles.Normal; 41 | this.TextAlignment = System.Windows.TextAlignment.Left; 42 | this.WordSpacing = 0; 43 | this.LetterSpacing = 0; 44 | this.BaseLineShift = string.Empty; 45 | if (owner.Parent != null) 46 | this.Copy(owner.Parent.TextStyle); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/ListBox/LayListBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.Specialized; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Controls; 8 | 9 | namespace LayUI.Wpf.Controls 10 | { 11 | /// 12 | /// ListBox 13 | /// 14 | public class LayListBox : ListBox 15 | { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/ListBox/LayListBoxItem.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 | namespace LayUI.Wpf.Controls 9 | { 10 | /// 11 | /// LayListBoxItem 12 | /// 创建者:YWK 13 | /// 创建时间:2022-09-13 上午 10:50:21 14 | /// 15 | public class LayListBoxItem: ListBoxItem 16 | { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Menu/LayContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | namespace LayUI.Wpf.Controls 10 | { 11 | public class LayContextMenu: ContextMenu 12 | { 13 | /// 14 | /// 重写自定义指定项子控件 15 | /// 16 | /// 17 | /// 18 | protected override bool IsItemItsOwnContainerOverride(object item) 19 | { 20 | return item is LayMenuItem; 21 | } 22 | /// 23 | /// 抓取指定项控件并返回定制项控件 24 | /// 25 | /// 26 | protected override DependencyObject GetContainerForItemOverride() 27 | { 28 | return new LayMenuItem(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Menu/LayMenu.cs: -------------------------------------------------------------------------------- 1 | using LayUI.Wpf.Tools; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | namespace LayUI.Wpf.Controls 11 | { 12 | /// 13 | /// LayMenu 14 | /// 创建者:YWK 15 | /// 创建时间:2022-04-22 上午 9:10:30 16 | /// 17 | public class LayMenu: Menu 18 | { 19 | /// 20 | /// 重写自定义指定项子控件 21 | /// 22 | /// 23 | /// 24 | protected override bool IsItemItsOwnContainerOverride(object item) 25 | { 26 | return item is LayMenuItem; 27 | } 28 | /// 29 | /// 抓取指定项控件并返回定制项控件 30 | /// 31 | /// 32 | protected override DependencyObject GetContainerForItemOverride() 33 | { 34 | return new LayMenuItem(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/MenuItem/LayMenuItem.cs: -------------------------------------------------------------------------------- 1 | using LayUI.Wpf.Tools; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | namespace LayUI.Wpf.Controls 11 | { 12 | /// 13 | /// LayMenuItem 14 | /// 创建者:YWK 15 | /// 创建时间:2022-04-22 上午 9:10:46 16 | /// 17 | public class LayMenuItem: MenuItem 18 | { 19 | /// 20 | /// 重写自定义指定项子控件 21 | /// 22 | /// 23 | /// 24 | protected override bool IsItemItsOwnContainerOverride(object item) 25 | { 26 | return item is LayMenuItem; 27 | } 28 | /// 29 | /// 抓取指定项控件并返回定制项控件 30 | /// 31 | /// 32 | protected override DependencyObject GetContainerForItemOverride() 33 | { 34 | return new LayMenuItem(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Message/LayMessageHost.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace LayUI.Wpf.Controls 10 | { 11 | /// 12 | /// LayMessageHost 13 | /// 创建者:YWK 14 | /// 创建时间:2022-05-19 下午 8:01:14 15 | /// 16 | public class LayMessageHost : System.Windows.Controls.ItemsControl 17 | { 18 | 19 | /// 20 | /// 重写自定义指定项子控件 21 | /// 22 | /// 23 | /// 24 | protected override bool IsItemItsOwnContainerOverride(object item) 25 | { 26 | return item is LayMessageControl; 27 | } 28 | /// 29 | /// 抓取指定项控件并返回定制项控件 30 | /// 31 | /// 32 | protected override DependencyObject GetContainerForItemOverride() 33 | { 34 | return new LayMessageControl(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Notification/LayNotificationHost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | namespace LayUI.Wpf.Controls 11 | { 12 | /// 13 | /// 通知组件容器 14 | /// 15 | public class LayNotificationHost : ItemsControl, ILayControl 16 | { 17 | [Bindable(true)] 18 | public CornerRadius CornerRadius 19 | { 20 | get { return (CornerRadius)GetValue(CornerRadiusProperty); } 21 | set { SetValue(CornerRadiusProperty, value); } 22 | } 23 | 24 | // Using a DependencyProperty as the backing store for CornerRadius. This enables animation, styling, binding, etc... 25 | public static readonly DependencyProperty CornerRadiusProperty = 26 | DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(LayNotificationHost)); 27 | 28 | /// 29 | /// 重写自定义指定项子控件 30 | /// 31 | /// 32 | /// 33 | protected override bool IsItemItsOwnContainerOverride(object item) 34 | { 35 | return item is LayNotificationControl; 36 | } 37 | /// 38 | /// 抓取指定项控件并返回定制项控件 39 | /// 40 | /// 41 | protected override DependencyObject GetContainerForItemOverride() 42 | { 43 | return new LayNotificationControl(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Slider/LaySlider.cs: -------------------------------------------------------------------------------- 1 | using LayUI.Wpf.Enum; 2 | using LayUI.Wpf.Tools; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Controls; 11 | 12 | namespace LayUI.Wpf.Controls 13 | { 14 | /// 15 | /// 滑块 16 | /// 17 | public class LaySlider: Slider 18 | { 19 | 20 | /// 21 | /// 气泡提示方向 22 | /// 23 | [Bindable(true)] 24 | public SliderTipsPosition TipsPosition 25 | { 26 | get { return (SliderTipsPosition)GetValue(TipsPositionProperty); } 27 | set { SetValue(TipsPositionProperty, value); } 28 | } 29 | 30 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 31 | public static readonly DependencyProperty TipsPositionProperty = 32 | DependencyProperty.Register("TipsPosition", typeof(SliderTipsPosition), typeof(LaySlider), new PropertyMetadata(SliderTipsPosition.No)); 33 | 34 | 35 | } 36 | } -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/TabItem/LayTabItem.cs: -------------------------------------------------------------------------------- 1 | using LayUI.Wpf.Tools; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | namespace LayUI.Wpf.Controls 11 | { 12 | public class LayTabItem: TabItem 13 | { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/TextView/LayTextView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace LayUI.Wpf.Controls 9 | { 10 | /// 11 | /// 文本渲染引擎 12 | /// 13 | public class LayTextView : FrameworkElement 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/TreeView/LayTreeView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Media; 9 | 10 | namespace LayUI.Wpf.Controls 11 | { 12 | public class LayTreeView : TreeView 13 | { 14 | /// 15 | /// 显示复选框 16 | /// 17 | public bool IsShowCheckButton 18 | { 19 | get { return (bool)GetValue(IsShowCheckButtonProperty); } 20 | set { SetValue(IsShowCheckButtonProperty, value); } 21 | } 22 | 23 | // Using a DependencyProperty as the backing store for IsShowCheckButton. This enables animation, styling, binding, etc... 24 | public static readonly DependencyProperty IsShowCheckButtonProperty = 25 | DependencyProperty.Register("IsShowCheckButton", typeof(bool), typeof(LayTreeView)); 26 | 27 | 28 | /// 29 | /// 重写自定义指定项子控件 30 | /// 31 | /// 32 | /// 33 | protected override bool IsItemItsOwnContainerOverride(object item) 34 | { 35 | return item is LayTreeViewItem; 36 | } 37 | /// 38 | /// 抓取指定项控件并返回定制项控件 39 | /// 40 | /// 41 | protected override DependencyObject GetContainerForItemOverride() 42 | { 43 | return new LayTreeViewItem(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/TreeViewItem/LayTreeSelectItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | namespace LayUI.Wpf.Controls 11 | { 12 | public class LayTreeSelectItem: TreeViewItem, ILayControl 13 | { 14 | [Bindable(true)] 15 | public CornerRadius CornerRadius 16 | { 17 | get { return (CornerRadius)GetValue(CornerRadiusProperty); } 18 | set { SetValue(CornerRadiusProperty, value); } 19 | } 20 | 21 | // Using a DependencyProperty as the backing store for CornerRadius. This enables animation, styling, binding, etc... 22 | public static readonly DependencyProperty CornerRadiusProperty = 23 | DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(LayTreeSelectItem)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Upload/LayUpload.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | namespace LayUI.Wpf.Controls 10 | { 11 | /// 12 | /// 文件上传 13 | /// 14 | public class LayUpload:Control 15 | { 16 | 17 | public UIElement ClickTarget 18 | { 19 | get { return (UIElement)GetValue(ClickTargetProperty); } 20 | set { SetValue(ClickTargetProperty, value); } 21 | } 22 | 23 | // Using a DependencyProperty as the backing store for ClickTarget. This enables animation, styling, binding, etc... 24 | public static readonly DependencyProperty ClickTargetProperty = 25 | DependencyProperty.Register("ClickTarget", typeof(UIElement), typeof(LayUpload)); 26 | 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Controls/Window/IWindowAware.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Controls 8 | { 9 | /// 10 | /// 窗体关闭控制 11 | /// 12 | public interface IWindowAware 13 | { 14 | bool CanClosing(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/Base/ElementAutoNumberConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace LayUI.Wpf.Converters 10 | { 11 | /// 12 | /// ElementAutoNumberConvert 13 | /// 创建者:YWK 14 | /// 创建时间:2022-09-01 下午 3:52:01 15 | /// 16 | public class ElementAutoNumberConverter : IValueConverter 17 | { 18 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | if (double.TryParse(value.ToString(), out double result)) 21 | { 22 | if (parameter != null && parameter.ToString() == "-") return -result; 23 | else return result; 24 | } 25 | else 26 | { 27 | //输入的不可以表示成Double类型 28 | return 0; 29 | } 30 | } 31 | 32 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 33 | { 34 | return value; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/Base/ElementOffsetConverter.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.Controls; 9 | using System.Windows.Data; 10 | 11 | namespace LayUI.Wpf.Converters.Base 12 | { 13 | /// 14 | /// 通用Thickness位移转换器 15 | /// 创建者:YWK 16 | /// 创建时间:2022-09-01 下午 6:28:32 17 | /// 18 | public class ElementOffsetConverter : IValueConverter 19 | { 20 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | var d = value as double? ?? 0; 23 | if (double.IsInfinity(d) || double.IsNaN(d)) d = 0; 24 | 25 | var dock = (parameter is Dock) ? (Dock)parameter : Dock.Left; 26 | switch (dock) 27 | { 28 | case Dock.Top: 29 | return new Thickness(0, 0 - d, 0, d); 30 | case Dock.Bottom: 31 | return new Thickness(0, d, 0, 0 - d); 32 | case Dock.Right: 33 | return new Thickness(d, 0, 0 - d, 0); 34 | case Dock.Left: 35 | default: 36 | return new Thickness(0 - d, 0, d, 0); 37 | } 38 | } 39 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 40 | { 41 | return value; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/Base/ItemsControlToIndexConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Data; 10 | 11 | namespace LayUI.Wpf.Converters 12 | { 13 | public class ItemsControlToIndexConverter : IMultiValueConverter 14 | { 15 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | if (!(values[0] is object) || !(values[1] is IList) || !(values[2] is int)) return 0; 18 | var item = values[0]; 19 | if (values[1] is IList list) 20 | { 21 | var index = list.IndexOf(item) + 1; 22 | return index; 23 | } 24 | return 0; 25 | } 26 | 27 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 28 | { 29 | throw new NotImplementedException(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/Base/MedianConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace LayUI.Wpf.Converters 10 | { 11 | /// 12 | /// 返回值取中间值 13 | /// -、+ 代表需要返回正负值 14 | /// 创建者:YWK 15 | /// 创建时间:2022-08-22 上午 10:03:25 16 | /// 17 | public class MedianConverter : IValueConverter 18 | { 19 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 20 | { 21 | if (double.TryParse(value.ToString(), out double result)) 22 | { 23 | if (parameter!=null&¶meter.ToString() == "-") return -(result / 2); 24 | else return result / 2; 25 | } 26 | else 27 | { 28 | //输入的不可以表示成Double类型 29 | return value; 30 | } 31 | } 32 | 33 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 34 | { 35 | return value; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/Base/SimpleCornerRadiusToClipConverter.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.Media; 8 | using System.Windows; 9 | using System.Windows.Data; 10 | 11 | namespace LayUI.Wpf.Converters 12 | { 13 | internal class SimpleCornerRadiusToClipConverter : IMultiValueConverter 14 | { 15 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | RectangleGeometry rectangle; 18 | if (values.Length != 3 || !(values[0] is double actualWidth) || !(values[1] is double actualHeight) || !(values[2] is CornerRadius radius)) rectangle = new RectangleGeometry(); 19 | else rectangle = new RectangleGeometry(new Rect(0, 0, actualWidth, actualHeight), (double)radius.TopLeft, (double)radius.TopLeft); 20 | return rectangle; 21 | } 22 | 23 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/CodeBox/CodeBoxLineBreakCharacterToIndexsConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | namespace LayUI.Wpf.Converters 11 | { 12 | /// 13 | /// 换行符转化Index 14 | /// 15 | public class CodeBoxLineBreakCharacterToIndexsConverter : IValueConverter 16 | { 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | if (value is null) return DependencyProperty.UnsetValue; 20 | var indexs = new List(); 21 | var values = value.ToString().Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None); 22 | for (int i = 1; i <= values.Length; i++) 23 | { 24 | indexs.Add(i); 25 | } 26 | return indexs; 27 | } 28 | 29 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/DrawerHost/DrawerHostOffsetConverter.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.Controls; 9 | using System.Windows.Data; 10 | 11 | namespace LayUI.Wpf.Converters 12 | { 13 | /// 14 | /// DrawerHostOffsetConverter 15 | /// 创建者:YWK 16 | /// 创建时间:2022-08-23 下午 5:21:19 17 | /// 18 | public class DrawerHostOffsetConverter : IValueConverter 19 | { 20 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | var d = value as double? ?? 0; 23 | if (double.IsInfinity(d) || double.IsNaN(d)) d = 0; 24 | 25 | var dock = (parameter is Dock) ? (Dock)parameter : Dock.Left; 26 | switch (dock) 27 | { 28 | case Dock.Top: 29 | return new Thickness(0, 0 - d, 0, d); 30 | case Dock.Bottom: 31 | return new Thickness(0, d, 0, 0 - d); 32 | case Dock.Right: 33 | return new Thickness(d, 0, 0 - d, 0); 34 | case Dock.Left: 35 | default: 36 | return new Thickness(0 - d, 0, d, 0); 37 | } 38 | } 39 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/NumericUpDown/DecimalToStringFormatConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | using System.Windows; 9 | 10 | namespace LayUI.Wpf.Converters 11 | { 12 | internal class DecimalToStringFormatConverter : IMultiValueConverter 13 | { 14 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | if (values[0].Equals(DependencyProperty.UnsetValue)) return DependencyProperty.UnsetValue; 17 | object format = values[1]; 18 | object value = values[0]; 19 | if (format != null) 20 | { 21 | if (!string.IsNullOrEmpty(format.ToString())) 22 | { 23 | format = format.ToString(); 24 | } 25 | } 26 | if (format != null) value = string.Format($"{{0:{format}}}", (decimal)value); 27 | else value = string.Format($"{{0}}", (decimal)value); 28 | return value; 29 | } 30 | 31 | public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture) 32 | { 33 | return null; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/Switch/SwitchWidthConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace LayUI.Wpf.Converters 10 | { 11 | /// 12 | /// SwitchWidthConverter 13 | /// 创建者:YWK 14 | /// 创建时间:2022-06-28 下午 7:05:22 15 | /// 16 | internal class SwitchWidthConverter : IValueConverter 17 | { 18 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | return (double)value * 2; 21 | } 22 | 23 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Converters/ToolTip/ToolTipOffsetConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace LayUI.Wpf.Converters 10 | { 11 | public class ToolTipOffsetConverter : IMultiValueConverter 12 | { 13 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | double verValue = values[0] as double? ?? 0; 16 | double horValue = values[1] as double? ?? 0; 17 | if (parameter != null && parameter.ToString() == "-") 18 | { 19 | var data = -((verValue + horValue) / 2); 20 | return data; 21 | } 22 | else { 23 | var data = (verValue + horValue) / 2; 24 | return data; 25 | } 26 | } 27 | 28 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 29 | { 30 | return null; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Badge/BadgeStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// BadgeStyle 11 | /// 创建者:YWK 12 | /// 创建时间:2022-08-05 上午 11:19:13 13 | /// 14 | public enum BadgeStyle 15 | { 16 | /// 17 | /// 默认 18 | /// 19 | Default, 20 | /// 21 | /// 百搭 22 | /// 23 | Normal, 24 | /// 25 | /// 暖色 26 | /// 27 | Warm, 28 | /// 29 | /// 警告 30 | /// 31 | Danger, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Base/LayAnimation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum.Base 8 | { 9 | /// 10 | /// 动画枚举 11 | /// 12 | public enum LayAnimation 13 | { 14 | /// 15 | /// 平滑放大 16 | /// 17 | Scale, 18 | /// 19 | /// 弹簧式放大 20 | /// 21 | ScaleSpring, 22 | /// 23 | /// 微微往上滑入 24 | /// 25 | Upbit 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Button/ButtonStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// 按钮样式枚举 11 | /// 12 | public enum ButtonStyle 13 | { 14 | /// 15 | /// 原始 16 | /// 17 | Primary, 18 | /// 19 | /// 默认 20 | /// 21 | Default, 22 | /// 23 | /// 百搭 24 | /// 25 | Normal, 26 | /// 27 | /// 暖色 28 | /// 29 | Warm, 30 | /// 31 | /// 警告 32 | /// 33 | Danger, 34 | /// 35 | /// 自定义 36 | /// 37 | Customize, 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Carousel/CarouselArrow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// CarouselArrow 11 | /// 创建者:YWK 12 | /// 创建时间:2022-08-15 下午 5:17:07 13 | /// 14 | public enum CarouselArrow 15 | { 16 | /// 17 | /// 悬停显示 18 | /// 19 | Hover, 20 | /// 21 | /// 始终显示 22 | /// 23 | Always, 24 | /// 25 | /// 始终不显示 26 | /// 27 | None 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/CheckBox/CheckBoxStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// 复选框枚举 11 | /// 12 | public enum CheckBoxStyle 13 | { 14 | /// 15 | /// 原始 16 | /// 17 | Primary, 18 | /// 19 | /// 默认 20 | /// 21 | Default, 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Dialog/ButtonResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | public enum ButtonResult 10 | { 11 | Yes, 12 | No, 13 | Default, 14 | None 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/DrawerHost/DrawerHostStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// DrawerHost子元素停靠位置 11 | /// 创建者:YWK 12 | /// 创建时间:2022-08-26 上午 11:05:55 13 | /// 14 | public enum DrawerHostStyle 15 | { 16 | /// 17 | /// 左侧的子元素。 18 | /// 19 | Left, 20 | /// 21 | /// 顶部的子元素 22 | /// 23 | Top, 24 | /// 25 | /// 右侧的子元素 26 | /// 27 | Right, 28 | /// 29 | /// 底部的子元素 30 | /// 31 | Bottom 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/GroupBox/GroupBoxStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// 顶部区域文字排版类型 11 | /// 12 | public enum GroupBoxStyle 13 | { 14 | /// 15 | /// 靠左 16 | /// 17 | Left, 18 | /// 19 | /// 居中 20 | /// 21 | Center, 22 | /// 23 | /// 靠右 24 | /// 25 | Right 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Legend/LegendStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// 分割线类型 11 | /// 12 | public enum LegendStyle 13 | { 14 | /// 15 | /// 靠左 16 | /// 17 | Left, 18 | /// 19 | /// 居中 20 | /// 21 | Center, 22 | /// 23 | /// 靠右 24 | /// 25 | Right 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Loading/LoadingStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// 记载动画枚举类型 11 | /// 12 | public enum LoadingStyle 13 | { 14 | /// 15 | /// 谷歌 16 | /// 17 | Google, 18 | /// 19 | /// 百搭 20 | /// 21 | Normal, 22 | /// 23 | /// 简约 24 | /// 25 | Simple, 26 | /// 27 | /// 跳动 28 | /// 29 | Beat 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Message/MessageType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// MessageType 11 | /// 创建者:YWK 12 | /// 创建时间:2022-05-19 下午 5:45:46 13 | /// 14 | public enum MessageType 15 | { 16 | /// 17 | /// 默认 18 | /// 19 | Default, 20 | /// 21 | /// 成功 22 | /// 23 | Success, 24 | /// 25 | /// 警告 26 | /// 27 | Warning, 28 | /// 29 | /// 错误 30 | /// 31 | Error 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Notification/NotificationType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// 通知状态类型 11 | /// 12 | public enum NotificationType 13 | { 14 | /// 15 | /// 默认 16 | /// 17 | Default, 18 | /// 19 | /// 详情 20 | /// 21 | Info, 22 | /// 23 | /// 成功 24 | /// 25 | Success, 26 | /// 27 | /// 警告 28 | /// 29 | Warning, 30 | /// 31 | /// 错误 32 | /// 33 | Error 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Ripple/RippleStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | public enum RippleStyle 10 | { 11 | /// 12 | /// 默认 13 | /// 14 | Default, 15 | /// 16 | /// 自动 17 | /// 18 | Auto, 19 | /// 20 | /// 点击 21 | /// 22 | Click, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Skeleton/SkeletonStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | public enum SkeletonStyle 10 | { 11 | /// 12 | /// 默认 13 | /// 14 | Default, 15 | /// 16 | /// 图片 17 | /// 18 | Image, 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Slider/SliderTipsPosition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// 滑块气泡提示位置 11 | /// 12 | public enum SliderTipsPosition 13 | { 14 | /// 15 | /// 无 16 | /// 17 | No, 18 | /// 19 | /// 上 20 | /// 21 | Top, 22 | /// 23 | /// 左 24 | /// 25 | Left, 26 | /// 27 | /// 右 28 | /// 29 | Right, 30 | /// 31 | /// 下 32 | /// 33 | Bottom 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/TabControl/TabControlStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// 选项卡样式 11 | /// 12 | public enum TabControlStyle 13 | { 14 | /// 15 | /// 卡片 16 | /// 17 | Card, 18 | /// 19 | /// 简约 20 | /// 21 | Simplicity 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/TextBox/InputType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// InputType 11 | /// 创建者:YWK 12 | /// 创建时间:2022-06-27 下午 1:25:38 13 | /// 14 | public enum InputType 15 | { 16 | /// 17 | /// 默认 18 | /// 19 | Default, 20 | /// 21 | /// 数字 22 | /// 23 | Number, 24 | /// 25 | /// 电话 26 | /// 27 | Phone, 28 | /// 29 | /// 正则表达式 30 | /// 31 | Regex 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/TooplTip/PlacementStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | public enum PlacementStyle 10 | { 11 | /// 12 | /// 下 13 | /// 14 | Bottom, 15 | /// 16 | /// 右 17 | /// 18 | Right, 19 | /// 20 | /// 上 21 | /// 22 | Top, 23 | /// 24 | /// 左 25 | /// 26 | Left 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Enum/Transitions/AnimationType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Enum 8 | { 9 | /// 10 | /// 过度动画枚举 11 | /// 12 | public enum AnimationType 13 | { 14 | /// 15 | /// 缩放 16 | /// 17 | Zoom, 18 | /// 19 | /// 渐变 20 | /// 21 | Gradient, 22 | /// 23 | /// 默认无效果 24 | /// 25 | Default, 26 | /// 27 | /// 底部滑入 28 | /// 29 | SlideInToBottom, 30 | /// 31 | /// 底部滑出 32 | /// 33 | SlideOutToBottom, 34 | /// 35 | /// 右侧滑入 36 | /// 37 | SlideInToRight, 38 | /// 39 | /// 右侧滑出 40 | /// 41 | SlideOutToRight, 42 | /// 43 | /// 顶部滑入 44 | /// 45 | SlideInToTop, 46 | /// 47 | /// 顶部滑出 48 | /// 49 | SlideOutToTop, 50 | /// 51 | /// 左侧滑入 52 | /// 53 | SlideInToLeft, 54 | /// 55 | /// 左侧滑出 56 | /// 57 | SlideOutToLeft, 58 | /// 59 | /// 旋转进入 60 | /// 61 | RotateIn, 62 | /// 63 | /// 旋转退入 64 | /// 65 | RotateOut 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Event/LayFunctionEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace LayUI.Wpf.Event 9 | { 10 | /// 11 | /// LayFunctionEventArgs 12 | /// 创建者:YWK 13 | /// 创建时间:2022-08-08 下午 5:36:45 14 | /// 15 | public class LayFunctionEventArgs : RoutedEventArgs 16 | { 17 | /// 18 | /// 目标参数 19 | /// 20 | public T Info { get; set; } 21 | public LayFunctionEventArgs(T info) 22 | { 23 | Info = info; 24 | } 25 | 26 | public LayFunctionEventArgs(RoutedEvent routedEvent, object source) : base(routedEvent, source) 27 | { 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Extend/Base/LayBindingProperty.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace LayUI.Wpf.Extend 9 | { 10 | /// 11 | /// 用于处理可视化树上无法抓到上下文的问题 12 | /// 创建者:YWK 13 | /// 创建时间:2022-08-30 下午 5:03:23 14 | /// 15 | public class LayBindingProperty : Freezable 16 | { 17 | /// 18 | /// 数据上下文 19 | /// 20 | public object DataContext 21 | { 22 | get { return (object)GetValue(DataContextProperty); } 23 | set { SetValue(DataContextProperty, value); } 24 | } 25 | 26 | // Using a DependencyProperty as the backing store for DataContext. This enables animation, styling, binding, etc... 27 | public static readonly DependencyProperty DataContextProperty = 28 | DependencyProperty.Register("DataContext", typeof(object), typeof(LayBindingProperty)); 29 | protected override Freezable CreateInstanceCore() 30 | { 31 | return new LayBindingProperty(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Extend/DataGrid/LayDataGridHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | namespace LayUI.Wpf.Extend 10 | { 11 | /// 12 | /// LayDataGridHelper 13 | /// 创建者:YWK 14 | /// 创建时间:2022-07-04 下午 4:36:23 15 | /// 16 | public class LayDataGridHelper: LayItemsControlHelper 17 | { 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Extend/DatePicker/LayDatePickerHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Extend 8 | { 9 | /// 10 | /// LayDatePickerHelper 11 | /// 创建者:YWK 12 | /// 创建时间:2022-06-23 下午 1:10:14 13 | /// 14 | public class LayDatePickerHelper : LayControlsBaseHelper 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Extend/ItemsControl/LayItemsControlHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace LayUI.Wpf.Extend 9 | { 10 | /// 11 | /// LayItemsControlHelper 12 | /// 创建者:YWK 13 | /// 创建时间:2022-09-13 上午 10:42:18 14 | /// 15 | public class LayItemsControlHelper 16 | { 17 | /// 18 | /// 获得列表当前行号 19 | /// 20 | /// 21 | /// 22 | public static int GetLineNumber(DependencyObject obj) 23 | { 24 | return (int)obj.GetValue(LineNumberProperty); 25 | } 26 | /// 27 | /// 设置列表当前行号 28 | /// 29 | /// 30 | /// 31 | public static void SetLineNumber(DependencyObject obj, int value) 32 | { 33 | obj.SetValue(LineNumberProperty, value); 34 | } 35 | 36 | // Using a DependencyProperty as the backing store for Index. This enables animation, styling, binding, etc... 37 | public static readonly DependencyProperty LineNumberProperty = 38 | DependencyProperty.RegisterAttached("LineNumber", typeof(int), typeof(LayItemsControlHelper)); 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Layui-WPF-Team/Layui-WPF/b062e3c71a4847e9366958f23b43aac026c943f5/src/LayuiPack/LayUI.Wpf/Fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Fonts/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Layui-WPF-Team/Layui-WPF/b062e3c71a4847e9366958f23b43aac026c943f5/src/LayuiPack/LayUI.Wpf/Fonts/iconfont.ttf -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/Interface/ILayDialogAware.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Global 8 | { 9 | public interface ILayDialogAware 10 | { 11 | event Action RequestClose; 12 | void OnDialogOpened(ILayDialogParameter parameters); 13 | void OnDialogClosed(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/Interface/ILayDialogParameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Global 8 | { 9 | public interface ILayDialogParameter 10 | { 11 | /// 12 | /// 添加参数 13 | /// 14 | /// 15 | /// 16 | void Add(string key, object value); 17 | // 18 | /// 获取参数 19 | /// 20 | /// 21 | /// 22 | /// 23 | T GetValue(string key); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/Interface/ILayDialogResult.cs: -------------------------------------------------------------------------------- 1 | using LayUI.Wpf.Enum; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LayUI.Wpf.Global 9 | { 10 | public interface ILayDialogResult 11 | { 12 | /// 13 | /// 返回结果 14 | /// 15 | ButtonResult Result { get; } 16 | LayDialogParameter Parameters { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/Interface/ILayDialogUserControlWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace LayUI.Wpf.Global 10 | { 11 | public interface ILayDialogUserControlWindow 12 | { 13 | /// 14 | /// 内容 15 | /// 16 | object Content { get; set; } 17 | /// 18 | /// 返回结果 19 | /// 20 | ILayDialogResult Result { get; set; } 21 | /// 22 | /// 初始化 23 | /// 24 | event RoutedEventHandler Loaded; 25 | /// 26 | /// 结束 27 | /// 28 | event RoutedEventHandler Unloaded; 29 | /// 30 | /// 数据上下文 31 | /// 32 | object DataContext { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/Interface/ILayDialogUserControlWindowExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Global 8 | { 9 | internal static class ILayDialogUserControlWindowExtensions 10 | { 11 | internal static ILayDialogAware GetDialogViewModel(this ILayDialogUserControlWindow dialog) 12 | { 13 | return (ILayDialogAware)dialog.DataContext; 14 | } 15 | internal static ILayDialogAware GetDialogView(this ILayDialogUserControlWindow dialog) 16 | { 17 | return (ILayDialogAware)dialog.Content; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/Interface/ILayDialogWindowAware.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Global 8 | { 9 | public interface ILayDialogWindowAware:ILayDialogAware 10 | { 11 | bool CanCloseDialog(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/Interface/ILayDialogWindowExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LayUI.Wpf.Global 8 | { 9 | internal static class ILayDialogWindowExtensions 10 | { 11 | internal static ILayDialogWindowAware GetDialogViewModel(this ILayDialogWindow dialog) 12 | { 13 | return (ILayDialogWindowAware)dialog.DataContext; 14 | } 15 | internal static ILayDialogWindowAware GetDialogView(this ILayDialogWindow dialog) 16 | { 17 | return (ILayDialogWindowAware)dialog.Content; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/LayDialogParameter.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LayUI.Wpf.Global 9 | { 10 | public class LayDialogParameter : ILayDialogParameter 11 | { 12 | private readonly List> _entries = new List>(); 13 | 14 | /// 15 | /// 添加参数 16 | /// 17 | /// 18 | /// 19 | public void Add(string key, object value) 20 | { 21 | _entries.Add(new KeyValuePair(key, value)); 22 | } 23 | // 24 | /// 获取参数 25 | /// 26 | /// 27 | /// 28 | /// 29 | public T GetValue(string key) 30 | { 31 | return _entries.GetValue(key); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/LayDialogResult.cs: -------------------------------------------------------------------------------- 1 |  2 | using LayUI.Wpf.Enum; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace LayUI.Wpf.Global 10 | { 11 | public class LayDialogResult : ILayDialogResult 12 | { 13 | public ButtonResult Result { get; set; } = ButtonResult.None; 14 | 15 | public LayDialogParameter Parameters { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Global/Dialog/LayDialogUserControlWindow.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Input; 11 | using System.Windows.Media.Animation; 12 | 13 | namespace LayUI.Wpf.Global 14 | { 15 | /// 16 | /// LayDialogWindow 17 | /// 创建者:YWK 18 | /// 创建时间:2022-04-12 下午 1:50:20 19 | /// 20 | internal class LayDialogUserControlWindow : ContentControl, ILayDialogUserControlWindow 21 | { 22 | public ILayDialogResult Result { get; set; } 23 | [Bindable(true)] 24 | public bool IsOpen 25 | { 26 | get { return (bool)GetValue(IsOpenProperty); } 27 | set { SetValue(IsOpenProperty, value); } 28 | } 29 | // Using a DependencyProperty as the backing store for IsOpen. This enables animation, styling, binding, etc... 30 | public static readonly DependencyProperty IsOpenProperty = 31 | DependencyProperty.Register("IsOpen", typeof(bool), typeof(LayDialogUserControlWindow), new PropertyMetadata(false)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Mvvm/LayBindableBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Runtime.CompilerServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace LayUI.Wpf 10 | { 11 | public abstract class LayBindableBase : INotifyPropertyChanged 12 | { 13 | public event PropertyChangedEventHandler PropertyChanged; 14 | 15 | protected virtual bool SetProperty(ref T storage, T value, Action onChanged = null, [CallerMemberName] string propertyName = null) 16 | { 17 | // 检查新值是否与当前值相等 18 | if (EqualityComparer.Default.Equals(storage, value)) 19 | { 20 | return false; // 如果相等,返回 false 21 | } 22 | 23 | storage = value; // 更新存储的值 24 | onChanged?.Invoke(); // 调用可选的 onChanged 回调 25 | OnPropertyChanged(propertyName); // 触发属性变化通知 26 | return true; // 返回 true 表示值已更改 27 | } 28 | 29 | public void OnPropertyChanged([CallerMemberName] string propertyName = null) => 30 | OnPropertyChanged(new PropertyChangedEventArgs(propertyName)); // 触发属性变化事件 31 | public void RaisePropertyChanged([CallerMemberName] string propertyName = null) => 32 | OnPropertyChanged(propertyName); 33 | protected void OnPropertyChanged(PropertyChangedEventArgs args) => 34 | PropertyChanged?.Invoke(this, args); // 通知所有订阅者 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Style/Default/CheckCardStyle.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Style/Default/ControlBaseStyle.xaml: -------------------------------------------------------------------------------- 1 |  2 | 2 3 | 9 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Style/Default/DecimalTextStyle.xaml: -------------------------------------------------------------------------------- 1 |  5 | 28 | 22 | 17 | 21 | 26 | 8 | -------------------------------------------------------------------------------- /src/LayuiPack/LayUI.Wpf/Style/Default/SvgImageStyle.xaml: -------------------------------------------------------------------------------- 1 |  5 | 17 | 15 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/DefaultDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LayuiComponentExample.Views 17 | { 18 | /// 19 | /// DefaultDialogView.xaml 的交互逻辑 20 | /// 21 | public partial class DefaultDialog : UserControl 22 | { 23 | public DefaultDialog() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/Dialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LayuiComponentExample.Views 17 | { 18 | /// 19 | /// Dialog.xaml 的交互逻辑 20 | /// 21 | public partial class Dialog : UserControl 22 | { 23 | public Dialog() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/DialogAlert.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 18 | 19 | 24 | 25 | 26 | 27 | 33 | 34 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/DialogAlert.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for DialogAlert 7 | /// 8 | public partial class DialogAlert : UserControl 9 | { 10 | public DialogAlert() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/DialogMessageView.xaml.cs: -------------------------------------------------------------------------------- 1 | using CommonServiceLocator; 2 | using LayuiComponentExample.ViewModels; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Data; 11 | using System.Windows.Documents; 12 | using System.Windows.Input; 13 | using System.Windows.Media; 14 | using System.Windows.Media.Imaging; 15 | using System.Windows.Navigation; 16 | using System.Windows.Shapes; 17 | 18 | namespace LayuiComponentExample.Views 19 | { 20 | /// 21 | /// DialogMessageView.xaml 的交互逻辑 22 | /// 23 | public partial class DialogMessageView : UserControl 24 | { 25 | public DialogMessageView() 26 | { 27 | InitializeComponent(); 28 | DataContext = ServiceLocator.Current.GetService(typeof(DialogMessageViewModel)); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/Drawer.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for Drawer 7 | /// 8 | public partial class Drawer : UserControl 9 | { 10 | public Drawer() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/FlowItemsControl.xaml: -------------------------------------------------------------------------------- 1 |  9 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/FlowItemsControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for FlowItemsControl 7 | /// 8 | public partial class FlowItemsControl : UserControl 9 | { 10 | public FlowItemsControl() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/Icon.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for Icon 7 | /// 8 | public partial class Icon : UserControl 9 | { 10 | public Icon() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/Message.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for Message 7 | /// 8 | public partial class Message : UserControl 9 | { 10 | public Message() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/NoticeBar.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for NoticeBar 7 | /// 8 | public partial class NoticeBar : UserControl 9 | { 10 | public NoticeBar() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/NotificationView.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/NotificationView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for NotificationView 7 | /// 8 | public partial class NotificationView : UserControl 9 | { 10 | public NotificationView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/Pagination.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for Pagination 7 | /// 8 | public partial class Pagination : UserControl 9 | { 10 | public Pagination() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/PopupBox.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for PopupBox 7 | /// 8 | public partial class PopupBox : UserControl 9 | { 10 | public PopupBox() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/PropertyGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LayuiComponentExample.Views 17 | { 18 | /// 19 | /// PropertyGrid.xaml 的交互逻辑 20 | /// 21 | public partial class PropertyGrid : UserControl 22 | { 23 | public PropertyGrid() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/Ripple.xaml: -------------------------------------------------------------------------------- 1 |  8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/Ripple.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for Ripple 7 | /// 8 | public partial class Ripple : UserControl 9 | { 10 | public Ripple() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/Slider.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LayuiComponentExample.Views 4 | { 5 | /// 6 | /// Interaction logic for Slider 7 | /// 8 | public partial class Slider : UserControl 9 | { 10 | public Slider() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/Tag.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LayuiComponentExample.Views 17 | { 18 | /// 19 | /// Tag.xaml 的交互逻辑 20 | /// 21 | public partial class Tag : UserControl 22 | { 23 | public Tag() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | private void Button_Click(object sender, RoutedEventArgs e) 29 | { 30 | tags.Clear(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LayuiPack/Models/LayuiComponentExample/Views/TestDialogView.xaml: -------------------------------------------------------------------------------- 1 |  11 |