Repository: Ruris/PanuonUI Branch: master Commit: 6a28a8f41551 Files: 234 Total size: 3.2 MB Directory structure: gitextract_d18lroo2/ ├── .gitignore ├── LICENSE ├── Panuon.UI/ │ ├── 0_Base/ │ │ ├── DragableThumb.cs │ │ ├── NotTopMostPopup.cs │ │ ├── PUResizeContainer.cs │ │ ├── PUResizeGrid.cs │ │ ├── PUResizeThumb.cs │ │ └── PUWindow.cs │ ├── 2_Button/ │ │ ├── PUButton.cs │ │ └── PURepeatButton.cs │ ├── 3_TextBox/ │ │ └── PUTextBox.cs │ ├── 4_PasswordBox/ │ │ └── PUPasswordBox.cs │ ├── 5_ComboBox/ │ │ ├── PUComboBox.cs │ │ └── PUComboBoxItem.cs │ ├── 6_CheckBox/ │ │ └── PUCheckBox.cs │ ├── 7_RadioButton/ │ │ └── PURadioButton.cs │ ├── 8_ProgressBar/ │ │ └── PUProgressBar.cs │ ├── 9_Special/ │ │ ├── Countdown.cs │ │ ├── DateTimePicker.cs │ │ ├── DropDown.cs │ │ ├── PUCard.cs │ │ ├── PUImageCuter.xaml │ │ ├── PUImageCuter.xaml.cs │ │ ├── PUIndicator.xaml │ │ ├── PUIndicator.xaml.cs │ │ ├── PULoading.xaml │ │ ├── PULoading.xaml.cs │ │ ├── PUMessageBox.xaml │ │ ├── PUMessageBox.xaml.cs │ │ ├── PUSlideShow.xaml │ │ ├── PUSlideShow.xaml.cs │ │ └── PUSplitLine.cs │ ├── A0_TreeView/ │ │ ├── PUTreeView.cs │ │ └── PUTreeViewItem.cs │ ├── A1_Slider/ │ │ ├── PUSlider.xaml │ │ └── PUSlider.xaml.cs │ ├── A2_TabControl/ │ │ ├── PUTabControl.cs │ │ └── PUTabItem.cs │ ├── A3_ListBox/ │ │ ├── PUListBox.cs │ │ └── PUListBoxItem.cs │ ├── A4_DatePicker/ │ │ ├── PUDatePicker.xaml │ │ └── PUDatePicker.xaml.cs │ ├── A5_PagingNav/ │ │ ├── PUPagingNav.xaml │ │ └── PUPagingNav.xaml.cs │ ├── A6_ContextMenu/ │ │ ├── PUContextMenu.cs │ │ └── PUContextMenuItem.cs │ ├── A7_Bubble/ │ │ └── PUBubble.cs │ ├── Helper/ │ │ └── Helper.cs │ ├── Others/ │ │ └── Enums.cs │ ├── Panuon.UI.csproj │ ├── Properties/ │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── Themes/ │ │ ├── Control.xaml │ │ ├── Generic.xaml │ │ └── Resources.xaml │ ├── Utils/ │ │ ├── Converters.cs │ │ ├── Extends.cs │ │ └── Utils.cs │ ├── Z_Helper/ │ │ └── Helper.cs │ ├── Z_Models/ │ │ ├── PUComboBoxItemModel.cs │ │ ├── PUListBoxItemModel.cs │ │ ├── PUTabItemModel.cs │ │ └── PUTreeViewItemModel.cs │ ├── Z_Others/ │ │ ├── Converters.cs │ │ ├── Enums.cs │ │ └── SkipCompareAttribute.cs │ └── Z_Utils/ │ ├── Extends.cs │ └── Utils.cs ├── Panuon.UI.Charts/ │ ├── 0_Base/ │ │ ├── PUChartPoint.cs │ │ ├── PUChartToolTip.xaml │ │ └── PUChartToolTip.xaml.cs │ ├── 1_LineChart/ │ │ ├── PULineChart.cs │ │ ├── PULineChart.xaml │ │ └── PULineChart.xaml.cs │ ├── Others/ │ │ └── Enums.cs │ ├── Panuon.UI.Charts.csproj │ └── Properties/ │ └── AssemblyInfo.cs ├── Panuon.UI.sln ├── Panuon.UIBrowser/ │ ├── App.xaml │ ├── App.xaml.cs │ ├── AppBootstrapper.cs │ ├── IShell.cs │ ├── Models/ │ │ └── DataSourceModel.cs │ ├── Panuon.UIBrowser.csproj │ ├── Properties/ │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ViewModels/ │ │ ├── Chart/ │ │ │ └── LineChartViewModel.cs │ │ ├── Control/ │ │ │ ├── ButtonViewModel.cs │ │ │ ├── CheckBoxViewModel.cs │ │ │ ├── ComboBoxViewModel.cs │ │ │ ├── ContextMenuViewModel.cs │ │ │ ├── DatePickerViewModel.cs │ │ │ ├── ListBoxViewModel.cs │ │ │ ├── PasswordBoxViewModel.cs │ │ │ ├── ProgressBarViewModel.cs │ │ │ ├── RadioButtonViewModel.cs │ │ │ ├── SliderViewModel.cs │ │ │ ├── TabControlViewModel.cs │ │ │ ├── TextBoxViewModel.cs │ │ │ ├── TreeViewViewModel.cs │ │ │ └── WindowViewModel.cs │ │ ├── Example.cs │ │ ├── IntroductionViewModel.cs │ │ ├── MainWindowViewModel.cs │ │ ├── OverviewViewModel.cs │ │ ├── Partial/ │ │ │ ├── BubblesViewModel.cs │ │ │ ├── ButtonsViewModel.cs │ │ │ ├── CheckBoxsViewModel.cs │ │ │ ├── ComboBoxsViewModel.cs │ │ │ ├── ContextMenusViewModel.cs │ │ │ ├── DataGridsViewModel.cs │ │ │ ├── DatePickersViewModel.cs │ │ │ ├── GridsViewModel.cs │ │ │ ├── ImageCuterViewModel.cs │ │ │ ├── IntroductionViewModel.cs │ │ │ ├── LineChartsViewModel.cs │ │ │ ├── ListBoxsViewModel.cs │ │ │ ├── PagingNavsViewModel.cs │ │ │ ├── PasswordBoxsViewModel.cs │ │ │ ├── ProgressBarsViewModel.cs │ │ │ ├── RadioButtonsViewModel.cs │ │ │ ├── SlidersViewModel.cs │ │ │ ├── SpecialViewModel.cs │ │ │ ├── TabControlsViewModel.cs │ │ │ ├── TextBoxsViewModel.cs │ │ │ ├── TreeViewsViewModel.cs │ │ │ ├── UtilsViewModel.cs │ │ │ └── WindowsViewModel.cs │ │ ├── ShellWindowViewModel.cs │ │ └── Special/ │ │ ├── BubbleViewModel.cs │ │ ├── DropDownViewModel.cs │ │ ├── ImageCuterViewModel.cs │ │ ├── LoadingViewModel.cs │ │ ├── PagingNavViewModel.cs │ │ ├── ResizeGridViewModel.cs │ │ └── SplitLineViewModel.cs │ ├── Views/ │ │ ├── Chart/ │ │ │ └── LineChartView.xaml │ │ ├── Controls/ │ │ │ ├── ButtonView.xaml │ │ │ ├── CheckBoxView.xaml │ │ │ ├── ComboBoxView.xaml │ │ │ ├── ContextMenuView.xaml │ │ │ ├── DatePickerView.xaml │ │ │ ├── Examples/ │ │ │ │ ├── ChatWindow.xaml │ │ │ │ ├── ChatWindow.xaml.cs │ │ │ │ ├── LoginWindow.xaml │ │ │ │ ├── LoginWindow.xaml.cs │ │ │ │ ├── MultiNavWindow.xaml │ │ │ │ └── MultiNavWindow.xaml.cs │ │ │ ├── ListBoxView.xaml │ │ │ ├── PasswordBoxView.xaml │ │ │ ├── ProgressBarView.xaml │ │ │ ├── RadioButtonView.xaml │ │ │ ├── SliderView.xaml │ │ │ ├── TabControlView.xaml │ │ │ ├── TextBoxView.xaml │ │ │ ├── TreeViewView.xaml │ │ │ └── WindowView.xaml │ │ ├── MainWindowView.xaml │ │ ├── OverviewView.xaml │ │ ├── Partial/ │ │ │ ├── BubblesView.xaml │ │ │ ├── ButtonsView.xaml │ │ │ ├── CheckBoxsView.xaml │ │ │ ├── ComboBoxsView.xaml │ │ │ ├── ContextMenusView.xaml │ │ │ ├── DataGridsView.xaml │ │ │ ├── DatePickersView.xaml │ │ │ ├── HelpersView.xaml │ │ │ ├── ImageCuterView.xaml │ │ │ ├── IntroductionView.xaml │ │ │ ├── LineChartsView.xaml │ │ │ ├── ListBoxsView.xaml │ │ │ ├── PagingNavsView.xaml │ │ │ ├── PasswordBoxsView.xaml │ │ │ ├── ProgressBarsView.xaml │ │ │ ├── RadioButtonsView.xaml │ │ │ ├── SlidersView.xaml │ │ │ ├── SpecialView.xaml │ │ │ ├── TabControlsView.xaml │ │ │ ├── TextBoxsView.xaml │ │ │ ├── TreeViewsView.xaml │ │ │ ├── UtilsView.xaml │ │ │ └── WindowsView.xaml │ │ ├── ShellWindowView.xaml │ │ └── Special/ │ │ ├── BubbleView.xaml │ │ ├── DropDownView.xaml │ │ ├── ImageCuterView.xaml │ │ ├── IndicatorView.xaml │ │ ├── LoadingView.xaml │ │ ├── PagingNavView.xaml │ │ ├── ResizeGridView.xaml │ │ └── SplitLineView.xaml │ ├── app.config │ └── packages.config ├── README.md └── packages/ ├── Caliburn.Micro.3.2.0/ │ ├── Caliburn.Micro.3.2.0.nupkg │ └── lib/ │ ├── MonoAndroid10/ │ │ ├── Caliburn.Micro.Platform.Core.xml │ │ └── Caliburn.Micro.Platform.xml │ ├── MonoTouch10/ │ │ ├── Caliburn.Micro.Platform.Core.dll.mdb │ │ ├── Caliburn.Micro.Platform.Core.xml │ │ ├── Caliburn.Micro.Platform.xml │ │ └── Caliburn.Micro.dll.mdb │ ├── Xamarin.iOS10/ │ │ ├── Caliburn.Micro.Platform.Core.dll.mdb │ │ ├── Caliburn.Micro.Platform.Core.xml │ │ ├── Caliburn.Micro.Platform.xml │ │ └── Caliburn.Micro.dll.mdb │ ├── net40/ │ │ ├── Caliburn.Micro.Platform.xml │ │ └── System.Windows.Interactivity.xml │ ├── net45/ │ │ ├── Caliburn.Micro.Platform.Core.xml │ │ └── Caliburn.Micro.Platform.xml │ ├── sl5/ │ │ └── Caliburn.Micro.Platform.xml │ ├── uap10.0/ │ │ ├── Caliburn.Micro.Platform.Core.xml │ │ ├── Caliburn.Micro.Platform.UWP/ │ │ │ └── Properties/ │ │ │ └── Caliburn.Micro.Platform.UWP.rd.xml │ │ ├── Caliburn.Micro.Platform.UWP.XML │ │ └── Caliburn.Micro.Platform.UWP.pri │ ├── win81/ │ │ ├── Caliburn.Micro.Platform.Core.xml │ │ ├── Caliburn.Micro.Platform.XML │ │ └── Caliburn.Micro.Platform.pri │ ├── wp8/ │ │ ├── Caliburn.Micro.Platform.Core.xml │ │ └── Caliburn.Micro.Platform.xml │ └── wpa81/ │ ├── Caliburn.Micro.Platform.Core.xml │ ├── Caliburn.Micro.Platform.pri │ └── Caliburn.Micro.Platform.xml └── Caliburn.Micro.Core.3.2.0/ ├── Caliburn.Micro.Core.3.2.0.nupkg └── lib/ ├── net40/ │ └── Caliburn.Micro.XML ├── net45/ │ └── Caliburn.Micro.xml ├── portable-net45+win8+wp8+wpa81+MonoAndroid10+Xamarin.iOS10+MonoTouch10+uap10.0/ │ ├── Caliburn.Micro.XML │ └── Caliburn.Micro.dll.mdb └── sl5/ └── Caliburn.Micro.XML ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ *.suo *.user *.userosscache *.sln.docstates *.userprefs *.pdb *.dll *.cache [Dd]ebug/ [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ x64/ x86/ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ .vs/ ================================================ FILE: LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: Panuon.UI/0_Base/DragableThumb.cs ================================================ using System; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Interop; using System.Windows.Media; namespace Panuon.UI { internal class DragableThumb : Thumb { static DragableThumb() { DefaultStyleKeyProperty.OverrideMetadata(typeof(DragableThumb), new FrameworkPropertyMetadata(typeof(DragableThumb))); } public DragableThumb() { DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDelta); } private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e) { var element = DragTarget as FrameworkElement; if (double.IsNaN(Canvas.GetLeft(element))) Canvas.SetLeft(element, 0); if (double.IsNaN(Canvas.GetTop(element))) Canvas.SetTop(element, 0); var width = element.ActualWidth; var height = element.ActualHeight; var left = Canvas.GetLeft(element); var targetLeft = left + e.HorizontalChange; var top = Canvas.GetTop(element); var targetTop = top + e.VerticalChange; var parentCanvas = element.Parent as Canvas; if (LimitInParent && parentCanvas != null) { if (targetLeft < 0) targetLeft = 0; else if (targetLeft + width > parentCanvas.ActualWidth) targetLeft = parentCanvas.ActualWidth - width; if (targetTop < 0) targetTop = 0; else if (targetTop + height > parentCanvas.ActualHeight) targetTop = parentCanvas.ActualHeight - height; } Canvas.SetLeft(element, targetLeft); Canvas.SetTop(element, targetTop); } #region Property public DependencyObject DragTarget { get { return (DependencyObject)GetValue(DragTargetProperty); } set { SetValue(DragTargetProperty, value); } } public static readonly DependencyProperty DragTargetProperty = DependencyProperty.Register("DragTarget", typeof(DependencyObject), typeof(DragableThumb)); public bool LimitInParent { get { return (bool)GetValue(LimitInParentProperty); } set { SetValue(LimitInParentProperty, value); } } public static readonly DependencyProperty LimitInParentProperty = DependencyProperty.Register("LimitInParent", typeof(bool), typeof(DragableThumb)); #endregion } } ================================================ FILE: Panuon.UI/0_Base/NotTopMostPopup.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Windows; using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Interop; namespace Panuon.UI { internal class NotTopMostPopup : Popup { private Window _window; protected override void OnOpened(EventArgs e) { var hwnd = ((HwndSource)PresentationSource.FromVisual(this.Child)).Handle; RECT rect; if (GetWindowRect(hwnd, out rect)) { SetWindowPos(hwnd, -2, rect.Left, rect.Top, (int)this.Width, (int)this.Height, 0); } _window = Window.GetWindow(this); _window.PreviewMouseDown -= Window_PreviewMouseDown; _window.PreviewMouseDown += Window_PreviewMouseDown; } protected override void OnClosed(EventArgs e) { base.OnClosed(e); _window.PreviewMouseDown -= Window_PreviewMouseDown; } private void Window_PreviewMouseDown(object sender, MouseButtonEventArgs e) { var element = Tag as FrameworkElement; if (!IsMouseOver && !element.IsMouseOver) IsOpen = false; } #region P/Invoke imports & definitions [StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left; public int Top; public int Right; public int Bottom; } [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect); [DllImport("user32", EntryPoint = "SetWindowPos")] private static extern int SetWindowPos(IntPtr hWnd, int hwndInsertAfter, int x, int y, int cx, int cy, int wFlags); #endregion } } ================================================ FILE: Panuon.UI/0_Base/PUResizeContainer.cs ================================================ using System.Windows; using System.Windows.Controls; namespace Panuon.UI { internal class PUResizeContainer : ContentControl { static PUResizeContainer() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUResizeContainer), new FrameworkPropertyMetadata(typeof(PUResizeContainer))); } #region Property public bool IsSquare { get { return (bool)GetValue(IsSquareProperty); } set { SetValue(IsSquareProperty, value); } } public static readonly DependencyProperty IsSquareProperty = DependencyProperty.Register("IsSquare", typeof(bool), typeof(PUResizeContainer)); public bool LimitInParent { get { return (bool)GetValue(LimitInParentProperty); } set { SetValue(LimitInParentProperty, value); } } public static readonly DependencyProperty LimitInParentProperty = DependencyProperty.Register("LimitInParent", typeof(bool), typeof(PUResizeContainer)); public bool CanResize { get { return (bool)GetValue(CanResizeProperty); } set { SetValue(CanResizeProperty, value); } } public static readonly DependencyProperty CanResizeProperty = DependencyProperty.Register("CanResize", typeof(bool), typeof(PUResizeContainer), new PropertyMetadata(true)); #endregion } } ================================================ FILE: Panuon.UI/0_Base/PUResizeGrid.cs ================================================ using System.Windows; using System.Windows.Controls; namespace Panuon.UI { public class PUResizeGrid : UserControl { static PUResizeGrid() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUResizeGrid), new FrameworkPropertyMetadata(typeof(PUResizeGrid))); } #region Property public bool IsSquare { get { return (bool)GetValue(IsSquareProperty); } set { SetValue(IsSquareProperty, value); } } public static readonly DependencyProperty IsSquareProperty = DependencyProperty.Register("IsSquare", typeof(bool), typeof(PUResizeGrid), new PropertyMetadata(false)); #endregion } } ================================================ FILE: Panuon.UI/0_Base/PUResizeThumb.cs ================================================ using System; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Interop; namespace Panuon.UI { internal class ResizeThumb : Thumb { public ResizeThumb() { DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDelta); } #region Property public bool IsSquare { get { return (bool)GetValue(IsSquareProperty); } set { SetValue(IsSquareProperty, value); } } public static readonly DependencyProperty IsSquareProperty = DependencyProperty.Register("IsSquare", typeof(bool), typeof(ResizeThumb)); public bool LimitInParent { get { return (bool)GetValue(LimitInParentProperty); } set { SetValue(LimitInParentProperty, value); } } public static readonly DependencyProperty LimitInParentProperty = DependencyProperty.Register("LimitInParent", typeof(bool), typeof(ResizeThumb)); #endregion #region Event private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e) { var element = this.DataContext as FrameworkElement; if (double.IsNaN(Canvas.GetLeft(element))) Canvas.SetLeft(element, 0); if (double.IsNaN(Canvas.GetTop(element))) Canvas.SetTop(element, 0); var parentCanvas = element.Parent as Canvas; double width = 0.0; double height = 0.0; var left = Canvas.GetLeft(element); var top = Canvas.GetTop(element); if (HorizontalAlignment == HorizontalAlignment.Left || HorizontalAlignment == HorizontalAlignment.Right) { if (HorizontalAlignment == HorizontalAlignment.Left) { width = element.ActualWidth - e.HorizontalChange; if (LimitInParent && parentCanvas != null) { if (left + e.HorizontalChange < 0 && element.ActualWidth != element.MaxWidth) width = element.ActualWidth + left; } } else { width = element.ActualWidth + e.HorizontalChange; if (LimitInParent && parentCanvas != null) { if (left + element.ActualWidth + e.HorizontalChange > parentCanvas.ActualWidth && element.ActualWidth != element.MaxWidth) width = parentCanvas.ActualWidth - left; } } width = width > element.MaxWidth ? element.MaxWidth : width; width = width < element.MinWidth ? element.MinWidth : width; } if (VerticalAlignment == VerticalAlignment.Top || VerticalAlignment == VerticalAlignment.Bottom) { if (VerticalAlignment == VerticalAlignment.Top) { height = element.ActualHeight - e.VerticalChange; if (LimitInParent && parentCanvas != null) { if (top + e.VerticalChange < 0 && element.ActualHeight != element.MaxHeight) height = element.ActualHeight + top; } } else { height = element.ActualHeight + e.VerticalChange; if (LimitInParent && parentCanvas != null) { if (top + element.ActualHeight + e.VerticalChange > parentCanvas.ActualHeight && element.ActualHeight != element.MaxHeight) height = parentCanvas.ActualHeight - top; } } height = height > element.MaxHeight ? element.MaxHeight : height; height = height < element.MinHeight ? element.MinHeight : height; } if (!IsSquare) { if (width != 0) SetElementWidth(element, width, left); if (height != 0) SetElementHeight(element, height, top); } else { if (width != 0) { if (!LimitInParent) { SetElementWidth(element, width, left); SetElementHeight(element, width, top); } if (LimitInParent) { if (width + top < parentCanvas.ActualHeight) { SetElementWidth(element, width, left); SetElementHeight(element, width, top); } } } else if (height != 0) { if (!LimitInParent) { SetElementWidth(element, height, left); SetElementHeight(element, height, top); } if (LimitInParent) { if (height + left <= parentCanvas.ActualWidth) { SetElementWidth(element, height, left); SetElementHeight(element, height, top); } } } } } #endregion #region Function private void SetElementWidth(FrameworkElement element, double width, double left) { if (HorizontalAlignment == HorizontalAlignment.Left) { var delta = element.ActualWidth - width; Canvas.SetLeft(element, left + delta); } element.Width = width; } private void SetElementHeight(FrameworkElement element, double height, double top) { if (VerticalAlignment == VerticalAlignment.Top) { var delta = element.ActualHeight - height; Canvas.SetTop(element, Canvas.GetTop(element) + delta); } element.Height = height; } #endregion } } ================================================ FILE: Panuon.UI/0_Base/PUWindow.cs ================================================ using System; using System.ComponentModel; using System.Reflection; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Shapes; using System.Windows.Threading; namespace Panuon.UI { public class PUWindow : Window { #region Import [DllImport("user32.dll")] static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam); #endregion #region Identify private enum ResizeDirection { Left = 1, Right = 2, Top = 3, TopLeft = 4, TopRight = 5, Bottom = 6, BottomLeft = 7, BottomRight = 8, } private HwndSource _hwndSource; private PUButton _btnClose; private StackPanel _stkNav; private bool _animateOutHandle = true; private bool? _dialogResult; private bool _needToSetDialogResult; #endregion #region Constructor static PUWindow() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUWindow), new FrameworkPropertyMetadata(typeof(PUWindow))); } /// /// 初始化一个窗体实例。 /// 若您期望从当前窗体中连续Show出多个窗体,请务必分别指定这些子窗体的Owner,否则将出现显示问题。 /// public PUWindow() { PreviewMouseMove += OnPreviewMouseMove; } #endregion #region Sys public override void OnApplyTemplate() { var auto = Owner; Loaded += delegate { if (AllowAutoCoverMask && (Owner as PUWindow) != null) { (Owner as PUWindow).IsCoverMaskShow = true; } if (AnimateIn) OnBeginLoadStoryboard(); else OnSkipLoadStoryboard(); if (!AllowForcingClose) { DisableAltF4(this); } }; var grdResize = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(this, 0), 1) as Grid; if (grdResize != null) { foreach (Rectangle resizeRectangle in grdResize.Children) { resizeRectangle.PreviewMouseDown += ResizeRectangle_PreviewMouseDown; resizeRectangle.MouseMove += ResizeRectangle_MouseMove; } } var grdNavbar = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(this, 0), 0), 0), 0), 0) as Grid; _stkNav = VisualTreeHelper.GetChild(grdNavbar, 1) as StackPanel; grdNavbar.MouseLeftButtonDown += delegate { this.DragMove(); }; _btnClose = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(grdNavbar, 1), 2) as PUButton; } protected override void OnClosing(CancelEventArgs e) { if(_animateOutHandle) base.OnClosing(e); if (e.Cancel) return; if (AllowAutoCoverMask && (Owner as PUWindow) != null) { var owner = Owner as PUWindow; if (owner.OwnedWindows.Count == 1) { owner.IsCoverMaskShow = false; } else { var closeMask = true; foreach (var window in owner.OwnedWindows) { var puwindow = window as PUWindow; if (puwindow != null) { if (puwindow.AllowAutoCoverMask) { closeMask = true; break; } } } if (closeMask) owner.IsCoverMaskShow = false; } } if (AnimateOut && _animateOutHandle) { if (IsModal(this)) { _dialogResult = DialogResult; _needToSetDialogResult = true; } OnBeginCloseStoryboard(); _animateOutHandle = false; DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.4) }; timer.Tick += delegate { Close(); timer.Stop(); }; timer.Start(); e.Cancel = true; return; } if (AnimateOut) { if (_needToSetDialogResult) { DialogResult = _dialogResult; } } } private void ResizeRectangle_PreviewMouseDown(object sender, MouseButtonEventArgs e) { Rectangle rectangle = sender as Rectangle; if (rectangle != null) { switch (rectangle.Name) { case "Top": Cursor = Cursors.SizeNS; ResizeWindow(ResizeDirection.Top); break; case "Bottom": Cursor = Cursors.SizeNS; ResizeWindow(ResizeDirection.Bottom); break; case "Left": Cursor = Cursors.SizeWE; ResizeWindow(ResizeDirection.Left); break; case "Right": Cursor = Cursors.SizeWE; ResizeWindow(ResizeDirection.Right); break; case "TopLeft": Cursor = Cursors.SizeNWSE; ResizeWindow(ResizeDirection.TopLeft); break; case "TopRight": Cursor = Cursors.SizeNESW; ResizeWindow(ResizeDirection.TopRight); break; case "BottomLeft": Cursor = Cursors.SizeNESW; ResizeWindow(ResizeDirection.BottomLeft); break; case "BottomRight": Cursor = Cursors.SizeNWSE; ResizeWindow(ResizeDirection.BottomRight); break; default: break; } } } private void ResizeWindow(ResizeDirection direction) { SendMessage(_hwndSource.Handle, 0x112, (IntPtr)(61440 + direction), IntPtr.Zero); } protected override void OnInitialized(EventArgs e) { SourceInitialized += MainWindow_SourceInitialized; base.OnInitialized(e); } private void MainWindow_SourceInitialized(object sender, EventArgs e) { _hwndSource = (HwndSource)PresentationSource.FromVisual(this); } protected void OnPreviewMouseMove(object sender, MouseEventArgs e) { if (ResizeMode != ResizeMode.CanResize) return; if (Mouse.LeftButton != MouseButtonState.Pressed) Cursor = Cursors.Arrow; } private void ResizeRectangle_MouseMove(object sender, MouseEventArgs e) { Rectangle rectangle = sender as Rectangle; if (rectangle != null) { switch (rectangle.Name) { case "Top": Cursor = Cursors.SizeNS; break; case "Bottom": Cursor = Cursors.SizeNS; break; case "Left": Cursor = Cursors.SizeWE; break; case "Right": Cursor = Cursors.SizeWE; break; case "TopLeft": Cursor = Cursors.SizeNWSE; break; case "TopRight": Cursor = Cursors.SizeNESW; break; case "BottomLeft": Cursor = Cursors.SizeNESW; break; case "BottomRight": Cursor = Cursors.SizeNWSE; break; default: break; } } } /// /// Alt + F4 无效化处理 /// private static Action DisableAltF4(Window window) { var source = HwndSource.FromHwnd(new WindowInteropHelper(window).Handle); source.AddHook(DisableAltF4WndHookProc); return () => source.RemoveHook(DisableAltF4WndHookProc); } /// /// Alt + F4无效化窗口消息 /// private static IntPtr DisableAltF4WndHookProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { const int WM_SYSKEYDOWN = 0x0104; const int VK_F4 = 0x73; if (msg == WM_SYSKEYDOWN && wParam.ToInt32() == VK_F4) { handled = true; } return IntPtr.Zero; } #endregion #region RoutedEvent /// /// 使用动画打开窗体。 /// internal static readonly RoutedEvent BeginLoadStoryboardEvent = EventManager.RegisterRoutedEvent("BeginLoadStoryboard", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUWindow)); internal event RoutedPropertyChangedEventHandler BeginLoadStoryboard { add { AddHandler(BeginLoadStoryboardEvent, value); } remove { RemoveHandler(BeginLoadStoryboardEvent, value); } } internal void OnBeginLoadStoryboard() { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(null, this, BeginLoadStoryboardEvent); RaiseEvent(arg); } /// /// 不使用动画打开窗体。 /// internal static readonly RoutedEvent SkipLoadStoryboardEvent = EventManager.RegisterRoutedEvent("SkipLoadStoryboard", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUWindow)); internal event RoutedPropertyChangedEventHandler SkipLoadStoryboard { add { AddHandler(SkipLoadStoryboardEvent, value); } remove { RemoveHandler(SkipLoadStoryboardEvent, value); } } internal void OnSkipLoadStoryboard() { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(null, this, SkipLoadStoryboardEvent); RaiseEvent(arg); } /// /// 使用动画关闭窗体。 /// internal static readonly RoutedEvent BeginCloseStoryboardEvent = EventManager.RegisterRoutedEvent("BeginCloseStoryboard", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUWindow)); internal event RoutedPropertyChangedEventHandler BeginCloseStoryboard { add { AddHandler(BeginCloseStoryboardEvent, value); } remove { RemoveHandler(BeginCloseStoryboardEvent, value); } } internal void OnBeginCloseStoryboard() { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(null, this, BeginCloseStoryboardEvent); RaiseEvent(arg); } #endregion #region Property /// /// 获取或设置窗体的返回结果,不会对前端显示造成影响。默认值为Null /// public object Result { get { return (object)GetValue(ResultProperty); } set { SetValue(ResultProperty, value); } } public static readonly DependencyProperty ResultProperty = DependencyProperty.Register("Result", typeof(object), typeof(PUWindow)); /// ///获取或设置是否打开窗体的遮罩层。默认值为False。 /// public bool IsCoverMaskShow { get { return (bool)GetValue(IsCoverMaskShowProperty); } set { SetValue(IsCoverMaskShowProperty, value); } } public static readonly DependencyProperty IsCoverMaskShowProperty = DependencyProperty.Register("IsCoverMaskShow", typeof(bool), typeof(PUWindow)); /// /// 获取或设置是否允许延迟显示内容。当页面内容较为复杂时,启用此选项有助于减少启动动画卡顿。默认值为False。 /// public bool AllowShowDelay { get { return (bool)GetValue(AllowShowDelayProperty); } set { SetValue(AllowShowDelayProperty, value); } } public static readonly DependencyProperty AllowShowDelayProperty = DependencyProperty.Register("AllowShowDelay", typeof(bool), typeof(PUWindow)); /// /// 获取或设置右侧标题栏按钮的显示状态。默认值为Visible。 /// public Visibility NavButtonVisibility { get { return (Visibility)GetValue(NavButtonVisibilityProperty); } set { SetValue(NavButtonVisibilityProperty, value); } } public static readonly DependencyProperty NavButtonVisibilityProperty = DependencyProperty.Register("NavButtonVisibility", typeof(Visibility), typeof(PUWindow), new PropertyMetadata(Visibility.Visible)); /// /// 获取或设置是否在窗体打开时使用动画。默认值为True。 /// public bool AnimateIn { get { return (bool)GetValue(AnimateInProperty); } set { SetValue(AnimateInProperty, value); } } public static readonly DependencyProperty AnimateInProperty = DependencyProperty.Register("AnimateIn", typeof(bool), typeof(PUWindow), new PropertyMetadata(true)); /// /// 获取或设置是否在窗体关闭时使用动画,默认值为True。 /// public bool AnimateOut { get { return (bool)GetValue(AnimateOutProperty); } set { SetValue(AnimateOutProperty, value); } } public static readonly DependencyProperty AnimateOutProperty = DependencyProperty.Register("AnimateOut", typeof(bool), typeof(PUWindow), new PropertyMetadata(true)); /// /// 获取或设置窗体动画类型。默认值为Gradual(一个从上到下的渐变显示)。 /// public AnimationStyles AnimationStyle { get { return (AnimationStyles)GetValue(AnimationStyleProperty); } set { SetValue(AnimationStyleProperty, value); } } public static readonly DependencyProperty AnimationStyleProperty = DependencyProperty.Register("AnimationStyle", typeof(AnimationStyles), typeof(PUWindow), new PropertyMetadata(AnimationStyles.Scale)); /// /// 获取或设置窗体的圆角大小,默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUWindow)); /// /// 左上角标题,默认值为null。 /// 当该属性为null时,将采用Title属性来填充左上角标题。 /// public object Header { get { return (object)GetValue(HeaderProperty); } set { SetValue(HeaderProperty, value); } } public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register("Header", typeof(object), typeof(PUWindow)); /// /// 左上角图标,默认值为null。 /// public new object Icon { get { return (object)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } public new static readonly DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(object), typeof(PUWindow)); /// /// 控制栏背景色,默认值为White(白色)。 /// public Brush NavbarBackground { get { return (Brush)GetValue(NavbarBackgroundProperty); } set { SetValue(NavbarBackgroundProperty, value); } } public static readonly DependencyProperty NavbarBackgroundProperty = DependencyProperty.Register("NavbarBackground", typeof(Brush), typeof(PUWindow)); /// /// 控制栏高度,默认值为30。 /// public double NavbarHeight { get { return (double)GetValue(NavbarHeightProperty); } set { SetValue(NavbarHeightProperty, value); } } public static readonly DependencyProperty NavbarHeightProperty = DependencyProperty.Register("NavbarHeight", typeof(double), typeof(PUWindow)); /// /// 控制按钮高度,默认值为30。 /// public double NavButtonHeight { get { return (double)GetValue(NavButtonHeightProperty); } set { SetValue(NavButtonHeightProperty, value); } } public static readonly DependencyProperty NavButtonHeightProperty = DependencyProperty.Register("NavButtonHeight", typeof(double), typeof(PUWindow)); /// /// 控制按钮宽度,默认值为40。 /// public double NavButtonWidth { get { return (double)GetValue(NavButtonWidthProperty); } set { SetValue(NavButtonWidthProperty, value); } } public static readonly DependencyProperty NavButtonWidthProperty = DependencyProperty.Register("NavButtonWidth", typeof(double), typeof(PUWindow)); /// /// 是否打开遮罩层并显示等待控件。 /// public bool IsAwaitShow { get { return (bool)GetValue(IsAwaitShowProperty); } set { SetValue(IsAwaitShowProperty, value); } } public static readonly DependencyProperty IsAwaitShowProperty = DependencyProperty.Register("IsAwaitShow", typeof(bool), typeof(PUWindow)); /// /// 获取或设置是否允许在调用Show或ShowDialog方法时自动打开父窗体的遮罩层,并在Close时将其关闭。 /// 若没有父窗体或父窗体不是PUWindow类型,则不会触发任何效果。 /// public bool AllowAutoCoverMask { get { return (bool)GetValue(AllowAutoCoverMaskProperty); } set { SetValue(AllowAutoCoverMaskProperty, value); } } public static readonly DependencyProperty AllowAutoCoverMaskProperty = DependencyProperty.Register("AllowAutoCoverMask", typeof(bool), typeof(PUWindow), new PropertyMetadata(false)); /// /// 获取或设置是否允许用户使用Alt + F4按键组合强制关闭窗体。该属性在窗体加载后的更改将无效。默认值为True(允许)。 /// public bool AllowForcingClose { get { return (bool)GetValue(AllowForcingCloseProperty); } set { SetValue(AllowForcingCloseProperty, value); } } public static readonly DependencyProperty AllowForcingCloseProperty = DependencyProperty.Register("AllowForcingClose", typeof(bool), typeof(PUWindow), new PropertyMetadata(true)); /// /// 获取或设置是否允许自动将当前的活动窗口设置为自己的Owner。默认值为True。 /// public bool AllowAutoOwner { get { return (bool)GetValue(AllowAutoOwnerProperty); } set { SetValue(AllowAutoOwnerProperty, value); } } public static readonly DependencyProperty AllowAutoOwnerProperty = DependencyProperty.Register("AllowAutoOwner", typeof(bool), typeof(PUWindow), new PropertyMetadata(false, OnAllowAutoOwnerChanged)); private static void OnAllowAutoOwnerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var window = d as PUWindow; if (window.AllowAutoOwner == true) { try { window.Owner = GetOwnerWindow(); } catch (Exception ex) { } } } #endregion #region Internal APIs #endregion #region Command /// /// 关闭命令 /// public ICommand CloseCommand { get { return _closeCommad; } } private ICommand _closeCommad = new CloseWindowCommand(); /// /// 最大化命令 /// public ICommand MaxCommand { get { return _maxCommand; } } private ICommand _maxCommand = new MaxWindowCommand(); /// /// 最小化命令 /// public ICommand MinCommand { get { return _minCommand; } } private ICommand _minCommand = new MinWindowCommand(); #endregion #region APIs /// /// 向控制栏的左侧添加一个新的按钮。 /// 警告:当Window的前景色发生改变时,该按钮的前景色不会随之变化。 /// /// 按钮的内容 /// 点击按钮时应该触发的事件。 public void AppendNavButton(object content, RoutedEventHandler clickHandler, bool isIconFont = true, object tooltip = null) { var btn = new PUButton() { Content = content, ButtonStyle = ButtonStyles.Hollow, Foreground = Foreground, BorderBrush = new SolidColorBrush(Colors.Transparent), CoverBrush = new SolidColorBrush(((Color)ColorConverter.ConvertFromString("#99999999"))), HorizontalAlignment = HorizontalAlignment.Right, }; if (isIconFont) btn.FontFamily = FindResource("IconFont") as FontFamily; if (tooltip != null) btn.ToolTip = tooltip; var visibility = new Binding() { Path = new PropertyPath("NavButtonVisibility"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this, Mode = BindingMode.OneWay }; BindingOperations.SetBinding(btn, VisibilityProperty, visibility); var width = new Binding() { Path = new PropertyPath("NavButtonWidth"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this, Mode = BindingMode.OneWay }; BindingOperations.SetBinding(btn, WidthProperty, width); var height = new Binding() { Path = new PropertyPath("NavButtonHeight"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this, Mode = BindingMode.OneWay }; BindingOperations.SetBinding(btn, HeightProperty, height); var fontsize = new Binding() { Path = new PropertyPath("FontSize"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this, Mode = BindingMode.OneWay }; BindingOperations.SetBinding(btn, FontSizeProperty, fontsize); btn.Click += clickHandler; if (IsLoaded) _stkNav.Children.Insert(0, btn); else { Loaded += delegate { _stkNav.Children.Insert(0, btn); }; } } #endregion #region Function private static bool IsModal(Window window) { return (bool)typeof(Window).GetField("_showingAsDialog", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(window); } private static PUWindow GetWindowFromHwnd(IntPtr hwnd) { var visual = HwndSource.FromHwnd(hwnd).RootVisual; return visual as PUWindow; } private static PUWindow GetOwnerWindow() { var hwnd = GetForegroundWindow(); if (hwnd == null) return null; return GetWindowFromHwnd(hwnd); } #endregion } internal class CloseWindowCommand : ICommand { event EventHandler ICommand.CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return true; } public void Execute(object parameter) { var window = (parameter as PUWindow); window.Close(); } } internal class MaxWindowCommand : ICommand { event EventHandler ICommand.CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return true; } public void Execute(object parameter) { var window = (parameter as PUWindow); if (window.WindowState == WindowState.Maximized) window.WindowState = WindowState.Normal; else window.WindowState = WindowState.Maximized; } } internal class MinWindowCommand : ICommand { event EventHandler ICommand.CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return true; } public void Execute(object parameter) { (parameter as PUWindow).WindowState = WindowState.Minimized; } } } ================================================ FILE: Panuon.UI/2_Button/PUButton.cs ================================================ using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUButton : Button { static PUButton() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUButton), new FrameworkPropertyMetadata(typeof(PUButton))); } #region Property /// /// 效果等同于Tag,无实际作用。 /// public object Value { get { return (object)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(PUButton)); /// /// 获取或设置按钮的基本样式。默认值为标准样式(General)。 /// public ButtonStyles ButtonStyle { get { return (ButtonStyles)GetValue(ButtonStyleProperty); } set { SetValue(ButtonStyleProperty, value); } } public static readonly DependencyProperty ButtonStyleProperty = DependencyProperty.Register("ButtonStyle", typeof(ButtonStyles), typeof(PUButton), new PropertyMetadata(ButtonStyles.General)); /// /// 获取或设置鼠标点击时按钮的效果。默认为无特殊效果(Classic)。 /// public ClickStyles ClickStyle { get { return (ClickStyles)GetValue(ClickStyleProperty); } set { SetValue(ClickStyleProperty, value); } } public static readonly DependencyProperty ClickStyleProperty = DependencyProperty.Register("ClickStyle", typeof(ClickStyles), typeof(PUButton), new PropertyMetadata(ClickStyles.Classic)); /// /// 获取或设置按钮的圆角大小。默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUButton)); /// /// 获取或设置鼠标悬浮时遮罩层的背景颜色(在Outline和Link样式下为前景色),默认值为#26FFFFFF(在Hollow、Outline和Link样式下为灰黑色)。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUButton)); #endregion } } ================================================ FILE: Panuon.UI/2_Button/PURepeatButton.cs ================================================ using System.Windows; using System.Windows.Controls.Primitives; using System.Windows.Media; namespace Panuon.UI { public class PURepeatButton : RepeatButton { static PURepeatButton() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PURepeatButton), new FrameworkPropertyMetadata(typeof(PURepeatButton))); } #region Property /// /// 获取或设置按钮的基本样式。默认值为标准样式(General)。 /// public RepeatButtonStyles RepeatButtonStyle { get { return (RepeatButtonStyles)GetValue(RepeatButtonStyleProperty); } set { SetValue(RepeatButtonStyleProperty, value); } } public static readonly DependencyProperty RepeatButtonStyleProperty = DependencyProperty.Register("RepeatButtonStyle", typeof(RepeatButtonStyles), typeof(PURepeatButton), new PropertyMetadata(RepeatButtonStyles.General)); /// /// 获取或设置鼠标点击时按钮的效果。默认为无效果(Classic)。 /// public ClickStyles ClickStyle { get { return (ClickStyles)GetValue(ClickStyleProperty); } set { SetValue(ClickStyleProperty, value); } } public static readonly DependencyProperty ClickStyleProperty = DependencyProperty.Register("ClickStyle", typeof(ClickStyles), typeof(PURepeatButton), new PropertyMetadata(ClickStyles.Classic)); /// /// 圆角大小,默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PURepeatButton), new PropertyMetadata(new CornerRadius(0))); /// /// 鼠标悬浮时遮罩层的背景颜色(在Outline和Link样式下为前景色),默认值为白色(在Outline和Link样式下为灰色)。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PURepeatButton), new PropertyMetadata(new SolidColorBrush(Colors.White))); #endregion } } ================================================ FILE: Panuon.UI/3_TextBox/PUTextBox.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUTextBox : TextBox { static PUTextBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUTextBox), new FrameworkPropertyMetadata(typeof(PUTextBox))); } #region Sys public override void OnApplyTemplate() { base.OnApplyTemplate(); AddHandler(PUButton.ClickEvent, new RoutedEventHandler(OnClearButtonClick)); ScrollViewer scrollViewer = new ScrollViewer(); if (TextBoxStyle == TextBoxStyles.General) { scrollViewer = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(this, 0), 1), 0), 0) as ScrollViewer; } else if (TextBoxStyle == TextBoxStyles.IconGroup) { scrollViewer = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(this, 0), 1), 0), 1), 0) as ScrollViewer; } if(scrollViewer != null) scrollViewer.MouseWheel += ScrollViewer_MouseWheel; PreviewKeyDown += PUTextBox_PreviewKeyDown; } private void PUTextBox_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (TextType == TextTypes.Text) return; else { switch (e.Key) { case System.Windows.Input.Key.D0: case System.Windows.Input.Key.D1: case System.Windows.Input.Key.D2: case System.Windows.Input.Key.D3: case System.Windows.Input.Key.D4: case System.Windows.Input.Key.D5: case System.Windows.Input.Key.D6: case System.Windows.Input.Key.D7: case System.Windows.Input.Key.D8: case System.Windows.Input.Key.D9: case System.Windows.Input.Key.NumPad0: case System.Windows.Input.Key.NumPad1: case System.Windows.Input.Key.NumPad2: case System.Windows.Input.Key.NumPad3: case System.Windows.Input.Key.NumPad4: case System.Windows.Input.Key.NumPad5: case System.Windows.Input.Key.NumPad6: case System.Windows.Input.Key.NumPad7: case System.Windows.Input.Key.NumPad8: case System.Windows.Input.Key.NumPad9: case System.Windows.Input.Key.Enter: case System.Windows.Input.Key.Back: case System.Windows.Input.Key.Delete: case System.Windows.Input.Key.Left: case System.Windows.Input.Key.Right: case System.Windows.Input.Key.Up: case System.Windows.Input.Key.Down: case System.Windows.Input.Key.Home: case System.Windows.Input.Key.End: case System.Windows.Input.Key.Tab: break; case System.Windows.Input.Key.OemPeriod: if (TextType != TextTypes.Decimal) e.Handled = true; break; default: e.Handled = true; break; } } } private void OnClearButtonClick(object sender, RoutedEventArgs e) { var btnClear = e.OriginalSource as PUButton; if (btnClear.Tag == null || btnClear.Tag.ToString() != "Clear") return; Text = ""; } private void ScrollViewer_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e) { var scrollViewer = sender as ScrollViewer; if (e.Delta > 0) if (scrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Visible) scrollViewer.LineUp(); else if (scrollViewer.ComputedHorizontalScrollBarVisibility == Visibility.Visible) scrollViewer.LineLeft(); else return; else if (scrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Visible) scrollViewer.LineDown(); else if (scrollViewer.ComputedHorizontalScrollBarVisibility == Visibility.Visible) scrollViewer.LineRight(); else return; if (scrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Visible || scrollViewer.ComputedHorizontalScrollBarVisibility == Visibility.Visible) e.Handled = true; } #endregion #region Property /// /// 获取或设置文本框的基本样式。默认值为General。 /// public TextBoxStyles TextBoxStyle { get { return (TextBoxStyles)GetValue(TextBoxStyleProperty); } set { SetValue(TextBoxStyleProperty, value); } } public static readonly DependencyProperty TextBoxStyleProperty = DependencyProperty.Register("TextBoxStyle", typeof(TextBoxStyles), typeof(PUTextBox), new PropertyMetadata(TextBoxStyles.General)); /// /// 获取或设置文本框的圆角大小,默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUTextBox)); /// /// 获取或设置输入框获得焦点时阴影的颜色,默认值为#66888888。 /// public Color ShadowColor { get { return (Color)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("ShadowColor", typeof(Color), typeof(PUTextBox)); /// /// 获取或设置水印内容。默认值为空。 /// public string Watermark { get { return (string)GetValue(WatermarkProperty); } set { SetValue(WatermarkProperty, value); } } public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register("Watermark", typeof(string), typeof(PUTextBox)); /// /// 获取或设置i放置在输入框前的图标。 /// 仅当输入框样式为IconGroup时有效。 /// public object Icon { get { return (object)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } public static readonly DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(object), typeof(PUTextBox)); /// /// 获取或设置图标的宽度,默认值为30。 /// 仅当输入框样式为IconGroup时有效。 /// public double IconWidth { get { return (double)GetValue(IconWidthProperty); } set { SetValue(IconWidthProperty, value); } } public static readonly DependencyProperty IconWidthProperty = DependencyProperty.Register("IconWidth", typeof(double), typeof(PUTextBox), new PropertyMetadata((double)30)); /// /// 获取或设置当鼠标悬浮时是否显示清除按钮。默认值为False。 /// public bool IsClearButtonShow { get { return (bool)GetValue(IsClearButtonShowProperty); } set { SetValue(IsClearButtonShowProperty, value); } } public static readonly DependencyProperty IsClearButtonShowProperty = DependencyProperty.Register("IsClearButtonShow", typeof(bool), typeof(PUTextBox)); /// /// 获取或设置允许键入的类型。默认值为Text(全部内容)。 /// public TextTypes TextType { get { return (TextTypes)GetValue(TextTypeProperty); } set { SetValue(TextTypeProperty, value); } } public static readonly DependencyProperty TextTypeProperty = DependencyProperty.Register("TextType", typeof(TextTypes), typeof(PUTextBox), new PropertyMetadata(TextTypes.Text, OnTextTypeChanged)); private static void OnTextTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var textBox = d as PUTextBox; if(textBox.TextType == TextTypes.Text) { System.Windows.Input.InputMethod.SetIsInputMethodEnabled(textBox, true); } else { System.Windows.Input.InputMethod.SetIsInputMethodEnabled(textBox, false); } } #endregion } } ================================================ FILE: Panuon.UI/4_PasswordBox/PUPasswordBox.cs ================================================ using System; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Media; namespace Panuon.UI { [ContentProperty(nameof(Password))] public class PUPasswordBox : TextBox { /*严重警告: *PasswordBox是一个密封类,因此控件无法直接从PasswordBox派生。 *该控件继承自TextBox,因此无法保证在装有恶意软件的计算机上的密码安全(恶意软件可以通过内存读取密码)。 *如果对密码安全有较高的需求,切勿使用此控件。*/ static PUPasswordBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUPasswordBox), new FrameworkPropertyMetadata(typeof(PUPasswordBox))); } public override void OnApplyTemplate() { base.OnApplyTemplate(); AcceptsReturn = false; PUButton btnShowPwd; if(PasswordBoxStyle == PasswordBoxStyles.General) btnShowPwd = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(this, 0), 1), 0), 2) as PUButton; else btnShowPwd = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(this, 0), 1), 0), 1), 2) as PUButton; btnShowPwd.PreviewMouseLeftButtonDown += BtnShowPwd_MouseLeftButtonDown; btnShowPwd.PreviewMouseLeftButtonUp += BtnShowPwd_MouseLeftButtonUp; ContextMenu = null; Text = ""; if (Password != null && Password != "") for (int i = 0; i < Password.Length; i++) Text += PasswordChar; PreviewTextInput += PUPasswordBox_TextInput; PreviewKeyDown += PUPasswordBox_PreviewKeyDown; } private void BtnShowPwd_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Text = ""; for (int i = 0; i < Password.Length; i++) Text += PasswordChar; } private void BtnShowPwd_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Text = Password; } #region Sys private void PUPasswordBox_TextInput(object sender, TextCompositionEventArgs e) { Password = Password ?? ""; if ((MaxLength != 0 && Password.Length >= MaxLength) && SelectionLength == 0) { e.Handled = true; return; } if (e.Text == "\n" || e.Text == "\r" || e.Text == "\t") return; var currentCursor = SelectionStart; if (SelectionLength != 0) { var length = SelectionLength; Password = Password.Remove(currentCursor, length); } Password = Password.Insert(currentCursor, e.Text); Select(currentCursor + 1, 0); e.Handled = true; } private void PUPasswordBox_PreviewKeyDown(object sender, KeyEventArgs e) { //禁止任何与Control键有关的事(除了全选) if ((Keyboard.IsKeyDown(Key.LeftCtrl) && !Keyboard.IsKeyDown(Key.A))) { e.Handled = true; return; } if (e.Key == Key.Enter) return; var currentCursor = SelectionStart; switch (e.Key) { case Key.Back: if (Text.Length > 0 && currentCursor > 0 && SelectionLength == 0) { Password = Password.Remove(currentCursor - 1, 1); if (currentCursor > 0) Select(currentCursor - 1, 0); } else if (SelectionLength > 0) { var length = SelectionLength; Password = Password.Remove(currentCursor, length); Select(currentCursor, 0); } //批量选择情况下 break; case Key.Delete: if (currentCursor < Text.Length) { Password = Password.Remove(currentCursor, 1); Select(currentCursor, 0); } break; case Key.Space: if (SelectionLength != 0) { Password = Password.Remove(currentCursor, SelectionLength); } Password = Password.Insert(currentCursor, " "); Select(currentCursor + 1, 0); break; default: return; } e.Handled = true; } #endregion #region RoutedEvent /// /// 密码改变事件。 /// public static readonly RoutedEvent PasswordChangedEvent = EventManager.RegisterRoutedEvent("PasswordChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUPasswordBox)); public event RoutedPropertyChangedEventHandler PasswordChanged { add { AddHandler(PasswordChangedEvent, value); } remove { RemoveHandler(PasswordChangedEvent, value); } } #endregion #region Property [Obsolete("不能对密码框的Text属性赋值。")] public new string Text { get { return base.Text; } private set { base.Text = value; } } /// /// 密码属性 /// public string Password { get { return (string)GetValue(PasswordProperty); } set { SetValue(PasswordProperty, value); } } public static readonly DependencyProperty PasswordProperty = DependencyProperty.Register("Password", typeof(string), typeof(PUPasswordBox), new PropertyMetadata("", OnPasswordChanged)); private static void OnPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var pb = d as PUPasswordBox; var val = (string)e.NewValue; pb.Text = ""; if (pb.Password != null && pb.Password != "") for (int i = 0; i < pb.Password.Length; i++) pb.Text += pb.PasswordChar; RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(val, pb.Password, PasswordChangedEvent); pb.RaiseEvent(arg); } /// /// 密码掩饰字符,默认值为●。 /// public char PasswordChar { get { return (char)GetValue(PasswordCharProperty); } set { SetValue(PasswordCharProperty, value); } } public static readonly DependencyProperty PasswordCharProperty = DependencyProperty.Register("PasswordChar", typeof(char), typeof(PUPasswordBox), new PropertyMetadata('●')); /// /// 密码框样式,默认值为General。 /// public PasswordBoxStyles PasswordBoxStyle { get { return (PasswordBoxStyles)GetValue(PasswordBoxStyleProperty); } set { SetValue(PasswordBoxStyleProperty, value); } } public static readonly DependencyProperty PasswordBoxStyleProperty = DependencyProperty.Register("PasswordBoxStyle", typeof(PasswordBoxStyles), typeof(PUPasswordBox), new PropertyMetadata(PasswordBoxStyles.General)); /// /// 圆角大小,默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUPasswordBox), new PropertyMetadata(new CornerRadius(0))); /// /// 密码框激活时阴影的颜色,默认值为#888888。 /// public Color ShadowColor { get { return (Color)GetValue(ShadowColorProperty); } set { SetValue(ShadowColorProperty, value); } } public static readonly DependencyProperty ShadowColorProperty = DependencyProperty.Register("ShadowColor", typeof(Color), typeof(PUPasswordBox), new PropertyMetadata((Color)ColorConverter.ConvertFromString("#888888"))); /// /// 水印内容,默认值为空。 /// public string Watermark { get { return (string)GetValue(WatermarkProperty); } set { SetValue(WatermarkProperty, value); } } public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register("Watermark", typeof(string), typeof(PUPasswordBox)); /// /// 放置在密码框前的图标。 /// 仅当密码框样式为IconGroup时有效。 /// public object Icon { get { return (object)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } public static readonly DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(object), typeof(PUPasswordBox)); /// /// 图标的宽度,默认值为30。 /// 仅当密码框样式为IconGroup时有效。 /// public double IconWidth { get { return (double)GetValue(IconWidthProperty); } set { SetValue(IconWidthProperty, value); } } public static readonly DependencyProperty IconWidthProperty = DependencyProperty.Register("IconWidth", typeof(double), typeof(PUPasswordBox), new PropertyMetadata((double)30)); /// /// 获取或设置当鼠标悬浮时是否显示 显示密码 按钮。默认值为False。 /// public bool IsShowPwdButtonShow { get { return (bool)GetValue(IsShowPwdButtonShowProperty); } set { SetValue(IsShowPwdButtonShowProperty, value); } } public static readonly DependencyProperty IsShowPwdButtonShowProperty = DependencyProperty.Register("IsShowPwdButtonShow", typeof(bool), typeof(PUPasswordBox)); #endregion } } ================================================ FILE: Panuon.UI/5_ComboBox/PUComboBox.cs ================================================ using Panuon.UI.Utils; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUComboBox : ComboBox { static PUComboBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUComboBox), new FrameworkPropertyMetadata(typeof(PUComboBox))); } public override void OnApplyTemplate() { base.OnApplyTemplate(); if (SearchMode == SearchModes.TextChanged) { AddHandler(PUTextBox.TextChangedEvent, new RoutedEventHandler(OnSearchTextChanged)); SearchBoxVisibility = Visibility.Visible; } else if (SearchMode == SearchModes.Enter) { AddHandler(PUTextBox.PreviewKeyDownEvent, new RoutedEventHandler(OnSearchKeyDown)); SearchBoxVisibility = Visibility.Visible; } else { SearchBoxVisibility = Visibility.Collapsed; } } protected override void OnSelectionChanged(SelectionChangedEventArgs e) { if (SelectedValuePath == SelectedValuePaths.Header) SelectedValue = SelectedItem == null ? "" : (SelectedItem as PUComboBoxItem).Content; else SelectedValue = SelectedItem == null ? null : (SelectedItem as PUComboBoxItem).Value; base.OnSelectionChanged(e); } private void OnSearchKeyDown(object sender, RoutedEventArgs e) { var eve = e as System.Windows.Input.KeyEventArgs; if (eve.Key != System.Windows.Input.Key.Enter) return; var tbSearch = e.OriginalSource as PUTextBox; if (tbSearch == null || tbSearch.Tag == null || tbSearch.Tag.ToString() != "Search") return; var text = tbSearch.Text; foreach (var item in Items) { var comboItem = item as ComboBoxItem; if (comboItem.Content.ToString().Contains(text)) comboItem.Visibility = Visibility.Visible; else comboItem.Visibility = Visibility.Collapsed; } e.Handled = true; } private void OnSearchTextChanged(object sender, RoutedEventArgs e) { var tbSearch = e.OriginalSource as PUTextBox; if (tbSearch == null || tbSearch.Tag == null || tbSearch.Tag.ToString() != "Search") return; var text = tbSearch.Text; foreach (var item in Items) { var comboItem = item as ComboBoxItem; if (comboItem.Content.ToString().Contains(text)) comboItem.Visibility = Visibility.Visible; else comboItem.Visibility = Visibility.Collapsed; } } #region RoutedEvent /// /// 用户点击删除按钮事件。 /// public static readonly RoutedEvent DeleteItemEvent = EventManager.RegisterRoutedEvent("DeleteItem", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUComboBox)); public event RoutedPropertyChangedEventHandler DeleteItem { add { AddHandler(DeleteItemEvent, value); } remove { RemoveHandler(DeleteItemEvent, value); } } internal void OnDeleteItem(PUComboBoxItem oldItem, PUComboBoxItem newItem) { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(oldItem, newItem, DeleteItemEvent); RaiseEvent(arg); } #endregion #region Property [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("该属性对此控件无效。请使用BindingItems属性替代。", true)] public new IEnumerable ItemsSource { get { return base.ItemsSource; } private set { base.ItemsSource = value; } } [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("该属性对此控件无效。BindingItems属性中的Header属性即为要显示的内容。", true)] public new string DisplayMemberPath { get { return base.DisplayMemberPath; } private set { base.DisplayMemberPath = value; } } /// /// 获取或设置鼠标悬浮时子项的背景颜色。默认值为浅灰色(#EEEEEE)。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUComboBox), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#EEEEEE")))); /// /// 获取或设置子项被选中时的背景颜色。默认值为浅灰色(#DDDDDD)。 /// public Brush SelectedBrush { get { return (Brush)GetValue(SelectedBrushProperty); } set { SetValue(SelectedBrushProperty, value); } } // Using a DependencyProperty as the backing store for SelectedBrush. This enables animation, styling, binding, etc... public static readonly DependencyProperty SelectedBrushProperty = DependencyProperty.Register("SelectedBrush", typeof(Brush), typeof(PUComboBox), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#DDDDDD")))); /// /// 获取或设置显示框和下拉框的圆角大小。默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUComboBox), new PropertyMetadata(new CornerRadius(0))); /// /// 获取或设置下拉框激活时阴影的颜色,默认值为#888888。 /// public Color ShadowColor { get { return (Color)GetValue(ShadowColorProperty); } set { SetValue(ShadowColorProperty, value); } } public static readonly DependencyProperty ShadowColorProperty = DependencyProperty.Register("ShadowColor", typeof(Color), typeof(PUComboBox), new PropertyMetadata((Color)ColorConverter.ConvertFromString("#888888"))); /// /// 获取或设置当子项目可删除时,用户点击删除按钮后的操作。默认为删除项目并触发DeleteItem路由事件。 /// public DeleteModes DeleteMode { get { return (DeleteModes)GetValue(DeleteModeProperty); } set { SetValue(DeleteModeProperty, value); } } public static readonly DependencyProperty DeleteModeProperty = DependencyProperty.Register("DeleteMode", typeof(DeleteModes), typeof(PUComboBox), new PropertyMetadata(DeleteModes.Delete)); /// /// 若使用MVVM绑定,请使用此依赖属性。 /// public ObservableCollection BindingItems { get { return (ObservableCollection)GetValue(BindingItemsProperty); } set { SetValue(BindingItemsProperty, value); } } public static readonly DependencyProperty BindingItemsProperty = DependencyProperty.Register("BindingItems", typeof(ObservableCollection), typeof(PUComboBox), new PropertyMetadata(null, OnBindingItemsChanged)); private static void OnBindingItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var comboBox = d as PUComboBox; if (comboBox.BindingItems != null) { comboBox.BindingItems.CollectionChanged -= comboBox.BindingItemChanged; comboBox.BindingItems.CollectionChanged += comboBox.BindingItemChanged; } comboBox.GenerateBindindItems(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } private void BindingItemChanged(object sender, NotifyCollectionChangedEventArgs e) { GenerateBindindItems(e); } /// /// 获取或设置当子项目被选中时,SelectedValue应呈现子项目的哪一个值。(在ComboBox中,Header属性表示展现子项的Content属性) /// 可选项为Header或Value,默认值为Header。 /// public new SelectedValuePaths SelectedValuePath { get { return (SelectedValuePaths)GetValue(SelectedValuePathProperty); } set { SetValue(SelectedValuePathProperty, value); } } public new static readonly DependencyProperty SelectedValuePathProperty = DependencyProperty.Register("SelectedValuePath", typeof(SelectedValuePaths), typeof(PUComboBox), new PropertyMetadata(SelectedValuePaths.Header)); /// /// 获取被选中PUComboBoxItem的Header或Value属性(这取决于SelectedValuePath), /// 或根据设置的SelectedValue来选中子项目。 /// public new object SelectedValue { get { return (object)GetValue(SelectedValueProperty); } set { SetValue(SelectedValueProperty, value); } } public new static readonly DependencyProperty SelectedValueProperty = DependencyProperty.Register("SelectedValue", typeof(object), typeof(PUComboBox), new PropertyMetadata("", OnSelectedValueChanged)); private static void OnSelectedValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var comboBox = d as PUComboBox; if (comboBox.SelectedValue == null) { return; } if (e.NewValue.Equals(e.OldValue)) return; var selectedItem = comboBox.SelectedItem as PUComboBoxItem; foreach (var item in comboBox.Items) { var comboBoxItem = item as PUComboBoxItem; if ((comboBox.SelectedValuePath == SelectedValuePaths.Header ? (comboBoxItem.Content == null ? false : comboBoxItem.Content.Equals(comboBox.SelectedValue)) : (comboBoxItem.Value == null ? false : comboBoxItem.Value.Equals(comboBox.SelectedValue)))) { if (!comboBoxItem.IsSelected) comboBoxItem.IsSelected = true; return; } } } /// /// 获取或设置搜索模式。默认为不显示搜索。 /// public SearchModes SearchMode { get { return (SearchModes)GetValue(SearchModeProperty); } set { SetValue(SearchModeProperty, value); } } public static readonly DependencyProperty SearchModeProperty = DependencyProperty.Register("SearchMode", typeof(SearchModes), typeof(PUComboBox), new PropertyMetadata(SearchModes.None, OnSearchModeChanged)); private static void OnSearchModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var comboBox = d as PUComboBox; if (comboBox.IsLoaded) { comboBox.RemoveHandler(PUTextBox.TextChangedEvent, new RoutedEventHandler(comboBox.OnSearchTextChanged)); comboBox.RemoveHandler(PUTextBox.KeyDownEvent, new RoutedEventHandler(comboBox.OnSearchKeyDown)); if (comboBox.SearchMode == SearchModes.TextChanged) { comboBox.AddHandler(PUTextBox.TextChangedEvent, new RoutedEventHandler(comboBox.OnSearchTextChanged)); comboBox.SearchBoxVisibility = Visibility.Visible; } else if (comboBox.SearchMode == SearchModes.Enter) { comboBox.AddHandler(PUTextBox.PreviewKeyDownEvent, new RoutedEventHandler(comboBox.OnSearchKeyDown)); comboBox.SearchBoxVisibility = Visibility.Visible; } else { comboBox.SearchBoxVisibility = Visibility.Collapsed; } } } #endregion #region Internal Property internal Visibility SearchBoxVisibility { get { return (Visibility)GetValue(SearchBoxVisibilityProperty); } set { SetValue(SearchBoxVisibilityProperty, value); } } internal static readonly DependencyProperty SearchBoxVisibilityProperty = DependencyProperty.Register("SearchBoxVisibility", typeof(Visibility), typeof(PUComboBox), new PropertyMetadata(Visibility.Collapsed)); #endregion #region APIs /// /// 通过内容选中项目。 /// 若content不是值类型,则将逐一比较其中各个属性的值是否相等。 /// /// 要匹配的内容。 public void SelectItemByContent(object content) { var comboItem = GetItemByContent(content); if (comboItem != null) comboItem.IsSelected = true; } /// /// 通过Value选中项目。 /// 若value不是值类型,则将逐一比较其中各个属性的值是否相等。 /// /// 要匹配的value。 public void SelectItemByValue(object value) { var comboItem = GetItemByValue(value); if (comboItem != null) comboItem.IsSelected = true; } #endregion #region Function private void GenerateBindindItems(NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Reset: var value = SelectedValue; SelectedValue = null; Items.Clear(); if (BindingItems == null) break; foreach (var item in BindingItems) { var comboBoxItem = GenerateComboBoxItem(item); Items.Add(comboBoxItem); } SelectedValue = value; break; case NotifyCollectionChangedAction.Add: foreach (var item in e.NewItems) { var comboBoxItem = GenerateComboBoxItem(item as PUComboBoxItemModel); Items.Insert(e.NewStartingIndex, comboBoxItem); } break; case NotifyCollectionChangedAction.Remove: foreach (var item in e.OldItems) { Items.RemoveAt(e.OldStartingIndex); } break; case NotifyCollectionChangedAction.Replace: foreach (var item in e.NewItems) { var comboBoxItem = GenerateComboBoxItem(item as PUComboBoxItemModel); Items[e.OldStartingIndex] = comboBoxItem; } break; case NotifyCollectionChangedAction.Move: { var tabItem = Items[e.OldStartingIndex]; Items.RemoveAt(e.OldStartingIndex); Items.Insert(e.NewStartingIndex, tabItem); } break; } if (SelectedValue != null) { if (SelectedValuePath == SelectedValuePaths.Header) SelectItemByContent(SelectedValue); else SelectItemByValue(SelectedValue); } } private PUComboBoxItem GenerateComboBoxItem(PUComboBoxItemModel model) { var comboBoxItem = new PUComboBoxItem() { Uid = model.Uid, Content = model.Header, Value = model.Value, CanDelete = model.CanDelete, }; model.PropertyChanged += delegate { comboBoxItem.Content = model.Header; comboBoxItem.Value = model.Value; comboBoxItem.CanDelete = model.CanDelete; }; return comboBoxItem; } private PUComboBoxItem GetItemByContent(object content) { foreach (var item in Items) { var comboItem = item as PUComboBoxItem; if (comboItem == null) throw new Exception("PUComboBox的子项必须是PUComboBoxItem。"); if (comboItem.Content.IsEqual(content)) return comboItem; } return null; } private PUComboBoxItem GetItemByValue(object value) { foreach (var item in Items) { var comboItem = item as PUComboBoxItem; if (comboItem == null) throw new Exception("PUComboBox的子项必须是PUComboBoxItem。"); if (comboItem.Value.IsEqual(value)) return comboItem; } return null; } #endregion } } ================================================ FILE: Panuon.UI/5_ComboBox/PUComboBoxItem.cs ================================================ using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace Panuon.UI { public class PUComboBoxItem : ComboBoxItem { public PUComboBoxItem() { } static PUComboBoxItem() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUComboBoxItem), new FrameworkPropertyMetadata(typeof(PUComboBoxItem))); } #region Property /// /// 获取或设置是否显示删除按钮,默认值为False(不显示)。 /// public bool CanDelete { get { return (bool)GetValue(CanDeleteProperty); } set { SetValue(CanDeleteProperty, value); } } public static readonly DependencyProperty CanDeleteProperty = DependencyProperty.Register("CanDelete", typeof(bool), typeof(PUComboBoxItem)); /// /// 获取或设置用以标记该项目的值。默认值为Null。 /// public object Value { get { return (object)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(PUComboBoxItem)); #endregion public ICommand DeleteCommand { get { return _deleteCommand; } } private ICommand _deleteCommand = new PUComboBoxDeleteCommand(); } internal sealed class PUComboBoxDeleteCommand : ICommand { event EventHandler ICommand.CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return true; } public void Execute(object parameter) { var comItem = (parameter as PUComboBoxItem); var combox = comItem.Parent as PUComboBox; if (combox.DeleteMode == DeleteModes.Delete) { if (combox.BindingItems != null && !String.IsNullOrEmpty((comItem.Uid))) { var model = combox.BindingItems.FirstOrDefault(x => x.Uid == comItem.Uid); if (model != null) combox.BindingItems.Remove(model); else combox.Items.Remove(comItem); } else { combox.Items.Remove(comItem); } } combox.OnDeleteItem(null, comItem); } } } ================================================ FILE: Panuon.UI/6_CheckBox/PUCheckBox.cs ================================================ using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUCheckBox : CheckBox { static PUCheckBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUCheckBox), new FrameworkPropertyMetadata(typeof(PUCheckBox))); } #region Property /// /// 获取或设置选择框的基本样式。默认值为General。 /// public CheckBoxStyles CheckBoxStyle { get { return (CheckBoxStyles)GetValue(CheckBoxStyleProperty); } set { SetValue(CheckBoxStyleProperty, value); } } public static readonly DependencyProperty CheckBoxStyleProperty = DependencyProperty.Register("CheckBoxStyle", typeof(CheckBoxStyles), typeof(PUCheckBox), new PropertyMetadata(CheckBoxStyles.General)); /// /// 获取或设置选择框的圆角大小。默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUCheckBox), new PropertyMetadata(new CornerRadius(0))); /// /// 获取或设置选择框的宽度。默认值为20(Switch样式下为30)。 /// public double InnerWidth { get { return (double)GetValue(InnerWidthProperty); } set { SetValue(InnerWidthProperty, value); } } public static readonly DependencyProperty InnerWidthProperty = DependencyProperty.Register("InnerWidth", typeof(double), typeof(PUCheckBox), new PropertyMetadata((double)20)); /// /// 获取或设置选择框的高度。默认值为20。 /// public double InnerHeight { get { return (double)GetValue(InnerHeightProperty); } set { SetValue(InnerHeightProperty, value); } } public static readonly DependencyProperty InnerHeightProperty = DependencyProperty.Register("InnerHeight", typeof(double), typeof(PUCheckBox), new PropertyMetadata((double)20)); /// /// Check时对号的背景颜色(或前景色),默认值为白色。 /// 仅当按钮样式为General时生效。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUCheckBox)); #endregion } } ================================================ FILE: Panuon.UI/7_RadioButton/PURadioButton.cs ================================================ using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PURadioButton : RadioButton { static PURadioButton() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PURadioButton), new FrameworkPropertyMetadata(typeof(PURadioButton))); } #region Property /// /// 选择框样式,默认值为General。 /// public RadioButtonStyles RadioButtonStyle { get { return (RadioButtonStyles)GetValue(RadioButtonStyleProperty); } set { SetValue(RadioButtonStyleProperty, value); } } public static readonly DependencyProperty RadioButtonStyleProperty = DependencyProperty.Register("RadioButtonStyle", typeof(RadioButtonStyles), typeof(PURadioButton), new PropertyMetadata(RadioButtonStyles.General)); /// /// 圆角大小,默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PURadioButton), new PropertyMetadata(new CornerRadius(0))); /// /// 内部选择框的宽度,默认值为20。 /// Switch样式下默认值为30。 /// public double InnerWidth { get { return (double)GetValue(InnerWidthProperty); } set { SetValue(InnerWidthProperty, value); } } public static readonly DependencyProperty InnerWidthProperty = DependencyProperty.Register("InnerWidth", typeof(double), typeof(PURadioButton), new PropertyMetadata((double)20)); /// /// 内部选择框的高度,默认值为20。 /// public double InnerHeight { get { return (double)GetValue(InnerHeightProperty); } set { SetValue(InnerHeightProperty, value); } } public static readonly DependencyProperty InnerHeightProperty = DependencyProperty.Register("InnerHeight", typeof(double), typeof(PURadioButton), new PropertyMetadata((double)20)); /// /// Check时对号的背景颜色(或前景色),默认值为白色。 /// 仅当按钮样式为General时生效。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PURadioButton), new PropertyMetadata(new SolidColorBrush(Colors.White))); #endregion } } ================================================ FILE: Panuon.UI/8_ProgressBar/PUProgressBar.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; namespace Panuon.UI { public class PUProgressBar : Control { static PUProgressBar() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUProgressBar), new FrameworkPropertyMetadata(typeof(PUProgressBar))); } public override void OnApplyTemplate() { base.OnApplyTemplate(); Loaded += delegate { PercentString = Percent * 100 + "%"; Change(); }; } #region RoutedEvent /// /// 进度改变事件。 /// public static readonly RoutedEvent PercentChangedEvent = EventManager.RegisterRoutedEvent("PercentChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUProgressBar)); public event RoutedPropertyChangedEventHandler PercentChanged { add { AddHandler(PercentChangedEvent, value); } remove { RemoveHandler(PercentChangedEvent, value); } } internal void OnPercentChanged(double oldValue, double newValue) { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(oldValue, newValue, PercentChangedEvent); RaiseEvent(arg); } #endregion #region Property /// /// 获取或设置进度条的基本样式。默认值为General。 /// public ProgressBarStyles ProgressBarStyle { get { return (ProgressBarStyles)GetValue(ProgressBarStyleProperty); } set { SetValue(ProgressBarStyleProperty, value); } } public static readonly DependencyProperty ProgressBarStyleProperty = DependencyProperty.Register("ProgressBarStyle", typeof(ProgressBarStyles), typeof(PUProgressBar), new PropertyMetadata(ProgressBarStyles.General)); /// /// 获取或设置进度条的填充动画持续时间。默认值为0.4秒。 /// public TimeSpan AnimationDuration { get { return (TimeSpan)GetValue(AnimationDurationProperty); } set { SetValue(AnimationDurationProperty, value); } } public static readonly DependencyProperty AnimationDurationProperty = DependencyProperty.Register("AnimationDuration", typeof(TimeSpan), typeof(PUProgressBar), new PropertyMetadata(TimeSpan.FromSeconds(0.6))); /// /// 获取或设置进度条的填充颜色。默认值为灰黑色。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUProgressBar)); /// /// 获取或设置进度条的圆角大小,默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUProgressBar)); /// /// 获取或设置进度条填充方向,默认值为LeftToRight。 /// public ProgressDirections ProgressDirection { get { return (ProgressDirections)GetValue(ProgressDirectionroperty); } set { SetValue(ProgressDirectionroperty, value); } } public static readonly DependencyProperty ProgressDirectionroperty = DependencyProperty.Register("ProgressDirection", typeof(ProgressDirections), typeof(PUProgressBar), new PropertyMetadata(ProgressDirections.LeftToRight)); /// /// 获取或设置是否显示百分比。默认值为False。 /// public bool IsPercentShow { get { return (bool)GetValue(IsPercentShowProperty); } set { SetValue(IsPercentShowProperty, value); } } public static readonly DependencyProperty IsPercentShowProperty = DependencyProperty.Register("IsPercentShow", typeof(bool), typeof(PUProgressBar)); /// /// 获取或设置当前进度条的百分比,从0~1的值。默认值为0。 /// public double Percent { get { return (double)GetValue(PercentProperty); } set { SetValue(PercentProperty, value); } } public static readonly DependencyProperty PercentProperty = DependencyProperty.Register("Percent", typeof(double), typeof(PUProgressBar), new PropertyMetadata(OnPercentChanged)); private static void OnPercentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var pgBar = d as PUProgressBar; if (pgBar.Percent < 0) { pgBar.Percent = 0; return; } else if (pgBar.Percent > 1) { pgBar.Percent = 1; return; } pgBar.PercentString = pgBar.Percent * 100 + "%"; pgBar.OnPercentChanged((double)e.OldValue, (double)e.NewValue); if (!pgBar.IsLoaded) return; pgBar.Change(); } public new Thickness BorderThickness { get { return (Thickness)GetValue(BorderThicknessProperty); } set { SetValue(BorderThicknessProperty, value); } } public new static readonly DependencyProperty BorderThicknessProperty = DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(PUProgressBar), new PropertyMetadata(OnBorderThicknessChanged)); private static void OnBorderThicknessChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var bar = d as PUProgressBar; bar.StrokeThickness = bar.BorderThickness.Left; } #endregion #region Internal Property internal string PercentString { get { return (string)GetValue(PercentStringProperty); } set { SetValue(PercentStringProperty, value); } } internal static readonly DependencyProperty PercentStringProperty = DependencyProperty.Register("PercentString", typeof(string), typeof(PUProgressBar)); internal double InnerWidth { get { return (double)GetValue(InnerWidthProperty); } set { SetValue(InnerWidthProperty, value); } } internal static readonly DependencyProperty InnerWidthProperty = DependencyProperty.Register("InnerWidth", typeof(double), typeof(PUProgressBar)); internal double InnerPercent { get { return (double)GetValue(InnerPercentProperty); } set { SetValue(InnerPercentProperty, value); } } internal static readonly DependencyProperty InnerPercentProperty = DependencyProperty.Register("InnerPercent", typeof(double), typeof(PUProgressBar)); internal double StrokeThickness { get { return (double)GetValue(StrokeThicknessProperty); } set { SetValue(StrokeThicknessProperty, value); } } internal static readonly DependencyProperty StrokeThicknessProperty = DependencyProperty.Register("StrokeThickness", typeof(double), typeof(PUProgressBar)); #endregion #region Function private void Change() { var toValue = ActualWidth * Percent; if (ProgressDirection == ProgressDirections.TopToBottom || ProgressDirection == ProgressDirections.BottomToTop) { toValue = ActualHeight * Percent; } var anima = new DoubleAnimation() { To = toValue, EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }, Duration = AnimationDuration, }; BeginAnimation(InnerWidthProperty, anima); var anima2 = new DoubleAnimation() { To = Percent, EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }, Duration = AnimationDuration, }; BeginAnimation(InnerPercentProperty, anima2); } #endregion } } ================================================ FILE: Panuon.UI/9_Special/Countdown.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; namespace Panuon.UI { public class Countdown : Control { #region Identity private DispatcherTimer _timer; #endregion static Countdown() { DefaultStyleKeyProperty.OverrideMetadata(typeof(Countdown), new FrameworkPropertyMetadata(typeof(Countdown))); } public Countdown() { _timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(1) }; _timer.Tick += CountdownTimer_Tick; } #region RoutedEvent public static readonly RoutedEvent TimeChangedEvent = EventManager.RegisterRoutedEvent("TimeChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(Countdown)); public event RoutedPropertyChangedEventHandler TimeChanged { add { AddHandler(TimeChangedEvent, value); } remove { RemoveHandler(TimeChangedEvent, value); } } void RaiseTimeChanged(int oldValue, int newValue) { var arg = new RoutedPropertyChangedEventArgs(oldValue, newValue, TimeChangedEvent); RaiseEvent(arg); } public static readonly RoutedEvent StopedEvent = EventManager.RegisterRoutedEvent("Stoped", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(Countdown)); public event RoutedEventHandler Stoped { add { AddHandler(StopedEvent, value); } remove { RemoveHandler(StopedEvent, value); } } void RaiseStoped() { var arg = new RoutedEventArgs(StopedEvent); RaiseEvent(arg); } #endregion #region Property public CornerRadius CornerRadius { get { return (CornerRadius)GetValue(CornerRadiusProperty); } set { SetValue(CornerRadiusProperty, value); } } public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(Countdown)); public int Second { get { return (int)GetValue(SecondProperty); } set { SetValue(SecondProperty, value); } } public static readonly DependencyProperty SecondProperty = DependencyProperty.Register("Second", typeof(int), typeof(Countdown), new PropertyMetadata(OnSecondChanged)); private static void OnSecondChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var countDown = d as Countdown; if(countDown.Second < 0) { countDown.Second = 0; return; } countDown.RaiseTimeChanged(e.OldValue as int? ?? 0, e.NewValue as int? ?? 0); } public bool IsRunning { get { return (bool)GetValue(IsRunningProperty); } set { SetValue(IsRunningProperty, value); } } public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register("IsRunning", typeof(bool), typeof(Countdown), new PropertyMetadata(OnIsRunningChanged)); private static void OnIsRunningChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var countdown = d as Countdown; if (countdown.IsRunning) { countdown._timer.Start(); } else { countdown.RaiseStoped(); countdown._timer.Stop(); } } #endregion #region Event private void CountdownTimer_Tick(object sender, EventArgs e) { if (Second <= 0) { RaiseStoped(); _timer.Stop(); } Second--; } #endregion } } ================================================ FILE: Panuon.UI/9_Special/DateTimePicker.cs ================================================ using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUDateTimeSelector : Control { #region Constructor static PUDateTimeSelector() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUDateTimeSelector), new FrameworkPropertyMetadata(typeof(PUDateTimeSelector))); } public PUDateTimeSelector() { Loaded += delegate { UpdateText(); }; } #endregion #region Property public DatePickerModes DatePickerMode { get { return (DatePickerModes)GetValue(DatePickerModeProperty); } set { SetValue(DatePickerModeProperty, value); } } public static readonly DependencyProperty DatePickerModeProperty = DependencyProperty.Register("DatePickerMode", typeof(DatePickerModes), typeof(PUDateTimeSelector), new PropertyMetadata(DatePickerModes.DateTime)); public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(PUDateTimeSelector)); public Color ShadowColor { get { return (Color)GetValue(ShadowColorProperty); } set { SetValue(ShadowColorProperty, value); } } public static readonly DependencyProperty ShadowColorProperty = DependencyProperty.Register("ShadowColor", typeof(Color), typeof(PUDateTimeSelector)); public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUDateTimeSelector)); public DateTime SelectedDateTime { get { return (DateTime)GetValue(SelectedDateTimeProperty); } set { SetValue(SelectedDateTimeProperty, value); } } public static readonly DependencyProperty SelectedDateTimeProperty = DependencyProperty.Register("SelectedDateTime", typeof(DateTime), typeof(PUDateTimeSelector), new PropertyMetadata(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0), OnSelectedDateTimeChanged)); private static void OnSelectedDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var picker = d as PUDateTimeSelector; picker.UpdateText(); } public DateTime? MaxDate { get { return (DateTime?)GetValue(MaxDateProperty); } set { SetValue(MaxDateProperty, value); } } public static readonly DependencyProperty MaxDateProperty = DependencyProperty.Register("MaxDate", typeof(DateTime?), typeof(PUDateTimeSelector)); public DateTime? MinDate { get { return (DateTime?)GetValue(MinDateProperty); } set { SetValue(MinDateProperty, value); } } public static readonly DependencyProperty MinDateProperty = DependencyProperty.Register("MinDate", typeof(DateTime?), typeof(PUDateTimeSelector)); public CornerRadius CornerRadius { get { return (CornerRadius)GetValue(CornerRadiusProperty); } set { SetValue(CornerRadiusProperty, value); } } public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(PUDateTimeSelector)); public object Icon { get { return (object)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } public static readonly DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(object), typeof(PUDateTimeSelector)); #endregion #region Function private void UpdateText() { switch (DatePickerMode) { case DatePickerModes.DateTime: Text = SelectedDateTime.ToString("yyyy-MM-dd HH:mm:ss"); break; case DatePickerModes.DateOnly: Text = SelectedDateTime.ToString("yyyy-MM-dd"); break; case DatePickerModes.TimeOnly: Text = SelectedDateTime.ToString("HH:mm:ss"); break; } } #endregion } } ================================================ FILE: Panuon.UI/9_Special/DropDown.cs ================================================ using System; using System.Collections.ObjectModel; using System.Windows; using System.Windows.Controls; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; namespace Panuon.UI { public class DropDown : ContentControl { static DropDown() { DefaultStyleKeyProperty.OverrideMetadata(typeof(DropDown), new FrameworkPropertyMetadata(typeof(DropDown))); } #region Property public Color ShadowColor { get { return (Color)GetValue(ShadowColorProperty); } set { SetValue(ShadowColorProperty, value); } } public static readonly DependencyProperty ShadowColorProperty = DependencyProperty.Register("ShadowColor", typeof(Color), typeof(DropDown)); public UIElement Child { get { return (UIElement)GetValue(ChildProperty); } set { SetValue(ChildProperty, value); } } public static readonly DependencyProperty ChildProperty = DependencyProperty.Register("Child", typeof(UIElement), typeof(DropDown)); public DropDownPlacement DropDownPlacement { get { return (DropDownPlacement)GetValue(DropDownPlacementProperty); } set { SetValue(DropDownPlacementProperty, value); } } public static readonly DependencyProperty DropDownPlacementProperty = DependencyProperty.Register("DropDownPlacement", typeof(DropDownPlacement), typeof(DropDown), new PropertyMetadata(DropDownPlacement.LeftBottom)); public double CornerRadius { get { return (double)GetValue(CornerRadiusProperty); } set { SetValue(CornerRadiusProperty, value); } } public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(double), typeof(DropDown)); public bool IsOpen { get { return (bool)GetValue(IsOpenProperty); } set { SetValue(IsOpenProperty, value); } } public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register("IsOpen", typeof(bool), typeof(DropDown)); #endregion } } ================================================ FILE: Panuon.UI/9_Special/PUCard.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUCard : UserControl { #region Constructor static PUCard() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUCard), new FrameworkPropertyMetadata(typeof(PUCard))); } public override void OnApplyTemplate() { base.OnApplyTemplate(); AddHandler(PUButton.ClickEvent, new RoutedEventHandler(OnDetailButtonClicked)); } private void OnDetailButtonClicked(object sender, RoutedEventArgs e) { var btnDetail = (sender as PUButton); if (btnDetail == null || btnDetail.Tag == null || btnDetail.Tag.ToString() != "PART_Detail") return; OnDetail(); } #endregion #region RoutedEvent /// /// 点击详情事件。 /// public static readonly RoutedEvent DetailEvent = EventManager.RegisterRoutedEvent("Detail", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUCard)); public event RoutedPropertyChangedEventHandler Detail { add { AddHandler(DetailEvent, value); } remove { RemoveHandler(DetailEvent, value); } } internal void OnDetail() { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(this, this, DetailEvent); RaiseEvent(arg); } #endregion #region Property /// /// 获取或设置是否显示详情按钮。默认值为False。 /// public bool IsDetailButtonShow { get { return (bool)GetValue(IsDetailButtonShowProperty); } set { SetValue(IsDetailButtonShowProperty, value); } } public static readonly DependencyProperty IsDetailButtonShowProperty = DependencyProperty.Register("IsDetailButtonShow", typeof(bool), typeof(PUCard)); /// /// 获取或设置标题的内容。默认值为Null。 /// public object Header { get { return (object)GetValue(HeaderProperty); } set { SetValue(HeaderProperty, value); } } public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register("Header", typeof(object), typeof(PUCard)); /// /// 获取或设置标题前的图标按钮。默认值为Null。 /// public object Icon { get { return (object)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } public static readonly DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(object), typeof(PUCard)); /// /// 获取或设置阴影颜色。默认值为透明。 /// public Color ShadowColor { get { return (Color)GetValue(ShadowColorProperty); } set { SetValue(ShadowColorProperty, value); } } public static readonly DependencyProperty ShadowColorProperty = DependencyProperty.Register("ShadowColor", typeof(Color), typeof(PUCard)); /// /// 获取或设置卡片的圆角大小。默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUCard)); /// /// 获取或设置卡片的标题高度(包含标题和详情按钮)。默认值为30。 /// public double HeaderHeight { get { return (double)GetValue(HeaderHeightProperty); } set { SetValue(HeaderHeightProperty, value); } } public static readonly DependencyProperty HeaderHeightProperty = DependencyProperty.Register("HeaderHeight", typeof(double), typeof(PUCard)); #endregion } } ================================================ FILE: Panuon.UI/9_Special/PUImageCuter.xaml ================================================  ================================================ FILE: Panuon.UI/9_Special/PUImageCuter.xaml.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace Panuon.UI { /// /// ImageCuter.xaml 的交互逻辑 /// public partial class PUImageCuter : UserControl { public PUImageCuter() { InitializeComponent(); } #region Property public BitmapImage ImageSource { get { return (BitmapImage)GetValue(ImageSourceProperty); } set { SetValue(ImageSourceProperty, value); } } public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(BitmapImage), typeof(PUImageCuter)); public ImageType ImageType { get { return (ImageType)GetValue(ImageTypeProperty); } set { SetValue(ImageTypeProperty, value); } } public static readonly DependencyProperty ImageTypeProperty = DependencyProperty.Register("ImageType", typeof(ImageType), typeof(PUImageCuter), new PropertyMetadata(ImageType.Rectangle, OnImageTypeChanged)); private static void OnImageTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var cuter = d as PUImageCuter; cuter.ResizeContainer.IsSquare = cuter.ImageType == ImageType.Square; } public double ImageMinHeight { get { return (double)GetValue(ImageMinHeightProperty); } set { SetValue(ImageMinHeightProperty, value); } } public static readonly DependencyProperty ImageMinHeightProperty = DependencyProperty.Register("ImageMinHeight", typeof(double), typeof(PUImageCuter), new PropertyMetadata(50.0)); public double ImageMinWidth { get { return (double)GetValue(ImageMinWidthProperty); } set { SetValue(ImageMinWidthProperty, value); } } public static readonly DependencyProperty ImageMinWidthProperty = DependencyProperty.Register("ImageMinWidth", typeof(double), typeof(PUImageCuter), new PropertyMetadata(50.0)); public double ImageMaxHeight { get { return (double)GetValue(ImageMaxHeightProperty); } set { SetValue(ImageMaxHeightProperty, value); } } public static readonly DependencyProperty ImageMaxHeightProperty = DependencyProperty.Register("ImageMaxHeight", typeof(double), typeof(PUImageCuter), new PropertyMetadata(double.NaN)); public double ImageMaxWidth { get { return (double)GetValue(ImageMaxWidthProperty); } set { SetValue(ImageMaxWidthProperty, value); } } public static readonly DependencyProperty ImageMaxWidthProperty = DependencyProperty.Register("ImageMaxWidth", typeof(double), typeof(PUImageCuter), new PropertyMetadata(double.NaN)); #endregion #region Event private void Img_SizeChanged(object sender, SizeChangedEventArgs e) { var image = sender as Image; CvaMain.Width = image.ActualWidth; CvaMain.Height = image.ActualHeight; CvaMain.Margin = new Thickness((ActualWidth - image.ActualWidth) / 2, (ActualHeight - image.ActualHeight) / 2, (ActualWidth - image.ActualWidth) / 2, (ActualHeight - image.ActualHeight) / 2); ResizeContainer.Visibility = Visibility.Visible; } #endregion #region APIs public BitmapSource GetCutedImage() { if (ImageSource == null) return null; var widthScale = ImageSource.PixelWidth / CvaMain.ActualWidth; var heightScale = ImageSource.PixelHeight / CvaMain.ActualHeight; return new CroppedBitmap(BitmapFrame.Create(ImageSource), new Int32Rect((int)(Canvas.GetLeft(ResizeContainer) * widthScale), (int)(Canvas.GetTop(ResizeContainer) * heightScale), (int)(ResizeContainer.ActualWidth * widthScale), (int)(ResizeContainer.ActualHeight * heightScale))); } #endregion } } ================================================ FILE: Panuon.UI/9_Special/PUIndicator.xaml ================================================  ================================================ FILE: Panuon.UI/9_Special/PUIndicator.xaml.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; namespace Panuon.UI { /// /// PUIndicator.xaml 的交互逻辑 /// public partial class PUIndicator : UserControl { public PUIndicator() { InitializeComponent(); Background = new SolidColorBrush(Colors.Transparent); MouseEnter += delegate { var anima = new DoubleAnimation() { To = 1, Duration = TimeSpan.FromSeconds(0.2), }; this.BeginAnimation(OpacityProperty, anima); }; MouseLeave += delegate { var anima = new DoubleAnimation() { To = 0.8, Duration = TimeSpan.FromSeconds(0.2), }; this.BeginAnimation(OpacityProperty, anima); }; } #region RoutedEvent /// /// 索引变更事件。 /// public static readonly RoutedEvent IndexChangedEvent = EventManager.RegisterRoutedEvent("IndexChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUIndicator)); public event RoutedPropertyChangedEventHandler IndexChanged { add { AddHandler(IndexChangedEvent, value); } remove { RemoveHandler(IndexChangedEvent, value); } } internal void OnIndexChanged(int oldValue, int newValue) { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(oldValue, newValue, IndexChangedEvent); RaiseEvent(arg); } #endregion #region Property /// /// 排列方式,默认值为Horizontal(横向)。 /// 若排列方式为横向,需要设置控件的Height属性来计算球体大小;若排列方式为纵向,则需要设置控件的Width属性来计算球体大小。 /// public Orientation Dircetion { get { return (Orientation)GetValue(DircetionProperty); } set { SetValue(DircetionProperty, value); } } public static readonly DependencyProperty DircetionProperty = DependencyProperty.Register("Dircetion", typeof(Orientation), typeof(PUIndicator), new PropertyMetadata(Orientation.Horizontal, OnDircetionDircetionChanged)); private static void OnDircetionDircetionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var indicator = d as PUIndicator; indicator.StkMain.Orientation = indicator.Dircetion; } /// /// 指示小球的颜色,默认值为灰色。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUIndicator), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#666666")))); /// /// 索引总数。 默认值为1,最小值为1。 /// public int TotalIndex { get { return (int)GetValue(TotalIndexProperty); } set { SetValue(TotalIndexProperty, value); } } public static readonly DependencyProperty TotalIndexProperty = DependencyProperty.Register("TotalIndex", typeof(int), typeof(PUIndicator), new PropertyMetadata(1)); /// /// 当前索引。默认值为1,最小值为1。 /// public int Index { get { return (int)GetValue(IndexProperty); } set { SetValue(IndexProperty, value); } } public static readonly DependencyProperty IndexProperty = DependencyProperty.Register("Index", typeof(int), typeof(PUIndicator), new PropertyMetadata(1, OnIndexChanged)); private static void OnIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var indicator = d as PUIndicator; indicator.OnIndexChanged((int?)e.OldValue ?? 0, (int?)e.NewValue ?? 0); if (!indicator.IsLoaded) return; indicator.ChangeIndex(true); } /// /// 左右滑动动画的持续时间(单位:毫秒),若为0,则滑动时不使用动画。默认值为500毫秒。 /// public int AnimationDuration { get { return (int)GetValue(AnimationDurationProperty); } set { SetValue(AnimationDurationProperty, value); } } public static readonly DependencyProperty AnimationDurationProperty = DependencyProperty.Register("AnimationDuration", typeof(int), typeof(PUIndicator), new PropertyMetadata(0)); #endregion #region Private APIs private void Draw() { if (TotalIndex < 1) TotalIndex = 1; var radius = 0.0; if (Dircetion == Orientation.Horizontal) radius = this.ActualHeight; else radius = this.ActualWidth; StkMain.Children.Clear(); EllIndicator.Height = (int)(radius * 0.6); EllIndicator.Width = (int)(radius * 0.6); EllIndicator.Background = CoverBrush; EllIndicator.CornerRadius = new CornerRadius(EllIndicator.Height / 2); if (Dircetion == Orientation.Horizontal) EllIndicator.Margin = new Thickness((radius - ((int)(radius * 0.6))) / 2, EllIndicator.Height / 2, 0, 0); else EllIndicator.Margin = new Thickness(EllIndicator.Height / 2, (radius - ((int)(radius * 0.6))) / 2, 0, 0); EllIndicator.Opacity = 0.8; EllIndicator.MouseEnter += delegate { var anima = new DoubleAnimation() { To = 1, Duration = TimeSpan.FromSeconds(0.2), }; EllIndicator.BeginAnimation(OpacityProperty, anima); }; EllIndicator.MouseLeave += delegate { var anima = new DoubleAnimation() { To = 0.8, Duration = TimeSpan.FromSeconds(0.2), }; EllIndicator.BeginAnimation(OpacityProperty, anima); }; for (int i = 1; i <= TotalIndex; i++) { var ellipse = new Border() { Margin = Dircetion == Orientation.Horizontal ? new Thickness(0, 0, (int)(radius * 0.3), 0) : new Thickness(0, 0, 0, (int)(radius * 0.3)), Height = (int)radius, Width = (int)radius, CornerRadius = new CornerRadius(radius / 2), BorderBrush = BorderBrush, Background = new SolidColorBrush(Colors.Transparent), BorderThickness = new Thickness(1), Opacity = 0.6, Tag = i, Cursor = Cursors.Hand, }; ellipse.MouseEnter += delegate { var anima = new DoubleAnimation() { To = 1, Duration = TimeSpan.FromSeconds(0.2), }; ellipse.BeginAnimation(OpacityProperty, anima); }; ellipse.MouseLeave += delegate { var anima = new DoubleAnimation() { To = 0.6, Duration = TimeSpan.FromSeconds(0.2), }; ellipse.BeginAnimation(OpacityProperty, anima); }; ellipse.MouseLeftButtonDown += delegate { Index = (int)ellipse.Tag; }; StkMain.Children.Add(ellipse); } } private void ChangeIndex(bool usingAnima) { var radius = 0.0; if (Dircetion == Orientation.Horizontal) radius = this.ActualHeight; else radius = this.ActualWidth; var left = (Index - 1) * ((int)(radius * 1.3)) + (radius - ((int)(radius * 0.6))) / 2; if (!usingAnima || AnimationDuration == 0) { if(Dircetion == Orientation.Horizontal) EllIndicator.Margin = new Thickness(left, radius * 0.2, 0, 0); else EllIndicator.Margin = new Thickness(radius * 0.2, left, 0, 0); } else { if (Dircetion == Orientation.Horizontal) { var anima = new ThicknessAnimation() { To = new Thickness(left, radius * 0.2, 0, 0), Duration = TimeSpan.FromMilliseconds(AnimationDuration), EasingFunction = new CircleEase() { EasingMode = EasingMode.EaseInOut }, }; EllIndicator.BeginAnimation(MarginProperty, anima); } else { var anima = new ThicknessAnimation() { To = new Thickness(radius * 0.2, left, 0, 0), Duration = TimeSpan.FromMilliseconds(AnimationDuration), EasingFunction = new CircleEase() { EasingMode = EasingMode.EaseInOut }, }; EllIndicator.BeginAnimation(MarginProperty, anima); } } } #endregion private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) { Draw(); ChangeIndex(false); } } } ================================================ FILE: Panuon.UI/9_Special/PULoading.xaml ================================================  ================================================ FILE: Panuon.UI/9_Special/PULoading.xaml.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace Panuon.UI { /// /// Loading.xaml 的交互逻辑 /// public partial class PULoading : UserControl { private Storyboard _storyboard; public PULoading() { InitializeComponent(); Loaded += PULoading_Loaded; } private void PULoading_Loaded(object sender, RoutedEventArgs e) { if (IsRunning) Draw(); } public override void OnApplyTemplate() { base.OnApplyTemplate(); } #region Property public bool IsRunning { get { return (bool)GetValue(IsRunningProperty); } set { SetValue(IsRunningProperty, value); } } public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register("IsRunning", typeof(bool), typeof(PULoading), new PropertyMetadata(false, OnIsRunningChanged)); private static void OnIsRunningChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var load = d as PULoading; if (!load.IsLoaded) return; var run = (bool)e.NewValue; if (run) load.Draw(); else load.Clear(); } #endregion #region Internal APIs internal void Draw() { _storyboard = new Storyboard() { RepeatBehavior = RepeatBehavior.Forever, }; double canvasHeight = 0; if (double.IsNaN(Height)) { if (ActualHeight == 0) { return; } else { canvasHeight = ActualHeight; } } else { canvasHeight = this.Height; } var ellipseHeight = canvasHeight * 0.1; var rollHeight = canvasHeight * 0.75; var rollRadius = rollHeight / 2; for (int i = 0; i < 6; i++) { var ellipse = new Ellipse() { Fill = Foreground, Width = ellipseHeight, Height = ellipseHeight, Margin = new Thickness(-ellipseHeight / 2, -ellipseHeight / 2, 0, 0), Opacity = 0, }; Canvas.SetTop(ellipse, canvasHeight * 0.125); Canvas.SetLeft(ellipse, canvasHeight / 2); var path = $"M{canvasHeight / 2},{canvasHeight * 0.125} A {rollRadius},{rollRadius} 0 0 1 {canvasHeight / 2},{rollHeight + canvasHeight * 0.125} A {rollRadius},{rollRadius} 0 0 1 {canvasHeight / 2},{canvasHeight * 0.125} A {rollRadius},{rollRadius} 0 0 1 {canvasHeight / 2},{rollHeight + canvasHeight * 0.125} A {rollRadius},{rollRadius} 0 0 1 {canvasHeight / 2},{canvasHeight * 0.125}"; var anima1 = GetDoubleAnimation(1, (i + i * 0.3) * 0.1, 0.01); Storyboard.SetTarget(anima1, ellipse); Storyboard.SetTargetProperty(anima1, new PropertyPath("Opacity")); _storyboard.Children.Add(anima1); var animaX = GetDoubleAnimationUsingPath(path, (i + i * 0.3) * 0.1, 1.5, PathAnimationSource.X); Storyboard.SetTarget(animaX, ellipse); Storyboard.SetTargetProperty(animaX, new PropertyPath("(Canvas.Left)")); _storyboard.Children.Add(animaX); var animaY = GetDoubleAnimationUsingPath(path, (i + i * 0.3) * 0.1, 1.5, PathAnimationSource.Y); Storyboard.SetTarget(animaY, ellipse); Storyboard.SetTargetProperty(animaY, new PropertyPath("(Canvas.Top)")); _storyboard.Children.Add(animaY); var anima2 = GetDoubleAnimation(0, 1.05 + 0.1 * i, 0.5); Storyboard.SetTarget(anima2, ellipse); Storyboard.SetTargetProperty(anima2, new PropertyPath("Opacity")); _storyboard.Children.Add(anima2); cvaMain.Children.Add(ellipse); } _storyboard.Begin(); } internal void Clear() { _storyboard.Stop(); cvaMain.Children.Clear(); } #endregion #region Function private DoubleAnimation GetDoubleAnimation(double to, double beginTime, double duration, IEasingFunction easingFunction = null) { return new DoubleAnimation() { To = to, BeginTime = TimeSpan.FromSeconds(beginTime), Duration = TimeSpan.FromSeconds(duration), EasingFunction = easingFunction, }; } private DoubleAnimationUsingPath GetDoubleAnimationUsingPath(string path, double beginTime, double duration, PathAnimationSource source) { return new DoubleAnimationUsingPath() { BeginTime = TimeSpan.FromSeconds(beginTime), PathGeometry = Geometry.Parse(path).GetFlattenedPathGeometry(), Duration = TimeSpan.FromSeconds(duration), Source = source, }; } #endregion } } ================================================ FILE: Panuon.UI/9_Special/PUMessageBox.xaml ================================================  ================================================ FILE: Panuon.UI/9_Special/PUMessageBox.xaml.cs ================================================ using System; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Interop; namespace Panuon.UI { /// /// PUMessageBox.xaml 的交互逻辑 /// public partial class PUMessageBox : UI.PUWindow { #region Identity RoutedEventHandler _cancel; static PUMessageBox _instance; #endregion private PUMessageBox(string title, string content, bool isConfirm, bool showInTaskBar, AnimationStyles animateStyle) { InitializeComponent(); Title = title; txtContent.Text = content; if (isConfirm) { groupTip.Visibility = Visibility.Collapsed; groupConfirm.Visibility = Visibility.Visible; } ShowInTaskbar = showInTaskBar; AnimationStyle = animateStyle; if(Owner != null) { WindowStartupLocation = WindowStartupLocation.CenterOwner; } } #region APIs /// /// 打开一个消息提示对话框,并打开父窗体的遮罩层。 /// /// 要显示的内容。 /// 标题内容。 /// 按钮内容,默认为“好” /// 是否在任务栏中显示,默认为True。 public static void ShowDialog(string content, string title = "提示", Buttons buttons = Buttons.Sure, bool showInTaskBar = true, AnimationStyles animateStyle = AnimationStyles.Scale) { var mbox = new PUMessageBox(title, content, false, showInTaskBar, animateStyle); mbox.CheckButtonContent(buttons); if (!showInTaskBar) mbox.ShowInTaskbar = false; mbox.ShowDialog(); } /// /// 打开一个消息确认对话框,并打开父窗体的遮罩层。 /// /// 要显示的内容。 /// 标题内容。 /// 按钮内容,默认为“是/否” /// 是否在任务栏中显示,默认为True。 public static bool? ShowConfirm(string content, string title = "提示", Buttons buttons = Buttons.YesOrNo, bool showInTaskBar = true, AnimationStyles animateStyle = AnimationStyles.Scale) { var mbox = new PUMessageBox(title, content, true, showInTaskBar, animateStyle); mbox.CheckButtonContent(buttons); if (!showInTaskBar) mbox.ShowInTaskbar = false; mbox.ShowDialog(); return mbox.DialogResult; } /// /// 打开一个等待界面,并打开父窗体的遮罩层。该界面将以Show的方式打开,但用户不能使用Alt+F4强制关闭此页面。若要关闭此界面,请调用PUMessageBox.CloseAwait()方法。 /// /// 要显示的内容 public static void ShowAwait(string content) { var mbox = new PUMessageBox("", "", false, false, AnimationStyles.Scale); mbox.AllowForcingClose = false; _instance = mbox; mbox.txtAwait.Text = content; mbox.btnOK.IsEnabled = false; mbox.CheckButtonContent(Buttons.Cancel); mbox.Topmost = true; mbox.loading.IsRunning = true; mbox.grdAwait.Visibility = Visibility.Visible; mbox.Show(); } /// /// 打开一个等待界面,并打开父窗体的遮罩层。该界面将以Show的方式打开,但用户不能使用Alt+F4强制关闭此页面。若要关闭此界面,请调用PUMessageBox.CloseAwait()方法。 /// /// 要显示的内容 /// 若允许用户取消等待,则必须指定点击取消按钮后的后续处理。用户点击了取消按钮,该窗体需要您手动关闭。若不指定后续处理,取消按钮将被禁用。 public static void ShowAwait(string content, RoutedEventHandler cancelCallback = null) { var mbox = new PUMessageBox("", "", false, false, AnimationStyles.Scale); mbox.AllowForcingClose = false; _instance = mbox; mbox.txtAwait.Text = content; mbox.CheckButtonContent(Buttons.Cancel); mbox._cancel = cancelCallback; mbox.Topmost = true; mbox.loading.IsRunning = true; mbox.grdAwait.Visibility = Visibility.Visible; mbox.Show(); } /// /// 打开一个等待界面,并打开父窗体的遮罩层。该界面将以Show的方式打开,但用户不能使用Alt+F4强制关闭此页面。若要关闭此界面,请调用PUMessageBox.CloseAwait()方法。 /// /// 要显示的内容 /// 标题内容。 /// 若允许用户取消等待,则必须指定点击取消按钮后的后续处理。用户点击了取消按钮,该窗体需要您手动关闭。若不指定后续处理,取消按钮将被禁用。 public static void ShowAwait(string content, string title = "提示", RoutedEventHandler cancelCallback = null, AnimationStyles animateStyle = AnimationStyles.Scale) { var mbox = new PUMessageBox(title, "", false, false, animateStyle); mbox.AllowForcingClose = false; _instance = mbox; mbox.CheckButtonContent(Buttons.Cancel); mbox._cancel = cancelCallback; mbox.Topmost = true; mbox.grdAwait.Visibility = Visibility.Visible; mbox.loading.IsRunning = true; mbox.txtAwait.Text = content; mbox.Show(); } /// /// 尝试关闭最后打开的一个等待界面。 /// 若要在其关闭之后立即打开另一个PUMessageBox,请使用另一个重载方法,或等待400ms后再打开。 /// public static void CloseAwait() { if (_instance != null) { _instance.Closed += delegate { _instance = null; }; _instance.Close(); } } /// /// 尝试关闭最后打开的一个等待界面。 /// 若要关闭之后立即打开另一个PUMessageBox,请指定关闭事件后的回调处理。 /// public static void CloseAwait(EventHandler closedCallback) { if (_instance != null) { _instance.Closed += delegate { _instance = null; closedCallback(null, null); }; _instance.Close(); } } #endregion #region Sys private void CheckButtonContent(Buttons buttons) { switch (buttons) { case Buttons.Sure: btnOK.Content = "好"; break; case Buttons.Yes: btnOK.Content = "是"; break; case Buttons.OK: btnOK.Content = "确定"; break; case Buttons.Cancel: btnOK.Content = "取消"; break; case Buttons.YesOrNo: BtnYes.Content = "是"; BtnNo.Content = "否"; break; case Buttons.YesOrCancel: BtnYes.Content = "是"; BtnNo.Content = "取消"; break; case Buttons.OKOrCancel: BtnYes.Content = "确定"; BtnNo.Content = "取消"; break; case Buttons.AcceptOrRefused: BtnYes.Content = "接受"; BtnNo.Content = "拒绝"; break; case Buttons.AcceptOrCancel: BtnYes.Content = "接受"; BtnNo.Content = "取消"; break; } } private void PUButton_Click(object sender, RoutedEventArgs e) { if (_cancel != null) { txtAwait.Text = "正在取消"; btnOK.IsEnabled = false; loading.IsRunning = false; _cancel(null, null); } else { Close(); } } private void PUButtonYes_Click(object sender, RoutedEventArgs e) { DialogResult = true; } private void PUButtonNo_Click(object sender, RoutedEventArgs e) { DialogResult = false; } #endregion } } ================================================ FILE: Panuon.UI/9_Special/PUSlideShow.xaml ================================================  ================================================ FILE: Panuon.UI/9_Special/PUSlideShow.xaml.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; namespace Panuon.UI { /// /// PUSlideShow.xaml 的交互逻辑 /// [ContentProperty(nameof(Content))] public partial class PUSlideShow : UserControl { #region Identity private bool isFirstTime = true; #endregion public PUSlideShow() { InitializeComponent(); Content = PART_STKMAIN.Children; PART_INDICATOR.IndexChanged += delegate { Index = PART_INDICATOR.Index; }; if (Index == 1 && !Recyclable) PART_BTNLEFT.IsEnabled = false; else PART_BTNLEFT.IsEnabled = true; if (Index == Content.Count && !Recyclable) PART_BTNRIGHT.IsEnabled = false; else PART_BTNRIGHT.IsEnabled = true; PART_INDICATOR.AnimationDuration = AnimationDuration; } #region Property public new UIElementCollection Content { get { return (UIElementCollection)GetValue(ContentProperty); } set { SetValue(ContentProperty, value); } } public new static readonly DependencyProperty ContentProperty = DependencyProperty.Register("Content", typeof(UIElementCollection), typeof(PUSlideShow), new PropertyMetadata(OnContentChanged)); private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var slideShow = d as PUSlideShow; if (!slideShow.IsLoaded || slideShow.Content == null) return; slideShow.Draw(); slideShow.PART_INDICATOR.TotalIndex = slideShow.Content.Count; } /// /// 索引,表示当前的位置。从1开始。 /// 当你试图将Index的值设置为大于Content数量上限或小于1的数字时,Index会被重设为Content的数量或1 /// (若Recyclable为True,则会被重设为1或Content的数量)。 /// public int Index { get { return (int)GetValue(IndexProperty); } set { SetValue(IndexProperty, value); } } public static readonly DependencyProperty IndexProperty = DependencyProperty.Register("Index", typeof(int), typeof(PUSlideShow), new PropertyMetadata(1, OnIndexChanged)); private static void OnIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var slideShow = d as PUSlideShow; if (!slideShow.IsLoaded || slideShow.Content == null) return; slideShow.PART_INDICATOR.Index = slideShow.Index; slideShow.ChangeIndex(); } /// /// 滑动方向。默认值为Horizontal(横向)。 /// public Orientation SlideDirection { get { return (Orientation)GetValue(SlideDirectionProperty); } set { SetValue(SlideDirectionProperty, value); } } public static readonly DependencyProperty SlideDirectionProperty = DependencyProperty.Register("SlideDirection", typeof(Orientation), typeof(PUSlideShow), new PropertyMetadata(Orientation.Horizontal, OnSlideDirectionChanged)); private static void OnSlideDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var slideShow = d as PUSlideShow; slideShow.PART_STKMAIN.Orientation = slideShow.SlideDirection; if (slideShow.SlideDirection == Orientation.Horizontal) { slideShow.PART_BTNLEFT.Content = ""; slideShow.PART_BTNRIGHT.Content = ""; slideShow.PART_BTNLEFT.VerticalAlignment = VerticalAlignment.Center; slideShow.PART_BTNLEFT.HorizontalAlignment = HorizontalAlignment.Left; slideShow.PART_BTNRIGHT.VerticalAlignment = VerticalAlignment.Center; slideShow.PART_BTNRIGHT.HorizontalAlignment = HorizontalAlignment.Right; slideShow.PART_BTNLEFT.Margin = new Thickness(20, 0, 0, 0); slideShow.PART_BTNRIGHT.Margin = new Thickness(0, 0, 20, 0); slideShow.PART_INDICATOR.Dircetion = Orientation.Horizontal; slideShow.PART_INDICATOR.Height = 15; slideShow.PART_INDICATOR.Width = double.NaN; slideShow.PART_INDICATOR.VerticalAlignment = VerticalAlignment.Bottom; slideShow.PART_INDICATOR.HorizontalAlignment = HorizontalAlignment.Center; slideShow.PART_INDICATOR.Margin = new Thickness(0, 0, 0, 20); } else { slideShow.PART_BTNLEFT.Content = ""; slideShow.PART_BTNRIGHT.Content = ""; slideShow.PART_BTNLEFT.VerticalAlignment = VerticalAlignment.Top; slideShow.PART_BTNLEFT.HorizontalAlignment = HorizontalAlignment.Center; slideShow.PART_BTNRIGHT.VerticalAlignment = VerticalAlignment.Bottom; slideShow.PART_BTNRIGHT.HorizontalAlignment = HorizontalAlignment.Center; slideShow.PART_BTNLEFT.Margin = new Thickness(0, 20, 0, 0); slideShow.PART_BTNRIGHT.Margin = new Thickness(0, 0, 0, 20); slideShow.PART_INDICATOR.Dircetion = Orientation.Vertical; slideShow.PART_INDICATOR.Height = double.NaN; slideShow.PART_INDICATOR.Width =15 ; slideShow.PART_INDICATOR.VerticalAlignment = VerticalAlignment.Center; slideShow.PART_INDICATOR.HorizontalAlignment = HorizontalAlignment.Left; slideShow.PART_INDICATOR.Margin = new Thickness(20, 0, 0, 0); } } /// /// 是否显示左右滑动按钮。 /// public bool IsSlideButtonShow { get { return (bool)GetValue(IsSlideButtonShowProperty); } set { SetValue(IsSlideButtonShowProperty, value); } } public static readonly DependencyProperty IsSlideButtonShowProperty = DependencyProperty.Register("IsSlideButtonShow", typeof(bool), typeof(PUSlideShow), new PropertyMetadata(true, OnIsSlideButtonShowChanged)); private static void OnIsSlideButtonShowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var slideShow = d as PUSlideShow; if (slideShow.IsSlideButtonShow) { slideShow.PART_BTNLEFT.Visibility = Visibility.Visible; slideShow.PART_BTNRIGHT.Visibility = Visibility.Visible; } else { slideShow.PART_BTNLEFT.Visibility = Visibility.Collapsed; slideShow.PART_BTNRIGHT.Visibility = Visibility.Collapsed; } } /// /// 滑动按钮的颜色,默认为灰黑色。 /// public Brush SlideButtonBrush { get { return (Brush)GetValue(SlideButtonBrushProperty); } set { SetValue(SlideButtonBrushProperty, value); } } public static readonly DependencyProperty SlideButtonBrushProperty = DependencyProperty.Register("SlideButtonBrush", typeof(Brush), typeof(PUSlideShow), new PropertyMetadata(OnSlideButtonBrushChanged)); private static void OnSlideButtonBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var slideShow = d as PUSlideShow; if (slideShow.SlideButtonBrush != null) { slideShow.PART_BTNLEFT.Foreground = slideShow.SlideButtonBrush; slideShow.PART_BTNLEFT.Background = slideShow.SlideButtonBrush; slideShow.PART_BTNLEFT.CoverBrush = slideShow.SlideButtonBrush; slideShow.PART_BTNRIGHT.Foreground = slideShow.SlideButtonBrush; slideShow.PART_BTNRIGHT.Background = slideShow.SlideButtonBrush; slideShow.PART_BTNRIGHT.CoverBrush = slideShow.SlideButtonBrush; } } /// /// 左右滑动动画的持续时间(单位:毫秒),若为0,则滑动时不使用动画。默认值为500毫秒。 /// public int AnimationDuration { get { return (int)GetValue(AnimationDurationProperty); } set { SetValue(AnimationDurationProperty, value); } } public static readonly DependencyProperty AnimationDurationProperty = DependencyProperty.Register("AnimationDuration", typeof(int), typeof(PUSlideShow), new PropertyMetadata(500, OnAnimationDurationChanged)); private static void OnAnimationDurationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var slideShow = d as PUSlideShow; slideShow.PART_INDICATOR.AnimationDuration = slideShow.AnimationDuration; } /// /// 是否允许滑动无限循环。 /// public bool Recyclable { get { return (bool)GetValue(RecyclableProperty); } set { SetValue(RecyclableProperty, value); } } public static readonly DependencyProperty RecyclableProperty = DependencyProperty.Register("Recyclable", typeof(bool), typeof(PUSlideShow), new PropertyMetadata(false)); /// /// 是否显示指示器。 /// public bool IsIndicatorShow { get { return (bool)GetValue(IsIndicatorShowProperty); } set { SetValue(IsIndicatorShowProperty, value); } } public static readonly DependencyProperty IsIndicatorShowProperty = DependencyProperty.Register("IsIndicatorShow", typeof(bool), typeof(PUSlideShow), new PropertyMetadata(true, OnIsIndicatorShowChanged)); private static void OnIsIndicatorShowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var slide = d as PUSlideShow; if (slide.IsIndicatorShow) slide.PART_INDICATOR.Visibility = Visibility.Visible; else slide.PART_INDICATOR.Visibility = Visibility.Hidden; } /// /// 指示器颜色。 /// public Brush IndicatorBrush { get { return (Brush)GetValue(IndicatorBrushProperty); } set { SetValue(IndicatorBrushProperty, value); } } public static readonly DependencyProperty IndicatorBrushProperty = DependencyProperty.Register("IndicatorBrush", typeof(Brush), typeof(PUSlideShow), new PropertyMetadata(new SolidColorBrush(Colors.DimGray), OnIndicatorBrushChanged)); private static void OnIndicatorBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var slideShow = d as PUSlideShow; slideShow.PART_INDICATOR.BorderBrush = slideShow.IndicatorBrush; slideShow.PART_INDICATOR.CoverBrush = slideShow.IndicatorBrush; } #endregion #region APIs private void Draw() { PART_INDICATOR.TotalIndex = Content.Count; foreach (var item in Content) { var grid = item as FrameworkElement; grid.Width = ActualWidth; grid.Height = ActualHeight; } } private void ChangeIndex() { if (Index < 1) { if (!Recyclable) { Index = 1; return; } else { Index = Content.Count; return; } } else if (Index > Content.Count) { if (!Recyclable) { Index = Content.Count; return; } else { Index = 1; return; } } if (Index == 1 && !Recyclable) PART_BTNLEFT.IsEnabled = false; else PART_BTNLEFT.IsEnabled = true; if (Index == Content.Count && !Recyclable) PART_BTNRIGHT.IsEnabled = false; else PART_BTNRIGHT.IsEnabled = true; if (isFirstTime || AnimationDuration == 0) { if (SlideDirection == Orientation.Horizontal) PART_STKMAIN.Margin = new Thickness(-1 * (Index - 1) * ActualWidth, 0, 0, 0); else PART_STKMAIN.Margin = new Thickness(0, -1 * (Index - 1) * ActualHeight, 0, 0); } else { if (SlideDirection == Orientation.Horizontal) { var anima = new ThicknessAnimation() { To = new Thickness(-1 * (Index - 1) * ActualWidth, 0, 0, 0), Duration = TimeSpan.FromMilliseconds(AnimationDuration), EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseInOut }, }; PART_STKMAIN.BeginAnimation(MarginProperty, anima); } else { var anima = new ThicknessAnimation() { To = new Thickness(0, -1 * (Index - 1) * ActualHeight, 0, 0), Duration = TimeSpan.FromMilliseconds(AnimationDuration), EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseInOut }, }; PART_STKMAIN.BeginAnimation(MarginProperty, anima); } } isFirstTime = false; } #endregion #region Sys private void BtnLeft_Click(object sender, RoutedEventArgs e) { Index--; } private void BtnRight_Click(object sender, RoutedEventArgs e) { Index++; } private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) { Draw(); ChangeIndex(); } #endregion } } ================================================ FILE: Panuon.UI/9_Special/PUSplitLine.cs ================================================ using System.Windows; using System.Windows.Controls; namespace Panuon.UI { public class PUSplitLine : Control { static PUSplitLine() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUSplitLine), new FrameworkPropertyMetadata(typeof(PUSplitLine))); } #region Property /// /// 分割线的停靠方向,默认为Bottom(底部)。 /// public Alignments Alignment { get { return (Alignments)GetValue(AlignmentProperty); } set { SetValue(AlignmentProperty, value); } } public static readonly DependencyProperty AlignmentProperty = DependencyProperty.Register("Alignment", typeof(Alignments), typeof(PUSplitLine), new PropertyMetadata(Alignments.Bottom)); public enum Alignments { Left,Top,Right,Bottom } #endregion } } ================================================ FILE: Panuon.UI/A0_TreeView/PUTreeView.cs ================================================ using Panuon.UI.Utils; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUTreeView : TreeView { static PUTreeView() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUTreeView), new FrameworkPropertyMetadata(typeof(PUTreeView))); } public override void OnApplyTemplate() { base.OnApplyTemplate(); } #region Event /// /// 选择了新项目事件。 /// public static readonly RoutedEvent ChoosedItemChangedEvent = EventManager.RegisterRoutedEvent("ChoosedItemChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUTreeView)); public event RoutedPropertyChangedEventHandler ChoosedItemChanged { add { AddHandler(ChoosedItemChangedEvent, value); } remove { RemoveHandler(ChoosedItemChangedEvent, value); } } internal void OnChoosedItemChanged(PUTreeViewItem oldItem, PUTreeViewItem newItem) { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(oldItem, newItem, ChoosedItemChangedEvent); RaiseEvent(arg); } #endregion #region Property [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("该属性对此控件无效。请使用BindingItems属性替代。", true)] public new IEnumerable ItemsSource { get { return (IEnumerable)GetValue(ItemsSourceProperty); } private set { SetValue(ItemsSourceProperty, value); } } [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("该属性对此控件无效。请该用ChoosedValuePath属性替代。", true)] public new string SelectedValuePath { get { return base.SelectedValuePath; } private set { base.SelectedValuePath = value; } } [EditorBrowsable(EditorBrowsableState.Never)] [ObsoleteAttribute("该属性对此控件无效。请该用ChoosedValue属性替代。", true)] public new object SelectedValue { get { return base.SelectedValue; } } [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("该属性对此控件无效。BindingItems属性中的Header属性即为要显示的内容。", true)] public new string DisplayMemberPath { get { return base.DisplayMemberPath; } private set { base.DisplayMemberPath = value; } } /// /// 获取或设置树视图的基本样式,默认值为General。 /// public TreeViewStyles TreeViewStyle { get { return (TreeViewStyles)GetValue(TreeViewStyleProperty); } set { SetValue(TreeViewStyleProperty, value); } } public static readonly DependencyProperty TreeViewStyleProperty = DependencyProperty.Register("TreeViewStyle", typeof(TreeViewStyles), typeof(PUTreeView), new PropertyMetadata(TreeViewStyles.General)); /// /// 获取或设置子项目的单行元素高度,默认值为40。 /// public double InnerHeight { get { return (double)GetValue(InnerHeightProperty); } set { SetValue(InnerHeightProperty, value); } } public static readonly DependencyProperty InnerHeightProperty = DependencyProperty.Register("InnerHeight", typeof(double), typeof(PUTreeView), new PropertyMetadata((double)40)); /// /// 获取或设置鼠标悬浮时遮罩层的背景颜色,默认值为#22666666。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUTreeView)); /// /// 鼠标悬浮时遮罩层的背景颜色,默认值为#44666666。 /// public Brush ChoosedBrush { get { return (Brush)GetValue(ChoosedBrushProperty); } set { SetValue(ChoosedBrushProperty, value); } } public static readonly DependencyProperty ChoosedBrushProperty = DependencyProperty.Register("ChoosedBrush", typeof(Brush), typeof(PUTreeView)); /// /// 获取被选中的元素。 /// public PUTreeViewItem ChoosedItem { get { return (PUTreeViewItem)GetValue(ChoosedItemProperty); } internal set { SetValue(ChoosedItemProperty, value); } } public static readonly DependencyProperty ChoosedItemProperty = DependencyProperty.Register("ChoosedItem", typeof(PUTreeViewItem), typeof(PUTreeView), new PropertyMetadata(OnChoosedItemChanged)); private static void OnChoosedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var treeView = d as PUTreeView; if (treeView.ChoosedItem == null) { treeView.ChoosedValue = null; } else { var value = treeView.ChoosedValuePath == ChoosedValuePaths.Header ? treeView.ChoosedItem.Header : treeView.ChoosedItem.Value; if (treeView.ChoosedValue != value) { treeView.isInternalSetChoosedValue = true; treeView.ChoosedValue = value; } } treeView.OnChoosedItemChanged(e.OldValue as PUTreeViewItem, e.NewValue as PUTreeViewItem); } /// /// 获取或设置是否需要展开父项的方式,默认为Click。 /// public ExpandModes ExpandMode { get { return (ExpandModes)GetValue(ExpandModeProperty); } set { SetValue(ExpandModeProperty, value); } } public static readonly DependencyProperty ExpandModeProperty = DependencyProperty.Register("ExpandMode", typeof(ExpandModes), typeof(PUTreeView), new PropertyMetadata(ExpandModes.Click)); /// /// 该属性指定了当子项目被选中时,ChoosedValue应呈现子项目的哪一个值。 /// 可选项为Header或Value,默认值为Header。 /// public ChoosedValuePaths ChoosedValuePath { get { return (ChoosedValuePaths)GetValue(ChoosedValuePathProperty); } set { SetValue(ChoosedValuePathProperty, value); } } public static readonly DependencyProperty ChoosedValuePathProperty = DependencyProperty.Register("ChoosedValuePath", typeof(ChoosedValuePaths), typeof(PUTreeView), new PropertyMetadata(ChoosedValuePaths.Header)); /// /// 获取被选中PUTreeViewItem的Header或Value属性(这取决于SelectedValuePath), /// 或根据设置的ChoosedValue来选中子项目。 /// public object ChoosedValue { get { return (object)GetValue(ChoosedValueProperty); } set { SetValue(ChoosedValueProperty, value); } } public static readonly DependencyProperty ChoosedValueProperty = DependencyProperty.Register("ChoosedValue", typeof(object), typeof(PUTreeView), new PropertyMetadata(OnChoosedValueChanged)); internal bool isInternalSetChoosedValue = false; private static void OnChoosedValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var treeView = d as PUTreeView; if (treeView.ChoosedValue == null) return; if (treeView.isInternalSetChoosedValue) { treeView.isInternalSetChoosedValue = false; return; } var tvi = treeView.ChoosedValuePath == ChoosedValuePaths.Header ? treeView.GetItemByHeader(treeView.ChoosedValue, true, false) : treeView.GetItemByValue(treeView.ChoosedValue, true, false); if (tvi != null) { if (!tvi.IsChoosed) tvi.IsChoosed = true; } else { if (treeView.ChoosedItem != null) { treeView.ChoosedItem.IsChoosed = false; treeView.ChoosedItem = null; } } } /// /// 用于TreeView的绑定。 /// public ObservableCollection BindingItems { get { return (ObservableCollection)GetValue(BindingItemsProperty); } set { SetValue(BindingItemsProperty, value); } } public static readonly DependencyProperty BindingItemsProperty = DependencyProperty.Register("BindingItems", typeof(ObservableCollection), typeof(PUTreeView), new PropertyMetadata(OnBindingItemsChanged)); private static void OnBindingItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var treeView = d as PUTreeView; if (treeView.BindingItems != null) { treeView.BindingItems.CollectionChanged -= treeView.BindingItemChanged; treeView.BindingItems.CollectionChanged += treeView.BindingItemChanged; } treeView.GenerateBindindItems(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } private void BindingItemChanged(object sender, NotifyCollectionChangedEventArgs e) { GenerateBindindItems(e); } #endregion #region APIs /// /// 通过标题选中子项。 /// 若标题不是值类型,则将逐一比较每一个可写属性的值是否相等。 /// /// 要匹配的标题。 public void ChooseItemByHeader(object header) { var tvi = GetItemByHeader(header, true, false); if (tvi != null) { if (!tvi.IsChoosed && !tvi.HasItems) tvi.IsChoosed = true; } else if (tvi == null) { if (ChoosedItem != null) { ChoosedItem.IsChoosed = false; ChoosedItem = null; } ChoosedValue = null; } } /// /// 通过Value获取子项。 /// 若Value不是值类型,则将逐一比较每一个可写属性的值是否相等。 /// /// 要匹配的值。 public void ChooseItemByValue(object value) { var tvi = GetItemByValue(value, true, false); if (tvi != null) { if (!tvi.IsChoosed && !tvi.HasItems) tvi.IsChoosed = true; } else if (tvi == null) { if (ChoosedItem != null) { ChoosedItem.IsChoosed = false; ChoosedItem = null; } ChoosedValue = null; } } #endregion #region Function /// /// 通过标题获取Item。 /// /// 要匹配的标题。 /// 在检索过程中是否自动折叠不是目标项的项目,并将目标项的父PUTreeViewItem展开。 /// 返回结果中是否包含含有子项的项目。 /// private PUTreeViewItem GetItemByHeader(object header, bool autoExpand = false, bool includeParent = true) { foreach (var item in Items) { var tvi = item as PUTreeViewItem; if (autoExpand) tvi.IsExpanded = false; var tvix = GetTreeViewItemByHeader(tvi, header, autoExpand, includeParent); if (tvix != null) { if (autoExpand) { var parent = tvix.Parent as PUTreeViewItem; if (parent != null) parent.IsExpanded = true; } return tvix; } } return null; } /// /// 通过Value获取Item。 /// /// 要匹配的Value。 /// 在检索过程中是否自动折叠不是目标项的项目,并将目标项的父PUTreeViewItem展开。 /// 返回结果中是否包含含有子项的项目。 /// private PUTreeViewItem GetItemByValue(object value, bool autoExpand = false, bool includeParent = true) { foreach (var item in Items) { var tvi = item as PUTreeViewItem; if (autoExpand) tvi.IsExpanded = false; var tvix = GetTreeViewItemByValue(tvi, value, autoExpand, includeParent); if (tvix != null) { if (autoExpand) { var parent = tvix.Parent as PUTreeViewItem; if (parent != null) parent.IsExpanded = true; } return tvix; } } return null; } private PUTreeViewItem GetTreeViewItemByHeader(PUTreeViewItem item, object header, bool autoExpand, bool includeParent) { if ((includeParent || !item.HasItems) && item.Header != null && item.Header.IsEqual(header)) return item; if (item.HasItems) { foreach (var tvi in item.Items) { if (autoExpand) (tvi as PUTreeViewItem).IsExpanded = false; var tvix = GetTreeViewItemByHeader(tvi as PUTreeViewItem, header, autoExpand, includeParent); if (tvix != null) { if (autoExpand) (tvi as PUTreeViewItem).IsExpanded = true; return tvix; } } } return null; } private PUTreeViewItem GetTreeViewItemByValue(PUTreeViewItem item, object value, bool autoExpand, bool includeParent) { if ((includeParent || !item.HasItems) && item.Value != null && item.Value.IsEqual(value)) return item; if (item.HasItems) { foreach (var tvi in item.Items) { if (autoExpand) (tvi as PUTreeViewItem).IsExpanded = false; var tvix = GetTreeViewItemByValue(tvi as PUTreeViewItem, value, autoExpand, includeParent); if (tvix != null) { if (autoExpand) (tvi as PUTreeViewItem).IsExpanded = true; return tvix; } } } return null; } private void GenerateBindindItems(NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Reset: var _choosedValue = ChoosedValue; ChoosedValue = null; Items.Clear(); if (BindingItems == null) break; foreach (var item in BindingItems) { var treeViewItem = GenerateTreeViewItem(item); Items.Add(treeViewItem); } ChoosedValue = _choosedValue; break; case NotifyCollectionChangedAction.Add: foreach (var item in e.NewItems) { var treeViewItem = GenerateTreeViewItem(item as PUTreeViewItemModel); Items.Insert(e.NewStartingIndex, treeViewItem); } break; case NotifyCollectionChangedAction.Remove: foreach (var item in e.OldItems) { Items.RemoveAt(e.OldStartingIndex); } break; case NotifyCollectionChangedAction.Replace: foreach (var item in e.NewItems) { var tabItem = GenerateTreeViewItem(item as PUTreeViewItemModel); Items[e.OldStartingIndex] = tabItem; } break; case NotifyCollectionChangedAction.Move: { var tabItem = Items[e.OldStartingIndex]; Items.RemoveAt(e.OldStartingIndex); Items.Insert(e.NewStartingIndex, tabItem); } break; } if (ChoosedValue != null) { if (ChoosedValuePath == ChoosedValuePaths.Header) ChooseItemByHeader(ChoosedValue); else ChooseItemByValue(ChoosedValue); } } private PUTreeViewItem GenerateTreeViewItem(PUTreeViewItemModel model) { var treeViewItem = new PUTreeViewItem() { Uid = model.Uid, Header = model.Header, Value = model.Value, Padding = model.Padding, }; if (model.ToolTip != null) treeViewItem.ToolTip = model.ToolTip; foreach (var child in Generate(model.Items)) { treeViewItem.Items.Add(child); } model.PropertyChanged += delegate { treeViewItem.Header = model.Header; treeViewItem.Value = model.Value; treeViewItem.Padding = model.Padding; if (model.ToolTip != null) treeViewItem.ToolTip = model.ToolTip; treeViewItem.Items.Clear(); foreach (var child in Generate(model.Items)) { treeViewItem.Items.Add(child); } }; return treeViewItem; } private IEnumerable Generate(IList models) { if (models == null || models.Count == 0) yield break; foreach (var model in models) { var item = new UI.PUTreeViewItem() { Uid = model.Uid, Header = model.Header, Value = model.Value, Padding = model.Padding, }; if (model.ToolTip != null) item.ToolTip = model.ToolTip; foreach (var child in Generate(model.Items)) { item.Items.Add(child); } yield return item; } } #endregion } } ================================================ FILE: Panuon.UI/A0_TreeView/PUTreeViewItem.cs ================================================ using System; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUTreeViewItem : TreeViewItem { #region Identity private PUTreeView ParentTreeView { get { if (_parentTreeView == null) { var parent = this.Parent; while (parent != null && parent.GetType() != typeof(PUTreeView)) { parent = (parent as PUTreeViewItem).Parent; } _parentTreeView = (parent as PUTreeView); } return _parentTreeView; } } private PUTreeView _parentTreeView; #endregion static PUTreeViewItem() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUTreeViewItem), new FrameworkPropertyMetadata(typeof(PUTreeViewItem))); } public override void OnApplyTemplate() { base.OnApplyTemplate(); if (IsChoosed) { ParentTreeView.ChoosedItem = this; } var stk = VisualTreeHelper.GetChild(this, 0) as StackPanel; stk.MouseLeftButtonDown += Stk_MouseLeftButtonDown; } #region Property [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("请使用IsChoosed属性。")] public new bool IsSelected { get { return base.IsSelected; } internal set { base.IsSelected = value; } } /// /// 获取或设置该子项是否已被选中,含有子项目的行项目无法被选中。 /// public bool IsChoosed { get { return (bool)GetValue(IsChoosedProperty); } set { SetValue(IsChoosedProperty, value); } } public static readonly DependencyProperty IsChoosedProperty = DependencyProperty.Register("IsChoosed", typeof(bool), typeof(PUTreeViewItem), new PropertyMetadata(false, OnIsChoosedChanged)); private static void OnIsChoosedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var item = d as PUTreeViewItem; if (item.IsChoosed) { if(item.ParentTreeView.ChoosedItem != null) item.ParentTreeView.ChoosedItem.IsChoosed = false; item.ParentTreeView.ChoosedItem = item; } } /// /// 获取或设置该子项可以携带的值,不会对前端显示造成影响。 /// public object Value { get { return (object)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(PUTreeViewItem)); #endregion #region Sys private void Stk_MouseLeftButtonDown(object sender, RoutedEventArgs e) { if (!HasItems) { IsSelected = true; if (IsChoosed == false) { IsChoosed = true; } else { e.Handled = true; return; } } else { IsSelected = false; if (ParentTreeView.ExpandMode == ExpandModes.Click) IsExpanded = !IsExpanded; } } #endregion } } ================================================ FILE: Panuon.UI/A1_Slider/PUSlider.xaml ================================================  ================================================ FILE: Panuon.UI/A1_Slider/PUSlider.xaml.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { /// /// PUSlider.xaml 的交互逻辑 /// public partial class PUSlider : UserControl { private double _delta = 0.0; private double _totalWidth = 0.0; public PUSlider() { InitializeComponent(); Foreground = new SolidColorBrush(Colors.LightGray); Loaded += delegate { RecheckSlideBar(); }; } private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { var left = 0.0; if (e.HorizontalChange >= _delta/2) { var per = (int)(e.HorizontalChange / _delta) + 1; left = Canvas.GetLeft(tmbToggle) + _delta * per; if (Value < Maximuim - per) Value += per; else Value = Maximuim; if (left > canvas.ActualWidth - tmbToggle.ActualWidth) { left = canvas.ActualWidth - tmbToggle.ActualWidth; Value = Maximuim; } } else if (e.HorizontalChange <= -_delta/2) { var per = (int)(e.HorizontalChange / -_delta) + 1; left = Canvas.GetLeft(tmbToggle) - _delta * per; if(Value > Minimuim + per) Value -= per; else Value = Minimuim; if (left < 0) { left = 0; Value = Minimuim; } } else return; bdrCover.Width = left; Canvas.SetLeft(tmbToggle, left); } #region RoutedEvent /// /// 进度改变事件。 /// public static readonly RoutedEvent ValueChangedEvent = EventManager.RegisterRoutedEvent("ValueChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUSlider)); public event RoutedPropertyChangedEventHandler ValueChanged { add { AddHandler(ValueChangedEvent, value); } remove { RemoveHandler(ValueChangedEvent, value); } } internal void OnValueChanged(int oldValue, int newValue) { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(oldValue, newValue, ValueChangedEvent); RaiseEvent(arg); } #endregion #region Property /// /// 获取或设置滑块覆盖区域(左侧)的颜色。默认值为#696969。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUSlider), new PropertyMetadata(new SolidColorBrush(Colors.DimGray))); /// /// 获取或设置滑块的最大值。默认值为100。 /// public int Maximuim { get { return (int)GetValue(MaximuimProperty); } set { SetValue(MaximuimProperty, value); } } public static readonly DependencyProperty MaximuimProperty = DependencyProperty.Register("Maximuim", typeof(int), typeof(PUSlider), new PropertyMetadata(100, OnValuesChanged)); /// /// 获取或设置滑块的最小值。默认值为0。 /// public int Minimuim { get { return (int)GetValue(MinimuimProperty); } set { SetValue(MinimuimProperty, value); } } public static readonly DependencyProperty MinimuimProperty = DependencyProperty.Register("Minimuim", typeof(int), typeof(PUSlider), new PropertyMetadata(0, OnValuesChanged)); /// /// 获取或设置滑块当前选择的值。默认值为0。 /// public int Value { get { return (int)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(int), typeof(PUSlider), new PropertyMetadata(0,OnValuesChanged)); private static void OnValuesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var slider = d as PUSlider; if (!slider.IsLoaded) return; if (slider.RecheckSlideBar()) { slider.OnValueChanged((int)e.OldValue, (int)e.NewValue); } } #endregion private bool RecheckSlideBar() { if (Value < Minimuim) { Value = Minimuim; return false; } if (Value > Maximuim) { Value = Maximuim; return false; } canvas.Width = this.ActualWidth; _totalWidth = (canvas.ActualWidth - tmbToggle.ActualWidth); _delta = _totalWidth / (Maximuim - Minimuim); bdrCover.Width = (Value - Minimuim) * _delta; Canvas.SetLeft(tmbToggle, (Value - Minimuim) * _delta); return true; } private void slider_SizeChanged(object sender, SizeChangedEventArgs e) { if (Minimuim > Maximuim) Minimuim = Maximuim - 1; RecheckSlideBar(); } } } ================================================ FILE: Panuon.UI/A2_TabControl/PUTabControl.cs ================================================ using Panuon.UI.Utils; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UI { public class PUTabControl : TabControl { #region Identity private TabPanel tabPanel { get { if (_tabPanel == null) { var scrollViewer = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(this, 0), 0), 1), 0) as ScrollViewer; _tabPanel = (scrollViewer.Content as VirtualizingStackPanel).Children[0] as TabPanel; } return _tabPanel; } } private TabPanel _tabPanel; #endregion static PUTabControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUTabControl), new FrameworkPropertyMetadata(typeof(PUTabControl))); } public override void OnApplyTemplate() { base.OnApplyTemplate(); tabPanel.SizeChanged += delegate { CheckSideButton(); }; tabPanel.MouseWheel += ScrollViewer_MouseWheel; } #region Sys protected override void OnSelectionChanged(SelectionChangedEventArgs e) { if (SelectedValuePath == SelectedValuePaths.Header) SelectedValue = SelectedItem == null ? "" : (SelectedItem as PUTabItem).Header.ToString(); else SelectedValue = SelectedItem == null ? null : (SelectedItem as PUTabItem).Value; base.OnSelectionChanged(e); } private void ScrollViewer_MouseWheel(object sender, MouseWheelEventArgs e) { var tabPanel = sender as TabPanel; var scrollViewer = (tabPanel.Parent as VirtualizingStackPanel).Parent as ScrollViewer; if(TabStripPlacement == Dock.Top || TabStripPlacement == Dock.Bottom) { if (e.Delta > 0) scrollViewer.LineLeft(); else scrollViewer.LineRight(); } else { if (e.Delta > 0) scrollViewer.LineUp(); else scrollViewer.LineDown(); } if (scrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Visible || scrollViewer.ComputedHorizontalScrollBarVisibility == Visibility.Visible) e.Handled = true; } #endregion #region RoutedEvent /// /// 用户点击删除按钮事件。 /// public static readonly RoutedEvent DeleteItemEvent = EventManager.RegisterRoutedEvent("DeleteItem", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUTabControl)); public event RoutedPropertyChangedEventHandler DeleteItem { add { AddHandler(DeleteItemEvent, value); } remove { RemoveHandler(DeleteItemEvent, value); } } internal void OnDeleteItem(PUTabItem oldItem, PUTabItem newItem) { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(oldItem, newItem, DeleteItemEvent); RaiseEvent(arg); } #endregion #region Property [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("该属性对此控件无效。请使用BindingItems属性替代。", true)] public new IEnumerable ItemsSource { get { return base.ItemsSource; } private set { base.ItemsSource = value; } } [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("该属性对此控件无效。BindingItems属性中的Header属性即为要显示的内容。", true)] public new string DisplayMemberPath { get { return base.DisplayMemberPath; } private set { base.DisplayMemberPath = value; } } /// /// 获取或设置选项卡的基础样式。默认值为General。 /// public TabControlStyles TabControlStyle { get { return (TabControlStyles)GetValue(TabControlStyleProperty); } set { SetValue(TabControlStyleProperty, value); } } public static readonly DependencyProperty TabControlStyleProperty = DependencyProperty.Register("TabControlStyle", typeof(TabControlStyles), typeof(PUTabControl), new PropertyMetadata(TabControlStyles.General)); /// /// 获取或设置当子项设置为可删除时,用户点击删除按钮后应执行的操作。默认为删除项目并触发DeleteItem路由事件。 /// public DeleteModes DeleteMode { get { return (DeleteModes)GetValue(DeleteModeProperty); } set { SetValue(DeleteModeProperty, value); } } public static readonly DependencyProperty DeleteModeProperty = DependencyProperty.Register("DeleteMode", typeof(DeleteModes), typeof(PUTabControl), new PropertyMetadata(DeleteModes.Delete)); /// /// 获取或设置当某个子项被选中时的前景色。默认值为灰黑色(#3E3E3E)。 /// public Brush SelectedBrush { get { return (Brush)GetValue(SelectedBrushProperty); } set { SetValue(SelectedBrushProperty, value); } } public static readonly DependencyProperty SelectedBrushProperty = DependencyProperty.Register("SelectedBrush", typeof(Brush), typeof(PUTabControl)); /// /// 该属性指定了当子项目被选中时,SelectedValue应呈现子项目的哪一个值。 /// 可选项为Header或Value,默认值为Header。 /// public new SelectedValuePaths SelectedValuePath { get { return (SelectedValuePaths)GetValue(SelectedValuePathProperty); } set { SetValue(SelectedValuePathProperty, value); } } public new static readonly DependencyProperty SelectedValuePathProperty = DependencyProperty.Register("SelectedValuePath", typeof(SelectedValuePaths), typeof(PUTabControl), new PropertyMetadata(SelectedValuePaths.Header)); /// /// 获取被选中PUTabItem的Header或Value属性(这取决于SelectedValuePath),或反向选中子项目。 /// public new object SelectedValue { get { return (object)GetValue(SelectedValueProperty); } set { SetValue(SelectedValueProperty, value); } } public new static readonly DependencyProperty SelectedValueProperty = DependencyProperty.Register("SelectedValue", typeof(object), typeof(PUTabControl), new PropertyMetadata("", OnSelectedValueChanged)); private static void OnSelectedValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var tabControl = d as PUTabControl; if (tabControl.SelectedValue == null) { return; } if (e.NewValue == e.OldValue) return; var selectedItem = tabControl.SelectedItem as PUListBoxItem; foreach (var item in tabControl.Items) { var tabItem = item as PUTabItem; if ((tabControl.SelectedValuePath == SelectedValuePaths.Header ? (tabItem.Content == null ? false : tabItem.Content.Equals(tabControl.SelectedValue)) : (tabItem.Value == null ? false : tabItem.Value.Equals(tabControl.SelectedValue)))) { if (!tabItem.IsSelected) { tabItem.IsSelected = true; } return; } } } /// /// 若使用MVVM绑定,请使用此依赖属性。 /// public ObservableCollection BindingItems { get { return (ObservableCollection)GetValue(BindingItemsProperty); } set { SetValue(BindingItemsProperty, value); } } public static readonly DependencyProperty BindingItemsProperty = DependencyProperty.Register("BindingItems", typeof(ObservableCollection), typeof(PUTabControl), new PropertyMetadata(OnBindingItemsChanged)); private static void OnBindingItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var tabControl = d as PUTabControl; if(tabControl.BindingItems != null) { tabControl.BindingItems.CollectionChanged -= tabControl.BindingItemChanged; tabControl.BindingItems.CollectionChanged += tabControl.BindingItemChanged; } tabControl.GenerateBindindItems(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } private void BindingItemChanged(object sender, NotifyCollectionChangedEventArgs e) { GenerateBindindItems(e); } #endregion #region Internal Property /// /// 是否允许显示选项卡两侧的按钮。 /// internal Visibility SideButtonVisibility { get { return (Visibility)GetValue(SideButtonVisibilityProperty); } set { SetValue(SideButtonVisibilityProperty, value); } } internal static readonly DependencyProperty SideButtonVisibilityProperty = DependencyProperty.Register("SideButtonVisibility", typeof(Visibility), typeof(PUTabControl), new PropertyMetadata(Visibility.Collapsed)); #endregion #region Command /// /// 向左命令 /// public ICommand LeftCommand { get { return _leftCommand; } } private ICommand _leftCommand = new PUTabControlLeftCommand(); /// /// 向右命令 /// public ICommand RightCommand { get { return _rightCommand; } } private ICommand _rightCommand = new PUTabControlRightCommand(); /// /// 向左命令 /// public ICommand UpCommand { get { return _upCommand; } } private ICommand _upCommand = new PUTabControlUpCommand(); /// /// 向左命令 /// public ICommand DownCommand { get { return _downCommand; } } private ICommand _downCommand = new PUTabControlDownCommand(); #endregion #region APIs public void SelectItemByContent(object content) { var tabItem = GetItemByContent(content); if (tabItem != null) tabItem.IsSelected = true; } public void SelectItemByValue(object value) { var tabItem = GetItemByValue(value); if (tabItem != null) tabItem.IsSelected = true; } #endregion #region Function private void CheckSideButton() { if (tabPanel == null) return; if(TabStripPlacement == Dock.Top || TabStripPlacement == Dock.Bottom) { if (ActualWidth <= tabPanel.ActualWidth) { SideButtonVisibility = Visibility.Visible; } else { SideButtonVisibility = Visibility.Collapsed; } } else { if (ActualHeight <= tabPanel.ActualHeight) { SideButtonVisibility = Visibility.Visible; } else { SideButtonVisibility = Visibility.Collapsed; } } } private void GenerateBindindItems(NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Reset: var _selectedValue = SelectedValue; SelectedValue = null; Items.Clear(); if (BindingItems == null) break; foreach (var item in BindingItems) { var tabItem = GenerateTabItem(item); Items.Add(tabItem); } SelectedValue = _selectedValue; break; case NotifyCollectionChangedAction.Add: foreach(var item in e.NewItems) { var tabItem = GenerateTabItem(item as PUTabItemModel); Items.Insert(e.NewStartingIndex, tabItem); } break; case NotifyCollectionChangedAction.Remove: foreach (var item in e.OldItems) { Items.RemoveAt(e.OldStartingIndex); } break; case NotifyCollectionChangedAction.Replace: foreach (var item in e.NewItems) { var tabItem = GenerateTabItem(item as PUTabItemModel); Items[e.OldStartingIndex] = tabItem; } break; case NotifyCollectionChangedAction.Move: { var tabItem = Items[e.OldStartingIndex]; Items.RemoveAt(e.OldStartingIndex); Items.Insert(e.NewStartingIndex, tabItem); } break; } if (SelectedValue != null) { if (SelectedValuePath == SelectedValuePaths.Header) SelectItemByContent(SelectedValue); else SelectItemByValue(SelectedValue); } } private PUTabItem GenerateTabItem(PUTabItemModel model) { var tabItem = new PUTabItem() { Uid = model.Uid, Header = model.Header, Content = model.Content, Height = model.Height, Icon = model.Icon, Value = model.Value, CanDelete = model.CanDelete, }; if (Items.Count == 0) tabItem.IsSelected = true; model.PropertyChanged += delegate { tabItem.Header = model.Header; tabItem.Content = model.Content; tabItem.Height = model.Height; tabItem.Icon = model.Icon; tabItem.Value = model.Value; tabItem.CanDelete = model.CanDelete; }; return tabItem; } private PUTabItem GetItemByContent(object content) { foreach (var item in Items) { var tabItem = item as PUTabItem; if (tabItem == null) throw new Exception("PUTabControl的子项必须是PUTabItem。"); if (tabItem.Content.IsEqual(content)) return tabItem; } return null; } private PUTabItem GetItemByValue(object value) { foreach (var item in Items) { var tabItem = item as PUTabItem; if (tabItem == null) throw new Exception("PUTabControl的子项必须是PUTabItem。"); if (tabItem.Value.IsEqual(value)) return tabItem; } return null; } #endregion } internal sealed class PUTabControlLeftCommand : ICommand { event EventHandler ICommand.CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return true; } public void Execute(object parameter) { var stkMain = (parameter as ScrollViewer); if (stkMain.HorizontalOffset >= 20) stkMain.ScrollToHorizontalOffset(stkMain.HorizontalOffset - 20); else stkMain.ScrollToHorizontalOffset(0); } } internal sealed class PUTabControlRightCommand : ICommand { event EventHandler ICommand.CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return true; } public void Execute(object parameter) { var scrollViewer = (parameter as ScrollViewer); if (scrollViewer.HorizontalOffset <= scrollViewer.ActualWidth - 20) scrollViewer.ScrollToHorizontalOffset(scrollViewer.HorizontalOffset + 20); else scrollViewer.ScrollToHorizontalOffset(scrollViewer.ActualWidth); } } internal sealed class PUTabControlUpCommand : ICommand { event EventHandler ICommand.CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return true; } public void Execute(object parameter) { var stkMain = (parameter as ScrollViewer); if (stkMain.VerticalOffset >= 20) stkMain.ScrollToVerticalOffset(stkMain.VerticalOffset - 20); else stkMain.ScrollToVerticalOffset(0); } } internal sealed class PUTabControlDownCommand : ICommand { event EventHandler ICommand.CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return true; } public void Execute(object parameter) { var scrollViewer = (parameter as ScrollViewer); if (scrollViewer.VerticalOffset <= scrollViewer.ActualHeight - 20) scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + 20); else scrollViewer.ScrollToVerticalOffset(scrollViewer.ActualHeight); } } } ================================================ FILE: Panuon.UI/A2_TabControl/PUTabItem.cs ================================================ using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace Panuon.UI { public class PUTabItem : TabItem { static PUTabItem() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUTabItem), new FrameworkPropertyMetadata(typeof(PUTabItem))); } #region Property /// /// 获取或设置删除按钮的显示状态。 /// public bool CanDelete { get { return (bool)GetValue(CanDeleteProperty); } set { SetValue(CanDeleteProperty, value); } } public static readonly DependencyProperty CanDeleteProperty = DependencyProperty.Register("CanDelete", typeof(bool), typeof(PUTabItem), new PropertyMetadata(false)); /// /// 获取或设置显示在选项卡前的图标,默认值为空。 /// public object Icon { get { return (object)GetValue(IconProperty); } set { SetValue(IconProperty, value); } } public static readonly DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(object), typeof(PUTabItem)); /// /// 获取或设置该子项可以携带的值,不会对前端显示造成影响。 /// public object Value { get { return (object)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(PUTabItem)); #endregion public ICommand DeleteCommand { get { return _deleteCommand; } } private ICommand _deleteCommand = new PUTabItemDeleteCommand(); internal sealed class PUTabItemDeleteCommand : ICommand { event EventHandler ICommand.CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return true; } public void Execute(object parameter) { var tabItem = (parameter as PUTabItem); var tabControl = tabItem.Parent as PUTabControl; if (tabControl.DeleteMode == DeleteModes.Delete) { if (tabControl.BindingItems != null && !String.IsNullOrEmpty((tabItem.Uid))) { var model = tabControl.BindingItems.FirstOrDefault(x => x.Uid == tabItem.Uid); if (model != null) tabControl.BindingItems.Remove(model); else tabControl.Items.Remove(tabItem); } else { tabControl.Items.Remove(tabItem); } } tabControl.OnDeleteItem(null, tabItem); } } } } ================================================ FILE: Panuon.UI/A3_ListBox/PUListBox.cs ================================================ using System; using System.Collections; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUListBox : ListBox { static PUListBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUListBox), new FrameworkPropertyMetadata(typeof(PUListBox))); } protected override void OnSelectionChanged(SelectionChangedEventArgs e) { if (SelectedValuePath == SelectedValuePaths.Header) SelectedValue = SelectedItem == null ? "" : (SelectedItem as PUListBoxItem).Content; else SelectedValue = SelectedItem == null ? null : (SelectedItem as PUListBoxItem).Value; base.OnSelectionChanged(e); } #region Property [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("该属性对此控件无效。请使用BindingItems属性替代。",true)] public new IEnumerable ItemsSource { get { return (IEnumerable)GetValue(ItemsSourceProperty); } private set { SetValue(ItemsSourceProperty, value); } } public new static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(PUListBox)); /// /// 该属性指定了当子项目被选中时,SelectedValue应呈现子项目的哪一个值。默认值为Header。 /// public new SelectedValuePaths SelectedValuePath { get { return (SelectedValuePaths)GetValue(SelectedValuePathProperty); } set { SetValue(SelectedValuePathProperty, value); } } public new static readonly DependencyProperty SelectedValuePathProperty = DependencyProperty.Register("SelectedValuePath", typeof(SelectedValuePaths), typeof(PUListBox), new PropertyMetadata(SelectedValuePaths.Header)); /// /// 获取被选中PUTabItem的Header(即ListBoxItem的Content属性)或Value属性(这取决于SelectedValuePath),或反向选中子项目。 /// public new object SelectedValue { get { return (object)GetValue(SelectedValueProperty); } set { SetValue(SelectedValueProperty, value); } } public new static readonly DependencyProperty SelectedValueProperty = DependencyProperty.Register("SelectedValue", typeof(object), typeof(PUListBox), new PropertyMetadata("", OnSelectedValueChanged)); private static void OnSelectedValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var listBox = d as PUListBox; if (listBox.SelectedValue == null) { return; } if (e.NewValue == e.OldValue) return; var selectedItem = listBox.SelectedItem as PUListBoxItem; foreach (var item in listBox.Items) { var listBoxItem = item as PUListBoxItem; if ((listBox.SelectedValuePath == SelectedValuePaths.Header ? (listBoxItem.Content == null ? false : listBoxItem.Content.Equals(listBox.SelectedValue)) : (listBoxItem.Value == null ? false : listBoxItem.Value.Equals(listBox.SelectedValue)))) { if (!listBoxItem.IsSelected) { listBoxItem.IsSelected = true; listBox.ScrollIntoView(listBoxItem); } return; } } } /// /// 获取或设置当鼠标悬浮时ListBoxItem的背景色。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUListBox)); /// /// 获取或设置当ListBoxItem被选中时的背景色。 /// public Brush SelectedBrush { get { return (Brush)GetValue(SelectedBrushProperty); } set { SetValue(SelectedBrushProperty, value); } } public static readonly DependencyProperty SelectedBrushProperty = DependencyProperty.Register("SelectedBrush", typeof(Brush), typeof(PUListBox)); /// /// 获取或设置当搜索ListBoxItem时,ListBoxItem被找到时应呈现的背景色。 /// public Brush SearchBrush { get { return (Brush)GetValue(SearchBrushProperty); } set { SetValue(SearchBrushProperty, value); } } public static readonly DependencyProperty SearchBrushProperty = DependencyProperty.Register("SearchBrush", typeof(Brush), typeof(PUListBox)); /// /// 若使用MVVM绑定,请使用此依赖属性。 /// public ObservableCollection BindingItems { get { return (ObservableCollection)GetValue(BindingItemsProperty); } set { SetValue(BindingItemsProperty, value); } } public static readonly DependencyProperty BindingItemsProperty = DependencyProperty.Register("BindingItems", typeof(ObservableCollection), typeof(PUListBox), new PropertyMetadata(null, OnBindingItemsChanged)); private static void OnBindingItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var listBox = d as PUListBox; if (listBox.BindingItems != null) { listBox.BindingItems.CollectionChanged -= listBox.BindingItemChanged; listBox.BindingItems.CollectionChanged += listBox.BindingItemChanged; } listBox.GenerateBindindItems(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } private void BindingItemChanged(object sender, NotifyCollectionChangedEventArgs e) { GenerateBindindItems(e); } #endregion #region APIs /// /// 通过内容选中项目。 /// 若内容不是值类型,则将逐一比较其中每一个可写属性的值是否相等。 /// /// 要匹配的内容。 public void SelectItemByContent(object content) { var item = GetItemByContent(content); if (!item.IsSelected) item.IsSelected = true; } /// /// 通过Value选中项目。 /// 若Value不是值类型,则将逐一比较其中每一个可写属性的值是否相等。 /// /// 要匹配的Value public void SelectItemByValue(object value) { var item = GetItemByValue(value); if (!item.IsSelected) item.IsSelected = true; } /// /// 通过内容查询符合条件的第一个子项,滚动到该项目并高亮(子项的内容须为string类型)。 /// /// 子项的内容。 /// 是否允许模糊查询。 public void SearchItemByContent(string content, bool allowFuzzySearch = true) { foreach (var item in Items) { var listBoxItem = item as PUListBoxItem; if (listBoxItem.Content == null ? false : allowFuzzySearch ? listBoxItem.Content.ToString().Contains(content) : listBoxItem.Content.ToString() == content) { ScrollIntoView(listBoxItem); listBoxItem.OnSearched(); return; } } } /// /// 通过Value查询符合条件的第一个子项,滚动到该项目并高亮。 /// public void SearchItemByValue(object value) { var item = GetItemByValue(value); if (item == null) return; ScrollIntoView(item); item.OnSearched(); } #endregion #region Function /// /// 通过Value获取符合条件的第一个子项。 /// private PUListBoxItem GetItemByValue(object value) { foreach (var item in Items) { var listBoxItem = item as PUListBoxItem; if (listBoxItem.Value == null ? false : listBoxItem.Value.Equals(value)) return listBoxItem; } return null; } /// /// 通过内容获取符合条件的第一个子项。 /// private PUListBoxItem GetItemByContent(object content) { foreach (var item in Items) { var listBoxItem = item as PUListBoxItem; if (listBoxItem.Content == null ? false : listBoxItem.Content.Equals(content)) return listBoxItem; } return null; } private void GenerateBindindItems(NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Reset: var selectedValue = SelectedValue; SelectedValue = null; Items.Clear(); if (BindingItems == null) break; foreach (var item in BindingItems) { var tabItem = GenerateComboBoxItem(item); Items.Add(tabItem); } SelectedValue = selectedValue; break; case NotifyCollectionChangedAction.Add: foreach (var item in e.NewItems) { var tabItem = GenerateComboBoxItem(item as PUListBoxItemModel); Items.Insert(e.NewStartingIndex, tabItem); } break; case NotifyCollectionChangedAction.Remove: foreach (var item in e.OldItems) { Items.RemoveAt(e.OldStartingIndex); } break; case NotifyCollectionChangedAction.Replace: foreach (var item in e.NewItems) { var tabItem = GenerateComboBoxItem(item as PUListBoxItemModel); Items[e.OldStartingIndex] = tabItem; } break; case NotifyCollectionChangedAction.Move: { var tabItem = Items[e.OldStartingIndex]; Items.RemoveAt(e.OldStartingIndex); Items.Insert(e.NewStartingIndex, tabItem); } break; } if(SelectedValue != null) { if (SelectedValuePath == SelectedValuePaths.Header) SelectItemByContent(SelectedValue); else SelectItemByValue(SelectedValue); } } private PUListBoxItem GenerateComboBoxItem(PUListBoxItemModel model) { var comboBoxItem = new PUListBoxItem() { Uid = model.Uid, Content = model.Header, Value = model.Value, }; if (Items.Count == 0) comboBoxItem.IsSelected = true; model.PropertyChanged += delegate { comboBoxItem.Content = model.Header; comboBoxItem.Value = model.Value; }; return comboBoxItem; } #endregion } } ================================================ FILE: Panuon.UI/A3_ListBox/PUListBoxItem.cs ================================================ using System.Windows; using System.Windows.Controls; namespace Panuon.UI { public class PUListBoxItem : ListBoxItem { static PUListBoxItem() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUListBoxItem), new FrameworkPropertyMetadata(typeof(PUListBoxItem))); } #region RoutedEvent /// /// 当子项被搜索到时,触发此事件。 /// public static readonly RoutedEvent SearchedEvent = EventManager.RegisterRoutedEvent("Searched", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUListBoxItem)); public event RoutedPropertyChangedEventHandler Searched { add { AddHandler(SearchedEvent, value); } remove { RemoveHandler(SearchedEvent, value); } } internal void OnSearched() { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(null, this, SearchedEvent); RaiseEvent(arg); } #endregion #region Property /// /// 获取或设置该子项可以携带的值,仅用于标记该子项的实际内容,不会对前端显示造成影响。 /// public object Value { get { return (object)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(PUListBoxItem)); #endregion } } ================================================ FILE: Panuon.UI/A4_DatePicker/PUDatePicker.xaml ================================================  ================================================ FILE: Panuon.UI/A4_DatePicker/PUDatePicker.xaml.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; namespace Panuon.UI { /// /// DatePicker.xaml 的交互逻辑 /// public partial class PUDatePicker : UserControl { public PUDatePicker() { InitializeComponent(); } public override void OnApplyTemplate() { base.OnApplyTemplate(); Loaded += delegate { ReLoad(); }; } #region Property /// /// 获取或设置主题颜色,默认值为#3E3E3E。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUDatePicker), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")))); /// /// 获取或设置可以选择的最大日期。该属性不能限制用户选择的时间, /// public DateTime? MaxDateTime { get { return (DateTime?)GetValue(MaxDateTimeProperty); } set { SetValue(MaxDateTimeProperty, value); } } public static readonly DependencyProperty MaxDateTimeProperty = DependencyProperty.Register("MaxDateTime", typeof(DateTime?), typeof(PUDatePicker), new PropertyMetadata(OnMaxDateTimeChanged)); private static void OnMaxDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var picker = d as PUDatePicker; if (!picker.IsLoaded) return; picker.CheckDateTimeLimit(); } /// /// 获取或设置可以选择的最小日期。该属性不能限制用户选择的时间, /// public DateTime? MinDateTime { get { return (DateTime?)GetValue(MinDateTimeProperty); } set { SetValue(MinDateTimeProperty, value); } } public static readonly DependencyProperty MinDateTimeProperty = DependencyProperty.Register("MinDateTime", typeof(DateTime?), typeof(PUDatePicker), new PropertyMetadata(OnMinDateTimeChanged)); private static void OnMinDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var picker = d as PUDatePicker; if (!picker.IsLoaded) return; picker.CheckDateTimeLimit(); } /// /// 获取或设置当前选中的日期和时间。 /// public DateTime SelectedDateTime { get { return (DateTime)GetValue(SelectedDateTimeProperty); } set { SetValue(SelectedDateTimeProperty, value); } } public static readonly DependencyProperty SelectedDateTimeProperty = DependencyProperty.Register("SelectedDateTime", typeof(DateTime), typeof(PUDatePicker), new PropertyMetadata(DateTime.Now.Date, OnSelectedDateTimeChanged)); private static void OnSelectedDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue == e.OldValue) return; var picker = d as PUDatePicker; if (!picker.IsLoaded) return; var oldDate = (DateTime)e.OldValue; var newDate = (DateTime)e.NewValue; if (picker.MaxDateTime != null) { var max = (DateTime)picker.MaxDateTime; if (newDate > max) { picker.SelectedDateTime = max; return; } } if (picker.MinDateTime != null) { var min = (DateTime)picker.MinDateTime; if (newDate < min) { picker.SelectedDateTime = min; return; } } if (oldDate.Year != newDate.Year || (oldDate.Year == newDate.Year && oldDate.Month != newDate.Month)) { picker.ResetAndSelectYear(newDate.Year); picker.ResetAndSelectMonth(newDate.Month); picker.ResetDate(newDate.Year, newDate.Month); picker.CheckDateTimeLimit(); } picker.SelectDate(newDate.Year, newDate.Month, newDate.Day); picker.SelectTime(newDate.Hour, newDate.Minute, newDate.Second); } /// /// 获取或设置日期选择器的模式。默认值为日期和时间(DateTime)。 /// public DatePickerModes DatePickerMode { get { return (DatePickerModes)GetValue(DatePickerModeProperty); } set { SetValue(DatePickerModeProperty, value); } } public static readonly DependencyProperty DatePickerModeProperty = DependencyProperty.Register("DatePickerMode", typeof(DatePickerModes), typeof(PUDatePicker), new PropertyMetadata(DatePickerModes.DateTime, OnDatePickerModeChanged)); private static void OnDatePickerModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var picker = d as PUDatePicker; if (!picker.IsLoaded) return; picker.ReLoad(); } #endregion #region Function private void ReLoad() { GrdDate.Visibility = Visibility.Visible; GrdTime.Visibility = Visibility.Hidden; GrdYear.Visibility = Visibility.Hidden; GrdMonth.Visibility = Visibility.Hidden; switch (DatePickerMode) { case DatePickerModes.DateOnly: ClearTimePanel(); LoadYearPanel(); LoadMonthPanel(); LoadDatePanel(); BtnBackToDate.Visibility = Visibility.Visible; ResetDate(SelectedDateTime.Year, SelectedDateTime.Month); SelectDate(SelectedDateTime.Year, SelectedDateTime.Month, SelectedDateTime.Day); break; case DatePickerModes.TimeOnly: GrdDate.Visibility = Visibility.Hidden; GrdTime.Visibility = Visibility.Visible; LoadTimePanel(); ClearDatePanel(); ClearYearPanel(); ClearMonthPanel(); BtnBackToDate.Visibility = Visibility.Hidden; SelectTime(SelectedDateTime.Hour, SelectedDateTime.Minute, SelectedDateTime.Second); break; case DatePickerModes.DateTime: LoadYearPanel(); LoadMonthPanel(); LoadDatePanel(); LoadTimePanel(); BtnBackToDate.Visibility = Visibility.Visible; ResetDate(SelectedDateTime.Year, SelectedDateTime.Month); SelectDate(SelectedDateTime.Year, SelectedDateTime.Month, SelectedDateTime.Day); SelectTime(SelectedDateTime.Hour, SelectedDateTime.Minute, SelectedDateTime.Second); break; } CheckDateTimeLimit(); } /// /// 清空并重新加载日期Panel。 /// private void LoadDatePanel() { ClearDatePanel(); for (int i = 0; i < 42; i++) { var radio = new PURadioButton { RadioButtonStyle = RadioButtonStyles.Button, Content = i.ToString("00"), VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, Padding = new Thickness(0), }; Grid.SetRow(radio, (int)(i / 7)); Grid.SetColumn(radio, i % 7); var fore = new Binding { Path = new PropertyPath("Foreground"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.ForegroundProperty, fore); var cover = new Binding { Path = new PropertyPath("CoverBrush"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.CoverBrushProperty, cover); radio.Click += DateRadioButton_Click; GrdDatePanel.Children.Add(radio); } } /// /// 清空日期Panel。 /// private void ClearDatePanel() { GrdDatePanel.Children.Clear(); } /// /// 清空并重新加载时间Panel。 /// private void LoadTimePanel() { ClearTimePanel(); for (int i = 0; i < 24; i++) { var radio = new PURadioButton { RadioButtonStyle = RadioButtonStyles.Button, Content = i.ToString("00"), Height = 30, HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, Padding = new Thickness(0), Tag = i, }; Grid.SetRow(radio, i / 7); Grid.SetColumn(radio, i % 7); var fore = new Binding { Path = new PropertyPath("Foreground"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.ForegroundProperty, fore); var cover = new Binding { Path = new PropertyPath("CoverBrush"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.CoverBrushProperty, cover); radio.Click += HourRadioButton_Click; StkHour.Children.Add(radio); } for (int i = 0; i < 60; i++) { var radio = new PURadioButton { RadioButtonStyle = RadioButtonStyles.Button, Height = 30, HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, Padding = new Thickness(0), Content = i.ToString("00"), Tag = i, }; Grid.SetRow(radio, i / 7); Grid.SetColumn(radio, i % 7); var fore = new Binding { Path = new PropertyPath("Foreground"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.ForegroundProperty, fore); var cover = new Binding { Path = new PropertyPath("CoverBrush"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.CoverBrushProperty, cover); radio.Click += MinuteRadioButton_Click; StkMinute.Children.Add(radio); } for (int i = 0; i < 60; i++) { var radio = new PURadioButton { RadioButtonStyle = RadioButtonStyles.Button, Height = 30, HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, Padding = new Thickness(0), Content = i.ToString("00"), Tag = i, }; Grid.SetRow(radio, i / 7); Grid.SetColumn(radio, i % 7); var fore = new Binding { Path = new PropertyPath("Foreground"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.ForegroundProperty, fore); var cover = new Binding { Path = new PropertyPath("CoverBrush"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.CoverBrushProperty, cover); radio.Click += SecondRadioButton_Click; StkSecond.Children.Add(radio); } } /// /// 清空时间Panel。 /// private void ClearTimePanel() { StkHour.Children.Clear(); StkMinute.Children.Clear(); StkSecond.Children.Clear(); } /// /// 清空并重新加载年份Panel。 /// private void LoadYearPanel() { ClearYearPanel(); for (int i = 0; i < 15; i++) { var radio = new PURadioButton { RadioButtonStyle = RadioButtonStyles.Button, Content = i.ToString("00"), Height = 35, HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, Padding = new Thickness(0), Tag = i, }; Grid.SetRow(radio, i / 3); Grid.SetColumn(radio, i % 3); var fore = new Binding { Path = new PropertyPath("Foreground"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.ForegroundProperty, fore); var cover = new Binding { Path = new PropertyPath("CoverBrush"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.CoverBrushProperty, cover); radio.Click += YearRadioButton_Click; GrdYearPanel.Children.Add(radio); } } /// /// 清空年份Panel。 /// private void ClearYearPanel() { GrdYearPanel.Children.Clear(); } /// /// 清空并重新加载月份Panel。 /// private void LoadMonthPanel() { ClearMonthPanel(); for (int i = 1; i <= 12; i++) { var radio = new PURadioButton { RadioButtonStyle = RadioButtonStyles.Button, Content = i + "月", Height = 35, HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, Padding = new Thickness(0), Tag = i, }; Grid.SetRow(radio, (i - 1) / 4); Grid.SetColumn(radio, (i - 1) % 4); var fore = new Binding { Path = new PropertyPath("Foreground"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.ForegroundProperty, fore); var cover = new Binding { Path = new PropertyPath("CoverBrush"), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.CoverBrushProperty, cover); radio.Click += MonthRadioButton_Click; GrdMonthPanel.Children.Add(radio); } } /// /// 清空月份Panel。 /// private void ClearMonthPanel() { GrdMonthPanel.Children.Clear(); } /// /// 重新设置RadioButton的日期。 /// private void ResetDate(int year, int month) { if (GrdDatePanel.Children.Count != 42) return; BtnYear.Content = year + "年"; BtnMonth.Content = month + "月"; var currentMonth = new DateTime(year, month, 1); var lastMonth = currentMonth.AddMonths(-1); var nextMonth = currentMonth.AddMonths(1); //获取本月第一天是星期几 var firstDay = (int)currentMonth.DayOfWeek; //获取上个月最后一天是几号。 var lastDay = DateTime.DaysInMonth(lastMonth.Year, lastMonth.Month); //获取本月的天数。 var totalDay = DateTime.DaysInMonth(currentMonth.Year, currentMonth.Month); for (int i = 0; i < firstDay; i++) { var date = new DateTime(lastMonth.Year, lastMonth.Month, lastDay - firstDay + i + 1); var radio = GrdDatePanel.Children[i] as PURadioButton; radio.Opacity = 0.5; radio.Content = (lastDay - firstDay + i + 1).ToString(); radio.Tag = date; if (MaxDateTime == null && MinDateTime == null) { radio.IsEnabled = true; radio.Opacity = 0.5; } else if (MaxDateTime != null && MinDateTime != null) { if (date <= ((DateTime)MaxDateTime).Date && date >= ((DateTime)MinDateTime).Date) { radio.IsEnabled = true; radio.Opacity = 0.5; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } else if (MaxDateTime != null && date <= ((DateTime)MaxDateTime).Date) { radio.IsEnabled = true; radio.Opacity = 0.5; } else if (MinDateTime != null && date >= ((DateTime)MinDateTime).Date) { radio.IsEnabled = true; radio.Opacity = 0.5; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } for (int i = firstDay; i < firstDay + totalDay; i++) { var date = new DateTime(currentMonth.Year, currentMonth.Month, i - firstDay + 1); var radio = GrdDatePanel.Children[i] as PURadioButton; radio.Opacity = 1; radio.Content = i - firstDay + 1; radio.Tag = date; if (MaxDateTime == null && MinDateTime == null) { radio.IsEnabled = true; radio.Opacity = 1; } else if (MaxDateTime != null && MinDateTime != null) { if (date <= ((DateTime)MaxDateTime).Date && date >= ((DateTime)MinDateTime).Date) { radio.IsEnabled = true; radio.Opacity = 1; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } else if (MaxDateTime != null && date <= ((DateTime)MaxDateTime).Date) { radio.IsEnabled = true; radio.Opacity = 1; } else if (MinDateTime != null && date >= ((DateTime)MinDateTime).Date) { radio.IsEnabled = true; radio.Opacity = 1; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } for (int i = firstDay + totalDay; i < 42; i++) { var date = new DateTime(nextMonth.Year, nextMonth.Month, i - firstDay - totalDay + 1); var radio = GrdDatePanel.Children[i] as PURadioButton; radio.Opacity = 0.5; radio.Content = i - firstDay - totalDay + 1; radio.Tag = date; if (MaxDateTime == null && MinDateTime == null) { radio.IsEnabled = true; radio.Opacity = 0.5; } else if (MaxDateTime != null && MinDateTime != null) { if (date <= ((DateTime)MaxDateTime).Date && date >= ((DateTime)MinDateTime).Date) { radio.IsEnabled = true; radio.Opacity = 0.5; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } else if (MaxDateTime != null && date <= ((DateTime)MaxDateTime).Date) { radio.IsEnabled = true; radio.Opacity = 0.5; } else if (MinDateTime != null && date >= ((DateTime)MinDateTime).Date) { radio.IsEnabled = true; radio.Opacity = 0.5; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } } private void SelectDate(int year, int month, int day) { if (GrdDatePanel.Children.Count != 42) return; for (int i = 0; i < 42; i++) { var radio = GrdDatePanel.Children[i] as PURadioButton; if (radio.Content.ToString() != day.ToString()) continue; var date = (DateTime)radio.Tag; if (date.Year == year && date.Month == month) { radio.IsChecked = true; return; } } } /// /// 重新设置RadioButton的时间(如果必要),选中指定的时间。 /// private void SelectTime(int hour, int minute, int second) { if (StkHour.Children.Count != 24 || StkMinute.Children.Count != 60 || StkSecond.Children.Count != 60) return; { var radio = StkHour.Children[hour] as PURadioButton; radio.IsChecked = true; ScrollHour.ScrollToVerticalOffset((hour - 2) * radio.Height); } { var radio = StkMinute.Children[minute] as PURadioButton; radio.IsChecked = true; ScrollMinute.ScrollToVerticalOffset((minute - 2) * radio.Height); } { var radio = StkSecond.Children[second] as PURadioButton; radio.IsChecked = true; ScrollSecond.ScrollToVerticalOffset((second - 2) * radio.Height); } } private void ResetAndSelectYear(int year) { if (GrdYearPanel.Children.Count != 15) return; BtnYearInterval.Content = SelectedDateTime.AddYears(-7).Year + "年 - " + SelectedDateTime.AddYears(7).Year + "年"; for (int i = -7; i < 8; i++) { var radio = GrdYearPanel.Children[i + 7] as PURadioButton; radio.Content = (year + i) + "年"; radio.Tag = year + i; if (i == 0) radio.IsChecked = true; if (MaxDateTime == null && MinDateTime == null) { radio.IsEnabled = true; radio.Opacity = 1; } else if (MaxDateTime != null && MinDateTime != null) { if ((year + i) <= ((DateTime)MaxDateTime).Year && (year + i) >= ((DateTime)MinDateTime).Year) { radio.IsEnabled = true; radio.Opacity = 1; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } else if (MaxDateTime != null && (year + i) <= ((DateTime)MaxDateTime).Year) { radio.IsEnabled = true; radio.Opacity = 1; } else if (MinDateTime != null && (year + i) >= ((DateTime)MinDateTime).Year) { radio.IsEnabled = true; radio.Opacity = 1; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } } private void ResetAndSelectMonth(int month) { if (GrdMonthPanel.Children.Count != 12) return; BtnMonthInterval.Content = SelectedDateTime.Year + "年"; for (int i = 1; i <= 12; i++) { var radio = GrdMonthPanel.Children[i - 1] as PURadioButton; if (i == month) radio.IsChecked = true; if (MaxDateTime == null && MinDateTime == null) { radio.IsEnabled = true; radio.Opacity = 1; } else if (MaxDateTime != null && MinDateTime != null) { if ((SelectedDateTime.Year != ((DateTime)MaxDateTime).Year || i <= ((DateTime)MaxDateTime).Month) && (SelectedDateTime.Year != ((DateTime)MinDateTime).Year || i >= ((DateTime)MinDateTime).Month)) { radio.IsEnabled = true; radio.Opacity = 1; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } else if (MaxDateTime != null && (SelectedDateTime.Year != ((DateTime)MaxDateTime).Year || i <= ((DateTime)MaxDateTime).Month)) { radio.IsEnabled = true; radio.Opacity = 1; } else if (MinDateTime != null && (SelectedDateTime.Year != ((DateTime)MinDateTime).Year || i >= ((DateTime)MinDateTime).Month)) { radio.IsEnabled = true; radio.Opacity = 1; } else { radio.IsEnabled = false; radio.Opacity = 0.2; } } } private void CheckDateTimeLimit() { ResetAndSelectYear(SelectedDateTime.Year); ResetAndSelectMonth(SelectedDateTime.Month); ResetDate(SelectedDateTime.Year, SelectedDateTime.Month); if (MaxDateTime != null) { var max = (DateTime)MaxDateTime; if (SelectedDateTime.Date > max.Date) { SelectedDateTime = max; } if (SelectedDateTime.Year >= max.Year) { BtnAddYear.Visibility = Visibility.Hidden; } else { BtnAddYear.Visibility = Visibility.Visible; } if (SelectedDateTime.Year + 7 >= max.Year) { BtnYearRight.Visibility = Visibility.Hidden; } else { BtnYearRight.Visibility = Visibility.Visible; } if (SelectedDateTime.Year > max.Year || (SelectedDateTime.Year == max.Year && SelectedDateTime.Month >= max.Month)) { BtnAddMonth.Visibility = Visibility.Hidden; BtnMonthRight.Visibility = Visibility.Hidden; } else { BtnAddMonth.Visibility = Visibility.Visible; BtnMonthRight.Visibility = Visibility.Visible; } } else { BtnAddYear.Visibility = Visibility.Visible; BtnAddMonth.Visibility = Visibility.Visible; BtnYearRight.Visibility = Visibility.Visible; BtnMonthRight.Visibility = Visibility.Visible; } if (MinDateTime != null) { var min = (DateTime)MinDateTime; if (SelectedDateTime.Date < min.Date) { SelectedDateTime = min; } if (SelectedDateTime.Year <= min.Year) { BtnDecYear.Visibility = Visibility.Hidden; } else { BtnDecYear.Visibility = Visibility.Visible; } if (SelectedDateTime.Year - 7 <= min.Year) { BtnYearLeft.Visibility = Visibility.Hidden; } else { BtnYearLeft.Visibility = Visibility.Visible; } if (SelectedDateTime.Year < min.Year || (SelectedDateTime.Year == min.Year && SelectedDateTime.Month <= min.Month)) { BtnDecMonth.Visibility = Visibility.Hidden; BtnMonthLeft.Visibility = Visibility.Hidden; } else { BtnDecMonth.Visibility = Visibility.Visible; BtnMonthLeft.Visibility = Visibility.Visible; } } else { BtnDecYear.Visibility = Visibility.Visible; BtnDecMonth.Visibility = Visibility.Visible; BtnYearLeft.Visibility = Visibility.Visible; BtnMonthLeft.Visibility = Visibility.Visible; } } #endregion #region Event private void DateRadioButton_Click(object sender, RoutedEventArgs e) { var radio = sender as PURadioButton; if (radio.Tag == null) return; var date = (DateTime)radio.Tag; SelectedDateTime = new DateTime(date.Year, date.Month, date.Day, SelectedDateTime.Hour, SelectedDateTime.Minute, SelectedDateTime.Second); if (radio.IsChecked == true) { if (DatePickerMode == DatePickerModes.DateTime) { GrdDate.Visibility = Visibility.Hidden; GrdTime.Visibility = Visibility.Visible; } return; } } private void HourRadioButton_Click(object sender, RoutedEventArgs e) { var radio = sender as PURadioButton; if (radio.Tag == null) return; var hour = (int)radio.Tag; SelectedDateTime = new DateTime(SelectedDateTime.Year, SelectedDateTime.Month, SelectedDateTime.Day, hour, SelectedDateTime.Minute, SelectedDateTime.Second); } private void MinuteRadioButton_Click(object sender, RoutedEventArgs e) { var radio = sender as PURadioButton; if (radio.Tag == null) return; var minute = (int)radio.Tag; SelectedDateTime = new DateTime(SelectedDateTime.Year, SelectedDateTime.Month, SelectedDateTime.Day, SelectedDateTime.Hour, minute, SelectedDateTime.Second); } private void SecondRadioButton_Click(object sender, RoutedEventArgs e) { var radio = sender as PURadioButton; if (radio.Tag == null) return; var second = (int)radio.Tag; SelectedDateTime = new DateTime(SelectedDateTime.Year, SelectedDateTime.Month, SelectedDateTime.Day, SelectedDateTime.Hour, SelectedDateTime.Minute, second); } private void YearRadioButton_Click(object sender, RoutedEventArgs e) { var radio = sender as PURadioButton; if (radio.Tag == null) return; var year = (int)radio.Tag; SelectedDateTime = new DateTime(year, SelectedDateTime.Month, SelectedDateTime.Day, SelectedDateTime.Hour, SelectedDateTime.Minute, SelectedDateTime.Second); GrdDate.Visibility = Visibility.Visible; GrdYear.Visibility = Visibility.Hidden; } private void MonthRadioButton_Click(object sender, RoutedEventArgs e) { var radio = sender as PURadioButton; if (radio.Tag == null) return; var month = (int)radio.Tag; SelectedDateTime = new DateTime(SelectedDateTime.Year, month, SelectedDateTime.Day, SelectedDateTime.Hour, SelectedDateTime.Minute, SelectedDateTime.Second); GrdDate.Visibility = Visibility.Visible; GrdMonth.Visibility = Visibility.Hidden; } private void BtnDecYear_Click(object sender, RoutedEventArgs e) { if (MinDateTime == null || SelectedDateTime.AddYears(-1) >= MinDateTime) SelectedDateTime = SelectedDateTime.AddYears(-1); else SelectedDateTime = (DateTime)MinDateTime; } private void BtnDecMonth_Click(object sender, RoutedEventArgs e) { if (MinDateTime == null || SelectedDateTime.AddMonths(-1) >= MinDateTime) SelectedDateTime = SelectedDateTime.AddMonths(-1); else SelectedDateTime = (DateTime)MinDateTime; } private void BtnAddMonth_Click(object sender, RoutedEventArgs e) { if (MaxDateTime == null || SelectedDateTime.AddMonths(1) <= MaxDateTime) SelectedDateTime = SelectedDateTime.AddMonths(1); else SelectedDateTime = (DateTime)MaxDateTime; } private void BtnAddYear_Click(object sender, RoutedEventArgs e) { if (MaxDateTime == null || SelectedDateTime.AddYears(1) <= MaxDateTime) SelectedDateTime = SelectedDateTime.AddYears(1); else SelectedDateTime = (DateTime)MaxDateTime; } private void BtnYearLeft_Click(object sender, RoutedEventArgs e) { if (MinDateTime == null || SelectedDateTime.AddYears(-15) >= MinDateTime) SelectedDateTime = SelectedDateTime.AddYears(-15); else SelectedDateTime = (DateTime)MinDateTime; } private void BtnYearRight_Click(object sender, RoutedEventArgs e) { if (MaxDateTime == null || SelectedDateTime.AddYears(15) <= MaxDateTime) SelectedDateTime = SelectedDateTime.AddYears(15); else SelectedDateTime = (DateTime)MaxDateTime; } private void BtnMonthLeft_Click(object sender, RoutedEventArgs e) { if (MinDateTime == null || SelectedDateTime.AddYears(-1) >= MinDateTime) SelectedDateTime = SelectedDateTime.AddYears(-1); else SelectedDateTime = (DateTime)MinDateTime; } private void BtnMonthRight_Click(object sender, RoutedEventArgs e) { if (MaxDateTime == null || SelectedDateTime.AddYears(1) <= MaxDateTime) SelectedDateTime = SelectedDateTime.AddYears(1); else SelectedDateTime = (DateTime)MaxDateTime; } private void BtnBackToDate_Click(object sender, RoutedEventArgs e) { GrdDate.Visibility = Visibility.Visible; GrdTime.Visibility = Visibility.Hidden; } #endregion private void BtnYear_Click(object sender, RoutedEventArgs e) { ResetAndSelectYear(SelectedDateTime.Year); GrdDate.Visibility = Visibility.Hidden; GrdYear.Visibility = Visibility.Visible; } private void BtnMonth_Click(object sender, RoutedEventArgs e) { ResetAndSelectMonth(SelectedDateTime.Month); GrdDate.Visibility = Visibility.Hidden; GrdMonth.Visibility = Visibility.Visible; } private void BtnMonthInterval_Click(object sender, RoutedEventArgs e) { ResetAndSelectYear(SelectedDateTime.Year); GrdMonth.Visibility = Visibility.Hidden; GrdYear.Visibility = Visibility.Visible; } } } ================================================ FILE: Panuon.UI/A5_PagingNav/PUPagingNav.xaml ================================================  ================================================ FILE: Panuon.UI/A5_PagingNav/PUPagingNav.xaml.cs ================================================ using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; namespace Panuon.UI { /// /// PUPagingNav.xaml 的交互逻辑 /// public partial class PUPagingNav : UserControl { public PUPagingNav() { InitializeComponent(); Foreground = new SolidColorBrush(Colors.White); } public override void OnApplyTemplate() { base.OnApplyTemplate(); Loaded += delegate { Load(); Select(); }; } #region RoutedEvent /// /// 页码发生改变事件。 /// public static readonly RoutedEvent CurrentPageChangedEvent = EventManager.RegisterRoutedEvent("CurrentPageChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(PUPagingNav)); public event RoutedPropertyChangedEventHandler CurrentPageChanged { add { AddHandler(CurrentPageChangedEvent, value); } remove { RemoveHandler(CurrentPageChangedEvent, value); } } internal void OnCurrentPageChanged(int oldItem, int newItem) { RoutedPropertyChangedEventArgs arg = new RoutedPropertyChangedEventArgs(oldItem, newItem, CurrentPageChangedEvent); RaiseEvent(arg); } #endregion #region Property /// /// 获取或设置当前的总页数。默认值为1。 /// public int TotalPage { get { return (int)GetValue(TotalPageProperty); } set { SetValue(TotalPageProperty, value); } } public static readonly DependencyProperty TotalPageProperty = DependencyProperty.Register("TotalPage", typeof(int), typeof(PUPagingNav), new PropertyMetadata(1, OnTotalPageChanged)); private static void OnTotalPageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue == e.OldValue) return; var nav = d as PUPagingNav; if (!nav.IsLoaded) return; nav.Load(); nav.Select(); } /// /// 获取或设置当前的页码。默认值为1。 /// public int CurrentPage { get { return (int)GetValue(CurrentPageProperty); } set { SetValue(CurrentPageProperty, value); } } public static readonly DependencyProperty CurrentPageProperty = DependencyProperty.Register("CurrentPage", typeof(int), typeof(PUPagingNav), new PropertyMetadata(1, OnCurrentPageChanged)); private static void OnCurrentPageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue == e.OldValue) return; var nav = d as PUPagingNav; if (!nav.IsLoaded) return; nav.OnCurrentPageChanged((int)e.OldValue, (int)e.NewValue); nav.Load(); nav.Select(); } /// /// 获取或设置按钮的圆角大小,默认值为3。 /// public CornerRadius ButtonCornerRadius { get { return (CornerRadius)GetValue(ButtonCornerRadiusProperty); } set { SetValue(ButtonCornerRadiusProperty, value); } } public static readonly DependencyProperty ButtonCornerRadiusProperty = DependencyProperty.Register("ButtonCornerRadius", typeof(CornerRadius), typeof(PUPagingNav), new PropertyMetadata(new CornerRadius(3))); /// /// 获取或设置两侧的按钮是否显示。默认值为True。 /// public bool IsSideButtonShow { get { return (bool)GetValue(IsSideButtonShowProperty); } set { SetValue(IsSideButtonShowProperty, value); } } public static readonly DependencyProperty IsSideButtonShowProperty = DependencyProperty.Register("IsSideButtonShow", typeof(bool), typeof(PUPagingNav), new PropertyMetadata(true, OnIsSideButtonShowChanged)); private static void OnIsSideButtonShowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var nav = d as PUPagingNav; if (nav.IsSideButtonShow) { nav.BtnLeft.Visibility = Visibility.Visible; nav.BtnRight.Visibility = Visibility.Visible; } else { nav.BtnLeft.Visibility = Visibility.Collapsed; nav.BtnRight.Visibility = Visibility.Collapsed; } } /// /// 获取或设置按钮的背景颜色。默认值为#AA3E3E3E。 /// public Brush ButtonBrush { get { return (Brush)GetValue(ButtonBrushProperty); } set { SetValue(ButtonBrushProperty, value); } } public static readonly DependencyProperty ButtonBrushProperty = DependencyProperty.Register("ButtonBrush", typeof(Brush), typeof(PUPagingNav), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AA3E3E3E")))); /// /// 获取或设置按钮被选中或点击时的颜色。默认值为#3E3E3E。 /// public Brush SelectedBrush { get { return (Brush)GetValue(SelectedBrushProperty); } set { SetValue(SelectedBrushProperty, value); } } public static readonly DependencyProperty SelectedBrushProperty = DependencyProperty.Register("SelectedBrush", typeof(Brush), typeof(PUPagingNav), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")))); #endregion #region Function private void Load() { if(TotalPage <= 0) { TotalPage = 0; return; } if(CurrentPage <= 0) { CurrentPage = 1; return; } if (CurrentPage > TotalPage) { CurrentPage = TotalPage; return; } StkMain.Children.Clear(); if (TotalPage <= 7) { for (var i = 1; i <= TotalPage; i++) { StkMain.Children.Add(GetRadioButton(i)); } } else { StkMain.Children.Add(GetRadioButton(1)); StkMain.Children.Add(GetRadioButton(2)); //第1或2页或3,直接追加到5 if (CurrentPage == 1 || CurrentPage == 2 || CurrentPage == 3 || CurrentPage == 4) { StkMain.Children.Add(GetRadioButton(3)); StkMain.Children.Add(GetRadioButton(4)); StkMain.Children.Add(GetRadioButton(5)); } //... StkMain.Children.Add(GetTextBlock()); //距离终点小于4,直接追加直到末尾 if (CurrentPage >= TotalPage - 3) { StkMain.Children.Add(GetTextBlock()); for (var i = TotalPage - 4; i <= TotalPage; i++) { StkMain.Children.Add(GetRadioButton(i)); } return; } if (CurrentPage != 1 && CurrentPage != 2 && CurrentPage != 3 && CurrentPage != 4) { //追加三条 for (var i = CurrentPage - 1; i <= (CurrentPage + 1); i++) { StkMain.Children.Add(GetRadioButton(i)); } } StkMain.Children.Add(GetTextBlock()); for (var i = TotalPage - 1; i <= TotalPage; i++) { StkMain.Children.Add(GetRadioButton(i)); } } } private void Select() { foreach (var item in StkMain.Children) { var radio = item as PURadioButton; if (radio == null) continue; if (radio.Content.ToString() == CurrentPage.ToString()) { radio.IsChecked = true; break; } } } private PURadioButton GetRadioButton(int content) { var radio = new PURadioButton() { RadioButtonStyle = RadioButtonStyles.Button, Content = content, HorizontalAlignment = HorizontalAlignment.Left, HorizontalContentAlignment = HorizontalAlignment.Center, Padding = new Thickness(5,0,5,0), Margin = new Thickness(6, 0, 0, 0), }; var back = new Binding() { Source = this, Path = new PropertyPath("ButtonBrush"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.BackgroundProperty, back); var cover = new Binding() { Source = this, Path = new PropertyPath("SelectedBrush"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.CoverBrushProperty, cover); var fore = new Binding() { Source = this, Path = new PropertyPath("Foreground"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.ForegroundProperty, fore); var height = new Binding() { Source = this, Path = new PropertyPath("ActualHeight"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.HeightProperty, height); var radius = new Binding() { Source = this, Path = new PropertyPath("ButtonCornerRadius"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(radio, PURadioButton.BorderCornerRadiusProperty, radius); radio.Click += delegate { CurrentPage = content; }; return radio; } private TextBlock GetTextBlock() { var txt = new TextBlock() { Text = "...", Margin = new Thickness(5, 0, 5, 0), VerticalAlignment = VerticalAlignment.Center, }; var fore = new Binding() { Source = this, Path = new PropertyPath("ButtonBrush"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(txt, TextBlock.ForegroundProperty, fore); return txt; } #endregion #region Sys private void BtnLeft_Click(object sender, RoutedEventArgs e) { if (CurrentPage > 1) CurrentPage--; } private void BtnRight_Click(object sender, RoutedEventArgs e) { if (CurrentPage < TotalPage) CurrentPage++; } #endregion } } ================================================ FILE: Panuon.UI/A6_ContextMenu/PUContextMenu.cs ================================================ using System; using System.Collections; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUContextMenu : ContextMenu { static PUContextMenu() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUContextMenu), new FrameworkPropertyMetadata(typeof(PUContextMenu))); } #region Property [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("该属性对此控件无效。请使用BindingItems属性替代。",true)] public new IEnumerable ItemsSource { get { return (IEnumerable)GetValue(ItemsSourceProperty); } private set { SetValue(ItemsSourceProperty, value); } } public new static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(PUContextMenu)); /// /// 获取或设置当鼠标悬浮在子项上时,子项的背景颜色。默认值为#33AAAAAA。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUContextMenu)); /// /// 获取或设置边框的圆角大小,默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUContextMenu)); /// /// 获取或设置边框的阴影颜色。默认值为#44444444。 /// public Color ShadowColor { get { return (Color)GetValue(ShadowColorProperty); } set { SetValue(ShadowColorProperty, value); } } public static readonly DependencyProperty ShadowColorProperty = DependencyProperty.Register("ShadowColor", typeof(Color), typeof(PUContextMenu)); #endregion } } ================================================ FILE: Panuon.UI/A6_ContextMenu/PUContextMenuItem.cs ================================================ using System.Windows; using System.Windows.Controls; namespace Panuon.UI { public class PUContextMenuItem : MenuItem { static PUContextMenuItem() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUContextMenuItem), new FrameworkPropertyMetadata(typeof(PUContextMenuItem))); } #region Property public object Value { get { return (object)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(PUContextMenuItem)); #endregion } } ================================================ FILE: Panuon.UI/A7_Bubble/PUBubble.cs ================================================ using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UI { public class PUBubble : UserControl { static PUBubble() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PUBubble), new FrameworkPropertyMetadata(typeof(PUBubble))); } #region Property /// /// 获取或设置当鼠标悬浮在气泡上时,气泡的背景颜色。默认值为#555555。 /// public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUBubble), new PropertyMetadata(new SolidColorBrush(Colors.LightGray))); /// /// 获取或设置尖角的位置,默认值为Left(左侧)。 /// public AnglePositions AnglePosition { get { return (AnglePositions)GetValue(AnglePositionProperty); } set { SetValue(AnglePositionProperty, value); } } public static readonly DependencyProperty AnglePositionProperty = DependencyProperty.Register("AnglePosition", typeof(AnglePositions), typeof(PUBubble), new PropertyMetadata(AnglePositions.Left)); /// /// 获取或设置圆角大小。默认值为0。 /// public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(PUBubble)); #endregion } } ================================================ FILE: Panuon.UI/Helper/Helper.cs ================================================ using System.Windows; using System.Windows.Controls; namespace Panuon.UI { public class Helper : DependencyObject { #region Column & Row public static double GetColumnDefinition(DependencyObject obj) { return (double)obj.GetValue(ColumnDefinitionProperty); } public static void SetColumnDefinition(DependencyObject obj, double value) { obj.SetValue(ColumnDefinitionProperty, value); } public static readonly DependencyProperty ColumnDefinitionProperty = DependencyProperty.RegisterAttached("ColumnDefinition", typeof(double), typeof(Helper), new PropertyMetadata(OnColumnDefinitionChanged)); private static void OnColumnDefinitionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var value = (double)e.NewValue; var ele = d as FrameworkElement; var parent = ele.Parent as Grid; if (parent == null) return; Grid.SetColumn(ele, parent.ColumnDefinitions.Count); parent.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(value, GridUnitType.Star) }); } public static double GetRowDefinition(DependencyObject obj) { return (double)obj.GetValue(RowDefinitionProperty); } public static void SetRowDefinition(DependencyObject obj, double value) { obj.SetValue(RowDefinitionProperty, value); } public static readonly DependencyProperty RowDefinitionProperty = DependencyProperty.RegisterAttached("RowDefinition", typeof(double), typeof(Helper), new PropertyMetadata(OnRowDefinitionChanged)); private static void OnRowDefinitionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var value = (double)e.NewValue; var ele = d as FrameworkElement; var parent = ele.Parent as Grid; if (parent == null) return; Grid.SetRow(ele, parent.RowDefinitions.Count); parent.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(value, GridUnitType.Star) }); } #endregion #region Height & Width public static double GetHeight(DependencyObject obj) { return (double)obj.GetValue(HeightProperty); } public static void SetHeight(DependencyObject obj, double value) { obj.SetValue(HeightProperty, value); } public static readonly DependencyProperty HeightProperty = DependencyProperty.RegisterAttached("Height", typeof(double), typeof(Helper), new PropertyMetadata(OnHeightChanged)); private static void OnHeightChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var value = (double)e.NewValue; var ele = d as FrameworkElement; var parent = ele.Parent as FrameworkElement; if (parent == null) return; parent.Loaded += delegate { ele.Height = parent.ActualWidth * value; }; } public static double GetWidth(DependencyObject obj) { return (double)obj.GetValue(WidthProperty); } public static void SetWidth(DependencyObject obj, double value) { obj.SetValue(WidthProperty, value); } public static readonly DependencyProperty WidthProperty = DependencyProperty.RegisterAttached("Width", typeof(double), typeof(Helper), new PropertyMetadata(OnWidthChanged)); private static void OnWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var value = (double)e.NewValue; var ele = d as FrameworkElement; var parent = ele.Parent as FrameworkElement; if (parent == null) return; parent.Loaded += delegate { ele.Width = parent.ActualWidth * value; }; } #endregion } } ================================================ FILE: Panuon.UI/Others/Enums.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/19 11:09:29 *说明: *日志:2018/11/19 11:09:29 创建。 *==============================================================*/ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UI { public enum ButtonStyles { /// /// 一个常规按钮。 /// General = 1, /// /// 一个带边框的空心按钮,当鼠标悬浮时才会显示背景色。 /// 当鼠标移入时,该按钮的背景色将由Background变为指定的CoverBrush。 /// Hollow = 2, /// /// 一个带边框的空心按钮,当鼠标悬浮时才会显示前景色。 /// 当鼠标移入时,该按钮的边框和前景色将由BorderBrush和Foreground变为指定的CoverBrush。 /// Outline = 3, /// /// 一个不带任何边框和背景色的文字按钮。 /// 当鼠标移入时,该按钮的前景色将由Foreground变为指定的CoverBrush。 /// Link = 4, } public enum RepeatButtonStyles { /// /// 一个常规按钮。 /// General = 1, /// /// 一个带边框的空心按钮,当鼠标悬浮时才会显示背景色。 /// 当鼠标移入时,该按钮的背景色将由Background变为指定的CoverBrush。 /// Hollow = 2, /// /// 一个带边框的空心按钮,当鼠标悬浮时才会显示前景色。 /// 当鼠标移入时,该按钮的边框和前景色将由BorderBrush和Foreground变为指定的CoverBrush。 /// Outline = 3, /// /// 一个不带任何边框和背景色的文字按钮。 /// 当鼠标移入时,该按钮的前景色将由Foreground变为指定的CoverBrush。 /// Link = 4, } public enum ClickStyles { /// /// 点击按钮时不触发下沉操作。 /// Classic, /// /// 点击时按钮下沉2个px。 /// Sink, } public enum TextBoxStyles { /// /// 一个标准的输入框。 /// General = 1, /// /// 一个输入框前带图标的输入框。 /// IconGroup = 2, } public enum PasswordBoxStyles { /// /// 一个标准的密码框。 /// General = 1, /// /// 一个密码框前带图标的密码框。 /// IconGroup = 2, } public enum SelectedValuePaths { Header, Value } public enum DeleteModes { /// /// 当用户点击删除按钮时,删除项目并触发DeleteItem路由事件。 /// Delete, /// /// 当用户点击删除按钮时,不直接删除项目(只触发DeleteItem路由事件)。 /// EventOnly, } public enum SearchModes { /// /// 不显示搜索框。 /// None, /// /// 在搜索框按下键盘时搜索。 /// TextChanged, /// /// 当按下Enter键时发起搜索。 /// Enter, } public enum CheckBoxStyles { /// /// 一个标准的选择框。 /// General = 1, /// /// 一个经典样式的选择框。 /// Classic = 2, /// /// 一个开关样式的选择框。 /// Switch = 3, /// /// 一个带有左边线的选择框。 /// Branch = 4, /// /// 一个类似于按钮样式的选择框。 /// Button = 5, } public enum RadioButtonStyles { /// /// 一个标准的RadioButton。 /// General = 1, /// /// 一个经典样式的RadioButton。 /// Classic = 2, /// /// 一个开关样式的RadioButton。 /// Switch = 3, /// /// 一个带有左边线的RadioButton。 /// Branch = 4, /// /// 一个类似于按钮样式的选择框。 /// Button = 5, } public enum ProgressDirections { LeftToRight, RightToLeft, TopToBottom, BottomToTop, } public enum ProgressBarStyles { /// /// 一个标准的进度条。 /// General, /// /// 一个环形的进度条。 /// Ring } public enum TreeViewStyles { General, Classic, } public enum TabControlStyles { General, Classic, } public enum DatePickerModes { /// /// 年 月 日。 /// DateOnly, /// /// 时 分 秒。 /// TimeOnly, /// /// 年 月 日 时 分 秒。 /// DateTime, } public enum AnglePositions { Left, BottomLeft, BottomCenter, BottomRight, Right, } } ================================================ FILE: Panuon.UI/Panuon.UI.csproj ================================================  Debug AnyCPU {72B3698E-1784-4101-99AE-FC7B8F48E96D} library Panuon.UI Panuon.UI v4.0 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true full false bin\Debug\ DEBUG;TRACE prompt 4 false pdbonly true bin\Release\ TRACE prompt 4 false 4.0 Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile MSBuild:Compile Designer Designer MSBuild:Compile Designer MSBuild:Compile MSBuild:Compile Designer Designer MSBuild:Compile Designer MSBuild:Compile MSBuild:Compile Designer Designer MSBuild:Compile PUImageCuter.xaml PUIndicator.xaml PULoading.xaml PUMessageBox.xaml PUSlideShow.xaml PUSlider.xaml PUDatePicker.xaml PUPagingNav.xaml Code True True Resources.resx True Settings.settings True ResXFileCodeGenerator Resources.Designer.cs SettingsSingleFileGenerator Settings.Designer.cs ================================================ FILE: Panuon.UI/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Panuon.UI")] [assembly: AssemblyDescription("A wpf custom control library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Panuon.UI")] [assembly: AssemblyCopyright("Copyright ©Panuon 2016-2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //将 ComVisible 设置为 false 将使此程序集中的类型 //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] //若要开始生成可本地化的应用程序,请设置 //.csproj 文件中的 CultureYouAreCodingWith //例如,如果您在源文件中使用的是美国英语, //使用的是美国英语,请将 设置为 en-US。 然后取消 //对以下 NeutralResourceLanguage 特性的注释。 更新 //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly:ThemeInfo( ResourceDictionaryLocation.None, //主题特定资源词典所处位置 //(未在页面中找到资源时使用, //或应用程序资源字典中找到时使用) ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 //(未在页面中找到资源时使用, //、应用程序或任何主题专用资源字典中找到时使用) )] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.2")] [assembly: Guid("61afca85-a805-4bca-1b07-60d11797ecdd")] ================================================ FILE: Panuon.UI/Properties/Resources.Designer.cs ================================================ //------------------------------------------------------------------------------ // // 此代码由工具生成。 // 运行时版本:4.0.30319.42000 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ namespace Panuon.UI.Properties { using System; /// /// 一个强类型的资源类,用于查找本地化的字符串等。 /// // 此类是由 StronglyTypedResourceBuilder // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // (以 /str 作为命令选项),或重新生成 VS 项目。 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// 返回此类使用的缓存的 ResourceManager 实例。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Panuon.UI.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// 使用此强类型资源类,为所有资源查找 /// 重写当前线程的 CurrentUICulture 属性。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } ================================================ FILE: Panuon.UI/Properties/Resources.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: Panuon.UI/Properties/Settings.Designer.cs ================================================ //------------------------------------------------------------------------------ // // 此代码由工具生成。 // 运行时版本:4.0.30319.42000 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ namespace Panuon.UI.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } ================================================ FILE: Panuon.UI/Properties/Settings.settings ================================================  ================================================ FILE: Panuon.UI/Themes/Control.xaml ================================================  /#fontawesome ================================================ FILE: Panuon.UI/Themes/Generic.xaml ================================================  ================================================ FILE: Panuon.UI/Themes/Resources.xaml ================================================  ================================================ FILE: Panuon.UI/Utils/Converters.cs ================================================ using System; using System.Globalization; using System.Windows; using System.Windows.Data; using System.Windows.Media; namespace Panuon.UI { //ProgressBar专用内部圆角转换器 internal class GeneralProgressBarConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是CornerRadius,1是Direction var cr = (CornerRadius)values[0]; var dir = (ProgressDirections)values[1]; if (dir == ProgressDirections.LeftToRight) return new CornerRadius(cr.TopLeft, 0, 0, cr.BottomLeft); else if (dir == ProgressDirections.RightToLeft) return new CornerRadius(0, cr.TopRight, cr.BottomRight, 0); else if (dir == ProgressDirections.TopToBottom) return new CornerRadius(cr.TopLeft, cr.TopRight, 0, 0); else return new CornerRadius(0, 0, cr.BottomRight, cr.BottomLeft); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } internal class RingProgressBarConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是CornerRadius,1是Direction var width = (double)values[0]; var height = (double)values[1]; var radius = (double)values[2]; var percent = values.Length == 3 ? 1 : (double)values[3]; var point1X = height / 2 * Math.Cos((2 * percent - 0.5) * Math.PI) + height / 2; var point1Y = height / 2 - height / 2 * Math.Sin((2 * percent + 0.5) * Math.PI); var point2X = (height - radius)/ 2 * Math.Cos((2 * percent - 0.5) * Math.PI) + height / 2; var point2Y = height / 2 - (height - radius) / 2 * Math.Sin((2 * percent + 0.5) * Math.PI); var path = ""; if(percent == 0) { path = ""; } else if (percent < 0.5) { path = "M " + width / 2 + "," + radius / 2 + " A " + (width - radius) / 2 + "," + (width - radius) / 2 + " 0 0 1 " + point2X + "," + point2Y + ""; } else if(percent == 0.5) { path = "M " + width / 2 + "," + radius / 2 + " A " + (width - radius) / 2 + "," + (width - radius) / 2 + " 0 0 1 " + width / 2 + "," + (height - radius / 2); } else { path = "M " + width / 2 + "," + radius / 2 + " A " + (width - radius) / 2 + "," + (width - radius) / 2 + " 0 0 1 " + width / 2 + "," + (height - radius / 2) + " A " + (width - radius) / 2 + "," + (width - radius) / 2 + " 0 0 1 " + point2X + "," + point2Y + ""; } return PathGeometry.Parse(path); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } internal class BubbleConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { var location = (AnglePositions)values[0]; var radius = (CornerRadius)values[1]; var width = (double)values[2]; var height = (double)values[3]; var path = ""; switch (location) { case AnglePositions.Left: if (radius == new CornerRadius(0)) path = "M0," + height / 2 + "L5," + (height / 2 + 4) + "V" + height + "H" + width + "V 0 H 5 V" + (height / 2 - 4) + "Z"; else path = "M0," + height / 2 + "L5," + (height / 2 + 4) + "V" + (height - radius.BottomLeft) + "A" + radius.BottomLeft + "," + radius.BottomLeft + " 0 0 0 " + (5 + radius.BottomLeft) + "," + height + "H" + (width - radius.BottomRight) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + width + "," + (height - radius.BottomRight) + "V" + radius.TopRight + "A" + radius.TopRight + "," + radius.TopRight + " 0 0 0 " + (width - radius.TopRight) + "," + 0 + "H" + (5 + radius.TopLeft) + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 5 + "," + radius.TopLeft + "V" + (height / 2 - 4) + "Z"; break; case AnglePositions.BottomLeft: if (radius == new CornerRadius(0)) path = "M0," + height + "L4," + (height - 5) + "H " + width + "V 0 H 0 Z"; else path = "M0," + height + "L4," + (height - 5) + "H" + (width - radius.BottomRight) + "A" + radius.BottomRight +"," + radius.BottomRight + " 0 0 0 " + width + "," + (height - radius.BottomRight - 5) + "V" + radius.TopRight + "A" + radius.TopRight + "," + radius.TopRight + " 0 0 0 " + (width - radius.TopRight) + "," + 0 + "H" + radius.TopLeft + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 0 + "," + radius.TopLeft + "Z"; break; case AnglePositions.BottomCenter: if (radius == new CornerRadius(0)) path = "M" + width / 2 + "," + height + "L" + (width / 2 + 5) + "," + (height - 4) + "H" + width + "V 0 H 0 V" + (height - 4) + "H" + (width / 2 - 5) + "Z"; else path = "M" + width / 2 + "," + height + "L" + (width / 2 + 5) + "," + (height - 4) + "H" + (width - radius.BottomRight) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + width + "," + (height - radius.BottomRight - 5) + "V" + radius.TopRight + "A" + radius.TopRight + "," + radius.TopRight + " 0 0 0 " + (width - radius.TopRight) + "," + 0 + "H" + radius.TopLeft + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 0 + "," + radius.TopLeft + "V" + (height - radius.BottomRight - 5) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + radius.BottomRight + "," + (height - 5) + "H" + (width / 2 - 5) + "Z"; break; case AnglePositions.BottomRight: if (radius == new CornerRadius(0)) path = "M" + width + "," + height + "V 0 H 0 V " + (height - 4) + "H" + (width - 5) + "Z"; else path = "M" + width + "," + height + "V" + radius.TopRight + "A" + radius.TopRight + ","+ radius.TopRight + " 0 0 0 " + (width - radius.TopRight) + "," + 0 + "H" + radius.TopLeft + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 0 + "," + radius.TopLeft + "V" + (height - radius.BottomRight - 5) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + radius.BottomRight + "," + (height - 5) + "H" + (width - 5) + "Z"; break; case AnglePositions.Right: if (radius == new CornerRadius(0)) path = "M" + width + "," + height / 2 + "L" + (width - 5) + "," + (height / 2 - 4) + "V 0 H 0 V" + height + "H " + (width - 5) + "V" + (height / 2 + 4) + "Z"; else path = "M" + width + "," + height / 2 + "L" + (width - 5) + "," + (height / 2 - 4) + "V" + radius.TopRight + "A" + radius.TopRight + "," + radius.TopRight + " 0 0 0 " + (width - radius.TopRight - 5) + "," + 0 + "H" + radius.TopLeft + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 0 + "," + radius.TopLeft + "V" + (height - radius.BottomLeft) + "A" + radius.BottomLeft + "," + radius.BottomLeft + " 0 0 0 " + radius.BottomLeft + "," + height + "H" + (width - radius.BottomRight - 5) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + (width - 5) + "," + (height - radius.BottomRight) + "V" + (height / 2 + 4) + "Z"; break; } return Geometry.Parse(path); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } internal class WidthToMarginConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var actualWidth = (double)value; return new Thickness(actualWidth, 0, 0, 1); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } internal class MarginToWidthConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var thickness = (Thickness)value; return thickness.Left; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } //Window Header和Title转换器 internal class HeaderConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是Header,1是Title return (string)values[0] == null ? (string)values[1]: (string)values[0]; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } //Icon字体大小转换器( + 5) internal class IconFontSizeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (double)value + 5; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } //CheckBox General样式内部对号的缩放比例 internal class ScaleConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是InnerWidth,1是InnerHeight var minvalue = (double)values[0] < (double)values[1] ? (double)values[0] : (double)values[1]; return minvalue / 22; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } internal class ToggleHeightConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (double)value - 2; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } //内部Toggle的圆角转换器 internal class ToHalfConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (double)value / 2; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } //内部Toggle的水平偏移量转换器 internal class ToggleTranslateXConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是InnerWidth,1是InnerHeight return ((double)values[0] - (double)values[1] + 1) * -1; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } //输入框内部宽度转换器 internal class TextBoxInnerWidthConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是Width,1是Padding,,2是HorizontalContentAlignment if ((HorizontalAlignment)values[2] != HorizontalAlignment.Center) return (double)values[0] - ((Thickness)values[1]).Left - ((Thickness)values[1]).Right; else return DependencyProperty.UnsetValue; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } //输入框内部高度转换器 internal class TextBoxInnerHeightConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是Heihgt,1是Padding,2是VerticalContentAlignment if ((VerticalAlignment)values[2] != VerticalAlignment.Center) return (double)values[0] - ((Thickness)values[1]).Top - ((Thickness)values[1]).Bottom; else return DependencyProperty.UnsetValue; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } } ================================================ FILE: Panuon.UI/Utils/Extends.cs ================================================ using System; using System.Collections.Generic; using System.Collections.ObjectModel; namespace Panuon.UI.Utils { public static class Extends { #region String /// /// 尝试将字符串转换为整数,若转换失败,则返回0。 /// public static int ToInt(this string context) { var result = 0; if (Int32.TryParse(context, out result)) return result; else return 0; } /// /// 尝试将字符串转换为小数,若转换失败,则返回0。 /// public static double ToDouble(this string context) { var result = 0.0; if (Double.TryParse(context, out result)) return result; else return 0; } #endregion #region DateTime /// /// 将时间转换成时间戳(精确到毫秒)。 /// public static long ToTimeStamp(this DateTime date) { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1); return Convert.ToInt64(ts.TotalMilliseconds); } /// /// 与另一个日期的年月日进行比较,若相同,则返回True。 /// public static bool CompareYearMonthDay(this DateTime date1, DateTime date2) { return date1.Year == date2.Year && date1.Month == date2.Month && date1.Day == date2.Day; } #endregion #region Long /// /// 将时间戳转换成时间(精确到毫秒)。 /// public static DateTime ToDate(this long timeStamp) { return TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddMilliseconds((long)timeStamp); } #endregion #region List /// /// 将列表中的每个元素拼接成一段字符串。 /// /// 分隔符。 public static string ToString(this IList list,string spliter) { return String.Join(spliter, list); } public static ObservableCollection ToObservableCollection(this IList list) { return new ObservableCollection(list); } #endregion } } ================================================ FILE: Panuon.UI/Utils/Utils.cs ================================================ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace Panuon.UI.Utils { /// /// 提供Task的简易池化管理,并发任务数量可控。 /// public class TaskPoll { #region Identity private static ConcurrentQueue _taskQueue; private static int _runningTaskQuantity; #endregion #region Property /// /// 获取或设置可以允许同时运行的最大任务数量。 /// 若值为Null,则不限制最大执行数量。 /// public static int? MaxTaskQuantity { get { return _maxTaskQuantity; } set { _maxTaskQuantity = value; RecheckQueue(); } } private static int? _maxTaskQuantity; /// /// 获取当前任务池中的任务总数(包括排队中和正在执行的)。 /// public static int CurrentTaskQuantity { get { return _taskQueue == null ? 0 : _taskQueue.Count; } } /// /// 获取当前正在执行的任务数量。 /// public static int RunningTaskQuantity { get { return _runningTaskQuantity; } } #endregion #region APIs /// /// 使用默认值初始化TaskManager。首次调用StartNew方法时,TaskManager将自动执行初始化。 /// public static void Init() { _taskQueue = new ConcurrentQueue(); _runningTaskQuantity = 0; } /// /// 使用指定值初始化TaskManager。 /// 允许同时运行的最大任务数量。 /// public static void Init(int maxTaskQuantity) { MaxTaskQuantity = maxTaskQuantity; _taskQueue = new ConcurrentQueue(); _runningTaskQuantity = 0; } /// /// 向任务队列中插入一个待执行的新任务,该任务将在合适的时机执行。 /// public static void StartNew(Task task) { if (_taskQueue == null) Init(); _taskQueue.Enqueue(task); RecheckQueue(); } /// /// 向任务队列中插入一个待执行的新任务,该任务将在合适的时机执行。 /// public static void StartNew(Task task) { if (_taskQueue == null) Init(); _taskQueue.Enqueue(task); RecheckQueue(); } #endregion #region Funtion private static void RecheckQueue() { if (_taskQueue == null) return; if (_taskQueue.Count == 0 || (MaxTaskQuantity != null && _runningTaskQuantity >= MaxTaskQuantity)) return; Task task; if (!_taskQueue.TryDequeue(out task)) { RecheckQueue(); return; } if (task.Status != TaskStatus.Created && task.Status != TaskStatus.WaitingToRun) { RecheckQueue(); return; } Interlocked.Increment(ref _runningTaskQuantity); task.ContinueWith((t) => { Interlocked.Decrement(ref _runningTaskQuantity); RecheckQueue(); }); task.Start(); if(_runningTaskQuantity < MaxTaskQuantity) RecheckQueue(); } #endregion } /// /// 提供缓存管理(线程安全的),便于缓存数量逐步扩展。 /// public class PUCache { #region Identity /// /// 缓存集合。 /// private static ConcurrentDictionary Caches { get; set; } #endregion #region EventHandle /// /// 当FindAny方法提供的ID数组中有部分值不存在时,触发此事件。 /// 事件参数(UID列表)类型:IList /// public static EventHandler LackItems; #endregion #region Constructor static PUCache() { Caches = new ConcurrentDictionary(); } #endregion #region Property /// /// 获取当前缓存的数量。 /// public static int Count { get { return Caches.Count; } } #endregion #region APIs /// /// 向缓存中添加数据。若ID已存在,则覆盖原有的值。 /// /// 标识该对象的唯一ID。 /// 要添加的对象。 public static void Add(string uid, T obj) { Caches.AddOrUpdate(uid, obj, (key, oldValue) => obj); } /// /// 查找指定ID的值。若找不到,则返回默认值。 /// /// 标识该对象的唯一ID。 /// public static T Find(string uid) { var obj = Caches.FirstOrDefault(x => x.Key == uid); if (obj.Equals(default(KeyValuePair))) return default(T); else return obj.Value; } /// /// 查找多个指定ID的值。不存在的ID不会存在于返回值列表中,并且会触发LackItems事件。 /// /// 要查找的唯一ID数组。 /// public static IList> FindAny(params string[] uids) { var resultList = Caches.Where(x => uids.Contains(x.Key)); var lackuids = uids.Except(resultList.Select(x => x.Key).ToList()).ToList(); if (LackItems != null && lackuids.Count != 0) LackItems(lackuids, null); return resultList.ToList(); } /// /// 清除所有缓存。 /// public static void Clear() { Caches.Clear(); } /// /// 移除指定ID的值。若移除成功,则返回True。 /// /// public static bool Remove(string uid) { T obj; return Caches.TryRemove(uid, out obj); } /// /// 获取指定的ID是否存在于缓存中。 /// /// public static bool Exists(string uid) { return !String.IsNullOrEmpty(Caches.FirstOrDefault(x => x.Key == uid).Key); } /// /// 获取指定的ID是否存在于缓存中,并返回不存在的ID集合。 /// public static IList Exists(params string[] uids) { return Caches.Where(x => !uids.Contains(x.Key)).Select(x => x.Key).ToList(); } #endregion } } ================================================ FILE: Panuon.UI/Z_Helper/Helper.cs ================================================ using System.Windows; using System.Windows.Controls; namespace Panuon.UI { public class Helper : DependencyObject { #region Column & Row public static string GetColumnDefinition(DependencyObject obj) { return (string)obj.GetValue(ColumnDefinitionProperty); } public static void SetColumnDefinition(DependencyObject obj, string value) { obj.SetValue(ColumnDefinitionProperty, value); } public static readonly DependencyProperty ColumnDefinitionProperty = DependencyProperty.RegisterAttached("ColumnDefinition", typeof(string), typeof(Helper), new PropertyMetadata(OnColumnDefinitionChanged)); private static void OnColumnDefinitionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var value = (string)e.NewValue; var ele = d as FrameworkElement; var parent = ele.Parent as Grid; if (parent == null) return; Grid.SetColumn(ele, parent.ColumnDefinitions.Count); var length = 0.0; if (value.Contains("*")) { value = value.Replace("*", ""); double.TryParse(value ,out length); if (length == 0) length = 1; parent.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(length, GridUnitType.Star) }); } else { double.TryParse(value, out length); parent.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(length, GridUnitType.Pixel) }); } } public static string GetRowDefinition(DependencyObject obj) { return (string)obj.GetValue(RowDefinitionProperty); } public static void SetRowDefinition(DependencyObject obj, string value) { obj.SetValue(RowDefinitionProperty, value); } public static readonly DependencyProperty RowDefinitionProperty = DependencyProperty.RegisterAttached("RowDefinition", typeof(string), typeof(Helper), new PropertyMetadata(OnRowDefinitionChanged)); private static void OnRowDefinitionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var value = (string)e.NewValue; var ele = d as FrameworkElement; var parent = ele.Parent as Grid; if (parent == null) return; Grid.SetRow(ele, parent.RowDefinitions.Count); var length = 0.0; if (value.Contains("*")) { value = value.Replace("*", ""); double.TryParse(value, out length); if (length == 0) length = 1; parent.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(length, GridUnitType.Star) }); } else { double.TryParse(value, out length); parent.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(length, GridUnitType.Pixel) }); } } #endregion #region Height & Width public static double GetHeight(DependencyObject obj) { return (double)obj.GetValue(HeightProperty); } public static void SetHeight(DependencyObject obj, double value) { obj.SetValue(HeightProperty, value); } public static readonly DependencyProperty HeightProperty = DependencyProperty.RegisterAttached("Height", typeof(double), typeof(Helper), new PropertyMetadata(OnHeightChanged)); private static void OnHeightChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var value = (double)e.NewValue; var ele = d as FrameworkElement; var parent = ele.Parent as FrameworkElement; if (parent == null) return; parent.Loaded += delegate { ele.Height = parent.ActualWidth * value; }; } public static double GetWidth(DependencyObject obj) { return (double)obj.GetValue(WidthProperty); } public static void SetWidth(DependencyObject obj, double value) { obj.SetValue(WidthProperty, value); } public static readonly DependencyProperty WidthProperty = DependencyProperty.RegisterAttached("Width", typeof(double), typeof(Helper), new PropertyMetadata(OnWidthChanged)); private static void OnWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var value = (double)e.NewValue; var ele = d as FrameworkElement; var parent = ele.Parent as FrameworkElement; if (parent == null) return; parent.Loaded += delegate { ele.Width = parent.ActualWidth * value; }; } #endregion } } ================================================ FILE: Panuon.UI/Z_Models/PUComboBoxItemModel.cs ================================================ using System; using System.ComponentModel; namespace Panuon.UI { public class PUComboBoxItemModel : INotifyPropertyChanged { protected internal virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public event PropertyChangedEventHandler PropertyChanged; #region Constructor public PUComboBoxItemModel() { Uid = Guid.NewGuid().ToString("N"); } #endregion #region Property /// /// 要显示的名称。可以作为SelectValuePath的值。 /// public string Header { get { return _header; } set { _header = value; OnPropertyChanged("Header"); } } private string _header = ""; /// /// 该对象的值。可以作为SelectValuePath的值。 /// 若Value不是值类型,使用Value作为匹配时会逐一比较每一个可写属性的值(参见PanuonUI.Utils扩展方法IsEqual)。 /// public object Value { get { return _value; } set { _value = value; OnPropertyChanged("Value"); } } private object _value; /// /// 是否显示删除按钮。 /// public bool CanDelete { get { return _canDelete; } set { _canDelete = value; OnPropertyChanged("CanDelete"); } } private bool _canDelete = false; /// /// 生成该对象时,自动生成的唯一ID。该属性 与该对象生成的PUComboBoxItem的Uid属性值相等。 /// public string Uid { get { return _uid; } private set { _uid = value; } } private string _uid; #endregion } } ================================================ FILE: Panuon.UI/Z_Models/PUListBoxItemModel.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows; namespace Panuon.UI { /// /// 用于ListBox绑定的模型。 /// public class PUListBoxItemModel : INotifyPropertyChanged { protected internal virtual void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } public event PropertyChangedEventHandler PropertyChanged; #region Constructor public PUListBoxItemModel() { Uid = Guid.NewGuid().ToString("N"); } #endregion #region Property /// /// 要显示的内容。可以作为SelectValuePath的值。用于设置ListBoxItem的Content属性。 /// public object Header { get { return _header; } set { _header = value; OnPropertyChanged("Header"); } } private object _header = ""; /// /// 该对象的值。可以作为SelectValuePath的值。 /// 若Value不是值类型,使用Value作为匹配时会逐一比较每一个可写属性的值(参见PanuonUI.Utils扩展方法IsEqual)。 /// public object Value { get { return _value; } set { _value = value; OnPropertyChanged("Value"); } } private object _value; #endregion #region Internal Property internal string Uid { get { return _uid; } set { _uid = value; } } private string _uid; #endregion } } ================================================ FILE: Panuon.UI/Z_Models/PUTabItemModel.cs ================================================ using System; using System.ComponentModel; namespace Panuon.UI { public class PUTabItemModel : INotifyPropertyChanged { protected internal virtual void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } public event PropertyChangedEventHandler PropertyChanged; #region Constructor public PUTabItemModel() { Uid = Guid.NewGuid().ToString("N"); } #endregion #region Property /// /// 要显示的名称。可以作为SelectValuePath的值。 /// public object Header { get { return _header; } set { _header = value; OnPropertyChanged("Header"); } } private object _header = ""; /// /// 该对象的值。可以作为SelectValuePath的值。 /// 若Value不是值类型,使用Value作为匹配时会逐一比较每一个可写属性的值(参见PanuonUI.Utils扩展方法IsEqual)。 /// public object Value { get { return _value; } set { _value = value; OnPropertyChanged("Value"); } } private object _value; /// /// 显示在标题前的图标,为空时不显示。 /// public object Icon { get { return _icon; } set { _icon = value; OnPropertyChanged("Icon"); } } private object _icon; /// /// 是否显示删除按钮。 /// public bool CanDelete { get { return _canDelete; } set { _canDelete = value; OnPropertyChanged("CanDelete"); } } private bool _canDelete = false; /// /// TabItem的内容。 /// public object Content { get { return _content; } set { _content = value; OnPropertyChanged("Content"); } } private object _content = 0; /// /// 高度,默认值为30。 /// public double Height { get { return _height; } set { _height = value; OnPropertyChanged("Height"); } } private double _height = 30; #endregion #region Internal Property internal string Uid { get { return _uid; } set { _uid = value; } } private string _uid; #endregion } } ================================================ FILE: Panuon.UI/Z_Models/PUTreeViewItemModel.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows; namespace Panuon.UI { /// /// 用于TreeView绑定的模型。 /// public class PUTreeViewItemModel : INotifyPropertyChanged { protected internal virtual void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } public event PropertyChangedEventHandler PropertyChanged; #region Constructor public PUTreeViewItemModel() { Uid = Guid.NewGuid().ToString("N"); Padding = new Thickness(10, 0, 0, 0); } #endregion #region Property /// /// 要显示的名称。可以作为SelectValuePath的值。 /// public string Header { get { return _header; } set { _header = value; OnPropertyChanged("Header"); } } private string _header = ""; /// /// 该对象的值。可以作为SelectValuePath的值。 /// 若Value不是值类型,使用Value作为匹配时会逐一比较每一个可写属性的值(参见PanuonUI.Utils扩展方法IsEqual)。 /// public object Value { get { return _value; } set { _value = value; OnPropertyChanged("Value"); } } private object _value; /// /// 该项的子项目。 /// public List Items { get { return _items; } set { _items = value; OnPropertyChanged("Items"); } } private List _items; /// /// 缩进。默认值为10,0,0,0。 /// public Thickness Padding { get { return _padding; } set { _padding = value; OnPropertyChanged("Padding"); } } private Thickness _padding; /// /// 悬浮时显示的内容。 /// public object ToolTip { get { return _toolTip; } set { _toolTip = value; OnPropertyChanged("ToolTip"); } } private object _toolTip; #endregion #region Internal Property internal string Uid { get { return _uid; } set { _uid = value; } } private string _uid; #endregion } } ================================================ FILE: Panuon.UI/Z_Others/Converters.cs ================================================ using System; using System.Globalization; using System.Windows; using System.Windows.Data; using System.Windows.Media; namespace Panuon.UI { internal class DropDownBorderPathConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { var width = values[0] as double? ?? 0; var height = values[1] as double? ?? 0; var contentWidth = values[2] as double? ?? 0; var contentHeight = values[3] as double? ?? 0; var placement = values[4] as DropDownPlacement? ?? DropDownPlacement.LeftBottom; var radius = values[5] as double? ?? 0; var path = ""; switch (placement) { case DropDownPlacement.LeftBottom: path = $"M 1,{radius + 7} A{radius},{radius} 0 0 1 {radius + 1}, 7 H {width - contentWidth / 2 - 5} L {width - contentWidth / 2},1 L {width - contentWidth / 2 + 5},7 H {width - radius - 1} A{radius},{radius} 0 0 1 {width - 1}, {radius + 7}" + $"V {height - radius - 1} A{radius},{radius} 0 0 1 {width - radius - 1}, {height - 1} H {radius + 1} A{radius},{radius} 0 0 1 1, {height - radius - 1} Z"; break; } return Geometry.Parse(path); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } //ProgressBar专用内部圆角转换器 internal class GeneralProgressBarConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是CornerRadius,1是Direction var cr = (CornerRadius)values[0]; var dir = (ProgressDirections)values[1]; if (dir == ProgressDirections.LeftToRight) return new CornerRadius(cr.TopLeft, 0, 0, cr.BottomLeft); else if (dir == ProgressDirections.RightToLeft) return new CornerRadius(0, cr.TopRight, cr.BottomRight, 0); else if (dir == ProgressDirections.TopToBottom) return new CornerRadius(cr.TopLeft, cr.TopRight, 0, 0); else return new CornerRadius(0, 0, cr.BottomRight, cr.BottomLeft); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } internal class RingProgressBarConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是CornerRadius,1是Direction var width = (double)values[0]; var height = (double)values[1]; var radius = (double)values[2]; var percent = values.Length == 3 ? 1 : (double)values[3]; var point1X = height / 2 * Math.Cos((2 * percent - 0.5) * Math.PI) + height / 2; var point1Y = height / 2 - height / 2 * Math.Sin((2 * percent + 0.5) * Math.PI); var point2X = (height - radius)/ 2 * Math.Cos((2 * percent - 0.5) * Math.PI) + height / 2; var point2Y = height / 2 - (height - radius) / 2 * Math.Sin((2 * percent + 0.5) * Math.PI); var path = ""; if(percent == 0) { path = ""; } else if (percent < 0.5) { path = "M " + width / 2 + "," + radius / 2 + " A " + (width - radius) / 2 + "," + (width - radius) / 2 + " 0 0 1 " + point2X + "," + point2Y + ""; } else if(percent == 0.5) { path = "M " + width / 2 + "," + radius / 2 + " A " + (width - radius) / 2 + "," + (width - radius) / 2 + " 0 0 1 " + width / 2 + "," + (height - radius / 2); } else { path = "M " + width / 2 + "," + radius / 2 + " A " + (width - radius) / 2 + "," + (width - radius) / 2 + " 0 0 1 " + width / 2 + "," + (height - radius / 2) + " A " + (width - radius) / 2 + "," + (width - radius) / 2 + " 0 0 1 " + point2X + "," + point2Y + ""; } return PathGeometry.Parse(path); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } internal class BubbleConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { var location = (AnglePositions)values[0]; var radius = (CornerRadius)values[1]; var width = (double)values[2]; var height = (double)values[3]; var path = ""; switch (location) { case AnglePositions.Left: if (radius == new CornerRadius(0)) path = "M0," + height / 2 + "L5," + (height / 2 + 4) + "V" + height + "H" + width + "V 0 H 5 V" + (height / 2 - 4) + "Z"; else path = "M0," + height / 2 + "L5," + (height / 2 + 4) + "V" + (height - radius.BottomLeft) + "A" + radius.BottomLeft + "," + radius.BottomLeft + " 0 0 0 " + (5 + radius.BottomLeft) + "," + height + "H" + (width - radius.BottomRight) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + width + "," + (height - radius.BottomRight) + "V" + radius.TopRight + "A" + radius.TopRight + "," + radius.TopRight + " 0 0 0 " + (width - radius.TopRight) + "," + 0 + "H" + (5 + radius.TopLeft) + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 5 + "," + radius.TopLeft + "V" + (height / 2 - 4) + "Z"; break; case AnglePositions.BottomLeft: if (radius == new CornerRadius(0)) path = "M0," + height + "L4," + (height - 5) + "H " + width + "V 0 H 0 Z"; else path = "M0," + height + "L4," + (height - 5) + "H" + (width - radius.BottomRight) + "A" + radius.BottomRight +"," + radius.BottomRight + " 0 0 0 " + width + "," + (height - radius.BottomRight - 5) + "V" + radius.TopRight + "A" + radius.TopRight + "," + radius.TopRight + " 0 0 0 " + (width - radius.TopRight) + "," + 0 + "H" + radius.TopLeft + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 0 + "," + radius.TopLeft + "Z"; break; case AnglePositions.BottomCenter: if (radius == new CornerRadius(0)) path = "M" + width / 2 + "," + height + "L" + (width / 2 + 5) + "," + (height - 4) + "H" + width + "V 0 H 0 V" + (height - 4) + "H" + (width / 2 - 5) + "Z"; else path = "M" + width / 2 + "," + height + "L" + (width / 2 + 5) + "," + (height - 4) + "H" + (width - radius.BottomRight) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + width + "," + (height - radius.BottomRight - 5) + "V" + radius.TopRight + "A" + radius.TopRight + "," + radius.TopRight + " 0 0 0 " + (width - radius.TopRight) + "," + 0 + "H" + radius.TopLeft + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 0 + "," + radius.TopLeft + "V" + (height - radius.BottomRight - 5) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + radius.BottomRight + "," + (height - 5) + "H" + (width / 2 - 5) + "Z"; break; case AnglePositions.BottomRight: if (radius == new CornerRadius(0)) path = "M" + width + "," + height + "V 0 H 0 V " + (height - 4) + "H" + (width - 5) + "Z"; else path = "M" + width + "," + height + "V" + radius.TopRight + "A" + radius.TopRight + ","+ radius.TopRight + " 0 0 0 " + (width - radius.TopRight) + "," + 0 + "H" + radius.TopLeft + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 0 + "," + radius.TopLeft + "V" + (height - radius.BottomRight - 5) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + radius.BottomRight + "," + (height - 5) + "H" + (width - 5) + "Z"; break; case AnglePositions.Right: if (radius == new CornerRadius(0)) path = "M" + width + "," + height / 2 + "L" + (width - 5) + "," + (height / 2 - 4) + "V 0 H 0 V" + height + "H " + (width - 5) + "V" + (height / 2 + 4) + "Z"; else path = "M" + width + "," + height / 2 + "L" + (width - 5) + "," + (height / 2 - 4) + "V" + radius.TopRight + "A" + radius.TopRight + "," + radius.TopRight + " 0 0 0 " + (width - radius.TopRight - 5) + "," + 0 + "H" + radius.TopLeft + "A" + radius.TopLeft + "," + radius.TopLeft + " 0 0 0 " + 0 + "," + radius.TopLeft + "V" + (height - radius.BottomLeft) + "A" + radius.BottomLeft + "," + radius.BottomLeft + " 0 0 0 " + radius.BottomLeft + "," + height + "H" + (width - radius.BottomRight - 5) + "A" + radius.BottomRight + "," + radius.BottomRight + " 0 0 0 " + (width - 5) + "," + (height - radius.BottomRight) + "V" + (height / 2 + 4) + "Z"; break; } return Geometry.Parse(path); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } internal class IsNullConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return value == null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } internal class WidthToMarginConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var actualWidth = (double)value; return new Thickness(actualWidth, 0, 0, 1); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } internal class HeightToMarginConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var actualHeight = (double)value; return new Thickness(0, actualHeight, 0, 1); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } internal class BooleanToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var visible = (bool)value; return visible ? Visibility.Visible : Visibility.Hidden; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return false; } } internal class MarginToWidthConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var thickness = (Thickness)value; return thickness.Left; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } //Window Header和Title转换器 internal class HeaderConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是Header,1是Title return (string)values[0] == null ? (string)values[1]: (string)values[0]; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } //Icon字体大小转换器( + 5) internal class IconFontSizeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (double)value + 5; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } //CheckBox General样式内部对号的缩放比例 internal class ScaleConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是InnerWidth,1是InnerHeight var minvalue = (double)values[0] < (double)values[1] ? (double)values[0] : (double)values[1]; return minvalue / 22; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } internal class ToggleHeightConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (double)value - 2; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } //内部Toggle的圆角转换器 internal class ToHalfConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (double)value / 2; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return DependencyProperty.UnsetValue; } } //内部Toggle的水平偏移量转换器 internal class ToggleTranslateXConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是InnerWidth,1是InnerHeight return ((double)values[0] - (double)values[1] + 1) * -1; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } //文本框内部宽度转换器 internal class TextBoxInnerWidthConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是Width,1是Padding,,2是HorizontalContentAlignment if ((HorizontalAlignment)values[2] != HorizontalAlignment.Center) return (double)values[0] - ((Thickness)values[1]).Left - ((Thickness)values[1]).Right; else return DependencyProperty.UnsetValue; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } //文本框内部高度转换器 internal class TextBoxInnerHeightConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //0是Heihgt,1是Padding,2是VerticalContentAlignment if ((VerticalAlignment)values[2] != VerticalAlignment.Center) return (double)values[0] - ((Thickness)values[1]).Top - ((Thickness)values[1]).Bottom; else return DependencyProperty.UnsetValue; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return new object[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; } } } ================================================ FILE: Panuon.UI/Z_Others/Enums.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/19 11:09:29 *说明: *日志:2018/11/19 11:09:29 创建。 *==============================================================*/ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UI { #region DropDown public enum DropDownPlacement { Bottom, RightBottom, LeftBottom } #endregion public enum ImageType { Rectangle, Square, } /// /// (PanuonUI) Animation styles for PUWindow. /// public enum AnimationStyles { /// /// 缩放。 /// Scale = 0, /// /// 一个从上到下的渐变显示。 /// Gradual = 1, /// /// 渐入渐出。 /// Fade = 2 } /// /// (PanuonUI) Button styles for PUButton. /// public enum ButtonStyles { /// /// 一个常规按钮。 /// General = 1, /// /// 一个带边框的空心按钮,当鼠标悬浮时才会显示背景色。 /// 当鼠标移入时,该按钮的背景色将由Background变为指定的CoverBrush。 /// Hollow = 2, /// /// 一个带边框的空心按钮,当鼠标悬浮时才会显示前景色。 /// 当鼠标移入时,该按钮的边框和前景色将由BorderBrush和Foreground变为指定的CoverBrush。 /// Outline = 3, /// /// 一个不带任何边框和背景色的文字按钮。 /// 当鼠标移入时,该按钮的前景色将由Foreground变为指定的CoverBrush。 /// Link = 4, } /// /// (PanuonUI) Button styles for PURepeatButton. /// public enum RepeatButtonStyles { /// /// 一个常规按钮。 /// General = 1, /// /// 一个带边框的空心按钮,当鼠标悬浮时才会显示背景色。 /// 当鼠标移入时,该按钮的背景色将由Background变为指定的CoverBrush。 /// Hollow = 2, /// /// 一个带边框的空心按钮,当鼠标悬浮时才会显示前景色。 /// 当鼠标移入时,该按钮的边框和前景色将由BorderBrush和Foreground变为指定的CoverBrush。 /// Outline = 3, /// /// 一个不带任何边框和背景色的文字按钮。 /// 当鼠标移入时,该按钮的前景色将由Foreground变为指定的CoverBrush。 /// Link = 4, } /// /// (PanuonUI) Button click styles for PUButton. /// public enum ClickStyles { /// /// 点击按钮时不触发下沉操作。 /// Classic, /// /// 点击时按钮下沉2个px。 /// Sink, } /// /// (PanuonUI) TextBox styles for PUTextBox. /// public enum TextBoxStyles { /// /// 一个标准的文本框。 /// General = 1, /// /// 一个文本框前带图标的文本框。 /// IconGroup = 2, } /// /// (PanuonUI) PasswordBox styles for PUPasswordBox. /// public enum PasswordBoxStyles { /// /// 一个标准的密码框。 /// General = 1, /// /// 一个密码框前带图标的密码框。 /// IconGroup = 2, } /// /// (PanuonUI) SelectedValuePath for PUTabControl , PUComboBox and PUTreeView /// public enum SelectedValuePaths { /// /// SelectedValue应呈现被选中子项的Header属性(在ComboBox中为Content属性)。 /// Header, /// /// SelectedValue应呈现被选中子项的Value属性。 /// Value } /// /// (PanuonUI) SelectedValuePath for PUTabControl , PUComboBox and PUTreeView /// public enum ChoosedValuePaths { /// /// ChoosedValue应呈现被选中子项的Header属性。 /// Header, /// /// ChoosedValue应呈现被选中子项的Value属性。 /// Value } /// /// (PanuonUI) DeleteModes for PUTabControl and PUComboBox /// public enum DeleteModes { /// /// 当用户点击删除按钮时,应立即删除项目并触发DeleteItem路由事件。 /// Delete, /// /// 当用户点击删除按钮时,不删除项目,只触发DeleteItem路由事件。 /// EventOnly, } /// /// (PanuonUI) SearchMode for PUComboBox /// public enum SearchModes { /// /// 不显示搜索框。 /// None, /// /// 在搜索框按下键盘时搜索。 /// TextChanged, /// /// 当按下Enter键时发起搜索。 /// Enter, } /// /// (PanuonUI) CheckBoxStyles for PUCheckBox /// public enum CheckBoxStyles { /// /// 一个标准的选择框。 /// General = 1, /// /// 一个经典样式的选择框。 /// Classic = 2, /// /// 一个开关样式的选择框。 /// Switch = 3, /// /// 一个带有左边线的选择框。 /// Branch = 4, /// /// 一个类似于按钮样式的选择框。 /// Button = 5, } /// /// (PanuonUI) RadioButtonStyles for PURadioButton /// public enum RadioButtonStyles { /// /// 一个标准的RadioButton。 /// General = 1, /// /// 一个经典样式的RadioButton。 /// Classic = 2, /// /// 一个开关样式的RadioButton。 /// Switch = 3, /// /// 一个带有左边线的RadioButton。 /// Branch = 4, /// /// 一个类似于按钮样式的选择框。 /// Button = 5, } /// /// (PanuonUI) ProgressDirections for PUProgressBar /// public enum ProgressDirections { /// /// 从左到右填充进度。 /// LeftToRight, /// /// 从右到左填充进度。 /// RightToLeft, /// /// 从上到下填充进度。 /// TopToBottom, /// /// 从下到上填充进度。 /// BottomToTop, } /// /// (PanuonUI) ProgressBarStyles for PUProgressBar /// public enum ProgressBarStyles { /// /// 一个标准的进度条。 /// General, /// /// 一个环形的进度条。 /// Ring } /// /// (PanuonUI) TreeViewStyles for PUTreeView /// public enum TreeViewStyles { General, Classic, } public enum ExpandModes { /// /// 单击TreeViewItem时展开(如果有子项)。 /// Click, /// /// 双击TreeViewItem时展开(如果有子项)。 /// DoubleClick, } /// /// (PanuonUI) TabControlStyles for PUTabControl /// public enum TabControlStyles { General, Classic, } /// /// (PanuonUI) DatePickerModes for PUDatePicker /// public enum DatePickerModes { /// /// 年 月 日。 /// DateOnly, /// /// 时 分 秒。 /// TimeOnly, /// /// 年 月 日 时 分 秒。 /// DateTime, } /// /// (PanuonUI) AnglePositions for PUBubble /// public enum AnglePositions { /// /// 尖角位于左侧。 /// Left, /// /// 尖角位于左下角。 /// BottomLeft, /// /// 尖角位于中间的底部。 /// BottomCenter, /// /// 尖角位于右下角。 /// BottomRight, /// /// 尖角位于右侧。 /// Right, } /// /// (PanuonUI) Buttons for PUMessageBox /// public enum Buttons { /// /// 好 /// Sure, /// /// 是 /// Yes, /// /// 确定 /// OK, /// /// 取消 /// Cancel, /// /// 是/否 /// YesOrNo, /// /// 是/取消 /// YesOrCancel, /// /// 确定/取消 /// OKOrCancel, /// /// 接受/取消 /// AcceptOrCancel, /// /// 接受/拒绝 /// AcceptOrRefused, } /// /// (PanuonUI) TextTypes for PUTextBox /// public enum TextTypes { /// /// 允许所有文本输入。 /// Text, /// /// 只允许输入数字、以及其他操控键。 /// Number, /// /// 只允许输入数字、小数点、以及其他操控键。 /// Decimal, } } ================================================ FILE: Panuon.UI/Z_Others/SkipCompareAttribute.cs ================================================ using System; namespace Panuon.UI { [AttributeUsage(AttributeTargets.Property)] public class SkipCompareAttribute : Attribute { } } ================================================ FILE: Panuon.UI/Z_Utils/Extends.cs ================================================ using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Reflection; namespace Panuon.UI.Utils { public static class Extends { #region Interger /// /// 将0~10的数字转换为文字。 /// public static char ToSingleChineseNumber(this int number) { var array = "零一二三四五六七八九十"; return array[number]; } public static string ToSizeString(this int byteSize) { if (byteSize > 1024 * 1024 * 1024) { return (byteSize * 1.0 / 1024 / 1024 / 1024).ToString("f2") + "GB"; } else if (byteSize > 1024 * 1024) { return (byteSize * 1.0 / 1024 / 1024).ToString("f2") + "MB"; } else if (byteSize > 1024) { return (byteSize * 1.0 / 1024).ToString("f2") + "KB"; } else { return byteSize + "B"; } } #endregion #region String /// /// 尝试将字符串转换为整数,若转换失败,则返回0。 /// public static int ToInt(this string context) { if (string.IsNullOrEmpty(context)) return 0; var result = 0; if (int.TryParse(context, out result)) return result; else return 0; } /// /// 尝试将字符串转换为小数,若转换失败,则返回0。 /// public static double ToDouble(this string context) { if (string.IsNullOrEmpty(context)) return 0; var result = 0.0; if (double.TryParse(context, out result)) return result; else return 0; } /// /// 尝试将字符串转换为布尔值,若转换失败,则返回False。 /// public static bool ToBoolean(this string context) { if (string.IsNullOrEmpty(context)) return false; var result = false; if (bool.TryParse(context, out result)) return result; else return false; } #endregion #region DateTime /// /// 将时间转换成时间戳(精确到毫秒)。 /// public static long ToTimeStamp(this DateTime date) { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1); return Convert.ToInt64(ts.TotalMilliseconds); } /// /// 与另一个日期的年月日进行比较,若相同,则返回True。 /// public static bool CompareYearMonthDay(this DateTime date1, DateTime date2) { return date1.Date == date2.Date; } #endregion #region Long /// /// 将时间戳转换成时间(精确到毫秒)。 /// public static DateTime ToDate(this long timeStamp) { return TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddMilliseconds((long)timeStamp); } public static string ToSizeString(this long byteSize) { if (byteSize > 1024 * 1024 * 1024) { return (byteSize * 1.0 / 1024 / 1024 / 1024).ToString("f2") + "GB"; } else if (byteSize > 1024 * 1024) { return (byteSize * 1.0 / 1024 / 1024).ToString("f2") + "MB"; } else if (byteSize > 1024) { return (byteSize * 1.0 / 1024).ToString("f2") + "KB"; } else { return byteSize + "B"; } } #endregion #region List /// /// 将列表中的每个元素拼接成一段字符串。 /// /// 分隔符。 public static string ToString(this IList list, string spliter) { return String.Join(spliter, list); } public static ObservableCollection ToObservableCollection(this IList list) { return new ObservableCollection(list); } #endregion #region Dictionary /// /// 将字典中指定键的键值对返回到一个枚举集合中。 /// /// 唯一键。 /// 数据值。 /// 要查找的键集合。 /// public static IEnumerable> GetValues(this IDictionary dic, IEnumerable keys) { foreach (var key in keys) { yield return new KeyValuePair(key, dic[key]); } } #endregion #region Others /// /// 比较两个对象的可写属性(具有非Private的Set访问器)是否完全相等。 /// 对于无需比较的属性或集合型属性,您必须为其加上SkipCompare特性标签。集合型属性在比较时会因异常而返回False。 /// 若两个对象均为Null,则返回True;若只有一个为Null,则返回False。 /// /// 要比较的另一个值。 public static bool IsEqual(this T obj, T value) { try { if (obj == null && value == null) return true; else if (obj == null || value == null) return false; Type type = obj.GetType(); if (type.IsValueType || type.FullName == typeof(string).FullName) return obj.Equals(value); foreach (var propertyInfo in type.GetProperties()) { if (propertyInfo.CanWrite) { if (Attribute.IsDefined(propertyInfo, typeof(SkipCompareAttribute))) { continue; } var propType = propertyInfo.PropertyType; var prop1 = propertyInfo.GetValue(obj, null); var prop2 = propertyInfo.GetValue(value, null); if (prop1 == null && prop2 == null) continue; else if (prop1 == null || prop2 == null) return false; else if (!propType.IsValueType && propType.FullName != typeof(string).FullName) { if (!prop1.IsEqual(prop2)) { return false; } continue; } else if (!prop1.Equals(prop2)) return false; } } return true; } catch (Exception ex) { return false; } } #endregion #region Function #endregion } } ================================================ FILE: Panuon.UI/Z_Utils/Utils.cs ================================================ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace Panuon.UI.Utils { /// /// 提供Task的简易池化管理,并发任务数量可控。 /// public class TaskPoll { #region Identity private static ConcurrentQueue _taskQueue; private static int _runningTaskQuantity; #endregion #region Property /// /// 获取或设置可以允许同时运行的最大任务数量。 /// 若值为Null,则不限制最大执行数量。 /// public static int? MaxTaskQuantity { get { return _maxTaskQuantity; } set { _maxTaskQuantity = value; RecheckQueue(); } } private static int? _maxTaskQuantity; /// /// 获取当前任务池中的任务总数(包括排队中和正在执行的)。 /// public static int CurrentTaskQuantity { get { return _taskQueue == null ? 0 : _taskQueue.Count; } } /// /// 获取当前正在执行的任务数量。 /// public static int RunningTaskQuantity { get { return _runningTaskQuantity; } } #endregion #region APIs /// /// 使用默认值初始化TaskManager。首次调用StartNew方法时,TaskManager将自动执行初始化。 /// public static void Init() { _taskQueue = new ConcurrentQueue(); _runningTaskQuantity = 0; } /// /// 使用指定值初始化TaskManager。 /// 允许同时运行的最大任务数量。 /// public static void Init(int maxTaskQuantity) { MaxTaskQuantity = maxTaskQuantity; _taskQueue = new ConcurrentQueue(); _runningTaskQuantity = 0; } /// /// 向任务队列中插入一个待执行的新任务,该任务将在合适的时机执行。 /// public static void StartNew(Task task) { if (_taskQueue == null) Init(); _taskQueue.Enqueue(task); RecheckQueue(); } /// /// 向任务队列中插入一个待执行的新任务,该任务将在合适的时机执行。 /// public static void StartNew(Task task) { if (_taskQueue == null) Init(); _taskQueue.Enqueue(task); RecheckQueue(); } #endregion #region Funtion private static void RecheckQueue() { if (_taskQueue == null) return; if (_taskQueue.Count == 0 || (MaxTaskQuantity != null && _runningTaskQuantity >= MaxTaskQuantity)) return; Task task; if (!_taskQueue.TryDequeue(out task)) { RecheckQueue(); return; } if (task.Status != TaskStatus.Created && task.Status != TaskStatus.WaitingToRun) { RecheckQueue(); return; } Interlocked.Increment(ref _runningTaskQuantity); task.ContinueWith((t) => { Interlocked.Decrement(ref _runningTaskQuantity); RecheckQueue(); }); task.Start(); if (_runningTaskQuantity < MaxTaskQuantity) RecheckQueue(); } #endregion } /// /// 伸缩缓存池。当你需要在缓存中保存大量的数据时(一次性读取可能占用较高内存),只需读取数据的唯一键并储存该键到缓存池中即可。 /// 当你使用Get或GetAll方法访问缓存值时,您可以指定当缓存中不存在某个(或某些)键的值,或某些键对应的值为Default值时,应该进行的后续处理操作。 /// /// 标识该缓存的唯一键。 /// 该缓存的实际值。 public class CachePoll { #region Constructor /// /// 初始化伸缩缓存池实例。该缓存池将不会定时回收资源。 /// public CachePoll() { _caches = new ConcurrentDictionary>(); } /// /// 初始化伸缩缓存池实例,并指定缓存的生命周期时间。该缓存池将不会定时回收资源,但您可以使用Collect()方法手动回收缓存。 /// /// 每个缓存的生命周期。当调用Collect()方法时,若该缓存的最后一次访问(更新或获取)时间超过此期限,则其缓存值将被释放(但不会移除键)。 public CachePoll(TimeSpan ttl) { _caches = new ConcurrentDictionary>(); } /// /// 初始化伸缩缓存池实例,并指定缓存的生命周期时间,以及定时回收缓存的时间间隔。您也可以使用Collect()方法立即回收缓存。 /// /// 每个缓存的生命周期。当调用Collect()方法时,若该缓存的最后一次访问(更新或获取)时间超过此期限,则其缓存值将被释放(但不会移除键)。 /// 定时回收缓存的时间间隔,计时器将定时调用Collect()方法。建议值为1倍~2倍的缓存生命周期时间。 public CachePoll(TimeSpan ttl, TimeSpan collectInterval) { _caches = new ConcurrentDictionary>(); _ttl = ttl; _collectInterval = collectInterval; _timer = new Timer(OnTick, null, (int)_collectInterval.Value.TotalMilliseconds, Timeout.Infinite); } #endregion #region Identity private static ConcurrentDictionary> _caches { get; set; } private static Timer _timer; private static TimeSpan? _ttl; private static TimeSpan? _collectInterval; private int _isCollecting; #endregion #region EventHandler /// /// 表示缓存值已更新(仅更新键时将不会触发此事件)。当指定此事件的后续处理时,该处理将以同步模式执行。事件参数: sender = List, e = null /// public EventHandler Updated; /// /// 缓存已回收。当指定此事件的后续处理时,该处理将以同步模式执行。事件参数:sender = List, e = null /// public EventHandler Collected; #endregion #region Property /// /// 获取当前的所有缓存。 /// public IEnumerable> Caches { get { return _caches.Select(x => new KeyValuePair(x.Key, x.Value.Value)); } } /// /// 获取真实缓存的数量(TValue为默认值的缓存不会计入)。 /// public int RealCount { get { return _caches.Count(x => x.Value.Value != null); } } /// /// 获取所有缓存的数量。 /// public int Count { get { return _caches.Count; } } /// /// 获取是否正在回收缓存。 /// public bool IsCollecting { get { return _isCollecting == 1; } } /// /// 获取缓存的生命周期。 /// public TimeSpan? CacheTTL { get { return _ttl; } } /// /// 获取缓存的回收间隔。 /// public TimeSpan? CollectInterval { get { return _collectInterval; } } #endregion #region APIs public bool ContainsKey(TKey key) { return _caches.ContainsKey(key); } /// /// 向缓存池中添加一个占位缓存,该缓存的实际值为Default值。 /// 若该键已存在,则不会有任何操作。 /// /// 要添加的键。 public void AddKey(TKey key) { _caches.TryAdd(key, new CacheModel()); } /// /// 向缓存池中添加一组占位缓存,该缓存只有键而不具有实际值。、 /// 若该键已存在,则不会有任何操作。 /// /// 要添加的一组键。 public void AddKeys(IEnumerable keys) { foreach (var key in keys) { _caches.TryAdd(key, new CacheModel()); } } /// /// 向缓存池中添加一个键值对,若添加成功,将触发Updated事件。若键已存在于缓存池中,将替换原有的值。 /// 请勿在循环中调用此方法,这将频繁触发Updated事件,并严重影响性能。若要一次性添加多个值,请使用AddOrUpdates方法。 /// /// 要添加的键。 /// 该键对应的值。 public void AddOrUpdate(TKey key, TValue value) { var newModel = new CacheModel(value); if (_caches.AddOrUpdate(key, newModel, (k, v) => newModel) != null) { Updated?.Invoke(new List { key }, null); }; } /// /// 向缓存池中添加一组键值对,若有至少一个值添加成功,将在添加结束后触发Updated事件。若键已存在于缓存池中,将替换原有的值。 /// /// 要添加的一组键值对。 public void AddOrUpdates(IEnumerable> keyValuePairs) { var updatedKeys = new List(); foreach (var pair in keyValuePairs) { var newModel = new CacheModel(pair.Value); if(_caches.AddOrUpdate(pair.Key, newModel, (k, v) => newModel) != null) { updatedKeys.Add(pair.Key); } } if(updatedKeys.Count != 0) Updated?.Invoke(updatedKeys, null); } /// /// 获取指定键的缓存值。若该键不存在,则返回默认值。 /// /// 要查找的键。 /// public TValue Get(TKey key) { if (_caches.ContainsKey(key)) { var cache = _caches[key]; cache.LastTime = DateTime.Now.ToTimeStamp(); return cache.Value; } else { return default(TValue); } } /// /// 获取指定键的缓存值。若该键不存在或该键对应的值为Default值,则将在调用事件处理方法后继续尝试返回该键的值。 /// 若连续5次调用事件处理后仍无法找到该键或该键对应的值始终为Default值,将抛出CacheNotExistsException异常。 /// /// 要查找的键。 /// 若该键不存在或该键对应的值为Default值,则调用此回调方法来处理后续内容。您应当在此事件处理中向缓存池添加该键(若不存在)及其实际值,否则该处理事件将将被继续调用。 /// public TValue Get(TKey key, EventHandler lackItemCallback) { int count = 0; while (!_caches.ContainsKey(key) || IsDefault(_caches[key].Value)) { if (count == 5) { return default(TValue); } lackItemCallback.Invoke(key, null); count++; } var cache = _caches[key]; cache.LastTime = DateTime.Now.ToTimeStamp(); return cache.Value; } public IEnumerable> GetAll(IEnumerable keys) { var dictionary = keys.ToDictionary(k => k, v => default(TValue)); var timeStamp = DateTime.Now.ToTimeStamp(); foreach (var key in keys) { var cache = _caches[key]; dictionary[key] = cache.Value; cache.LastTime = timeStamp; } return dictionary; } /// /// 获取所有指定键的缓存值。若至少一个键不存在,或该键的缓存值为默认值,则触发事件回调处理。 /// /// /// 若至少一个键不存在,或其缓存值为默认值,则触发此回调方法处理后续操作。 /// public IDictionary GetAll(IEnumerable keys, EventHandler lackItemsCallback) { var resultDic = keys.ToDictionary(k => k, v => default(TValue)); var lackKeys = new List(); var timeStamp = DateTime.Now.ToTimeStamp(); foreach (var key in keys) { if (_caches.ContainsKey(key)) { var cache = _caches[key]; if (!IsDefault(cache.Value)) { resultDic[key] = cache.Value; cache.LastTime = timeStamp; continue; } } lackKeys.Add(key); } while (lackKeys.Count != 0) { lackItemsCallback.Invoke(lackKeys, null); var lackKeysCopy = lackKeys.ToList(); lackKeys.Clear(); foreach(var key in lackKeysCopy) { var cache = _caches[key]; if (IsDefault(cache.Value)) { lackKeys.Add(key); } else { resultDic[key] = cache.Value; cache.LastTime = timeStamp; } } } return resultDic; } public void ReleaseCache(TKey key) { if (_caches.ContainsKey(key)) { _caches[key].Value = default(TValue); } } public void ReleaseCaches(IEnumerable keys) { foreach(var key in keys) { if (_caches.ContainsKey(key)) { _caches[key].Value = default(TValue); } } } public void Remove(TKey key) { CacheModel outValue; _caches.TryRemove(key, out outValue); } public void RemoveAll(IEnumerable keys) { foreach(var key in keys) { CacheModel outValue; _caches.TryRemove(key, out outValue); } } public bool ChangeKey(TKey oldKey, TKey newKey) { if (_caches.ContainsKey(newKey) || !_caches.ContainsKey(oldKey)) return false; else { CacheModel outValue; if (!_caches.TryRemove(oldKey, out outValue)) return false; if (!_caches.TryAdd(newKey, new CacheModel(outValue.Value))) return false; return true; } } /// /// 立即回收缓存池。最后一次访问(更新或获取)时间超过缓存生命周期的缓存值将被释放(但不会移除其键)。 /// 若至少有一个缓存被成功回收,将调用一次GC的垃圾回收方法来强制清理内存。 /// 频繁回收缓存将严重影响性能。建议调用时间间隔为1倍~2倍的缓存生命周期时间。 /// public void Collect() { if (IsCollecting || _ttl == null) return; var collectIDs = new List(); Interlocked.Exchange(ref _isCollecting, 1); var timeStamp = DateTime.Now.ToTimeStamp(); foreach(var cache in _caches) { if(!IsDefault(cache.Value.Value) && timeStamp - cache.Value.LastTime > _ttl.Value.TotalMilliseconds) { collectIDs.Add(cache.Key); cache.Value.Value = default(TValue); } } Interlocked.Exchange(ref _isCollecting, 0); if(collectIDs.Count != 0) { Collected?.Invoke(collectIDs, null); Updated?.Invoke(collectIDs, null); GC.Collect(); } } #endregion #region Function private void OnTick(object state) { Collect(); _timer.Change((int)_collectInterval.Value.TotalMilliseconds, Timeout.Infinite); } private bool IsDefault( TValue value) { return EqualityComparer.Default.Equals(value, default(TValue)); } #endregion } class CacheModel { #region Constructor public CacheModel() { LastTime = DateTime.Now.ToTimeStamp(); } public CacheModel(T value) { LastTime = DateTime.Now.ToTimeStamp(); Value = value; } #endregion #region Property public T Value { get; set; } public long LastTime { get; set; } #endregion } public class CacheNotExistsException : Exception { #region Constructor public CacheNotExistsException() { } public CacheNotExistsException(Modes mode) { Mode = mode; } #endregion #region Property public Modes Mode { get; set; } #endregion public enum Modes { /// /// 多次无法从缓存中找到指定键。 /// KeyNotFound, /// /// 该键的缓存值始终为Default值。 /// DefaultValue, } } } ================================================ FILE: Panuon.UI.Charts/0_Base/PUChartPoint.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UI.Charts { /// /// 适用于LineChart折线图的Points属性。 /// public class PUChartPoint { /// /// 从0 ~ 1的值,表示该点在纵轴上的高度比例。 /// public double Value { get; set; } /// /// 当鼠标悬浮在该点上时应该显示的实际值。 /// public string ValueTip { get; set; } } } ================================================ FILE: Panuon.UI.Charts/0_Base/PUChartToolTip.xaml ================================================  ================================================ FILE: Panuon.UI.Charts/0_Base/PUChartToolTip.xaml.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace Panuon.UI.Charts { /// /// PUChartToolTip.xaml 的交互逻辑 /// public partial class PUChartToolTip : UserControl { public PUChartToolTip() { InitializeComponent(); } public PUChartToolTip(object header, object value) { Header = header; Value = value; } #region Property public object Header { get { return (object)GetValue(HeaderProperty); } set { SetValue(HeaderProperty, value); } } public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register("Header", typeof(object), typeof(PUChartToolTip)); public object Value { get { return (object)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(PUChartToolTip)); public Brush CoverBrush { get { return (Brush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(Brush), typeof(PUChartToolTip), new PropertyMetadata(new SolidColorBrush(Colors.DimGray))); #endregion } } ================================================ FILE: Panuon.UI.Charts/1_LineChart/PULineChart.cs ================================================ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; namespace Panuon.UI.Charts { public class PULineChart : UserControl { static PULineChart() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PULineChart), new FrameworkPropertyMetadata(typeof(PULineChart))); } #region Property /// /// X轴(横)内容集合。 /// public string[] XAxis { get { return (string[])GetValue(XAxisProperty); } set { SetValue(XAxisProperty, value); } } public static readonly DependencyProperty XAxisProperty = DependencyProperty.Register("XAxis", typeof(string[]), typeof(PULineChart), new PropertyMetadata(true)); /// /// Y轴(纵)内容集合。 /// public string[] YAxis { get { return (string[])GetValue(YAxisProperty); } set { SetValue(YAxisProperty, value); } } public static readonly DependencyProperty YAxisProperty = DependencyProperty.Register("YAxis", typeof(string[]), typeof(PULineChart), new PropertyMetadata(true)); /// /// 点集合,从左侧开始排列。若点的数量不等于X轴座的数量,可能会造成显示不全。 /// public Point[] Points { get { return (Point[])GetValue(PointsProperty); } set { SetValue(PointsProperty, value); } } public static readonly DependencyProperty PointsProperty = DependencyProperty.Register("Points", typeof(Point[]), typeof(PULineChart), new PropertyMetadata(true)); /// /// 将线下方的颜色上色,默认值为透明。 /// public SolidColorBrush CoverBrush { get { return (SolidColorBrush)GetValue(CoverBrushProperty); } set { SetValue(CoverBrushProperty, value); } } public static readonly DependencyProperty CoverBrushProperty = DependencyProperty.Register("CoverBrush", typeof(SolidColorBrush), typeof(PULineChart), new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); /// /// 坐标改变时是否使用动画,默认值为True(使用)。 /// public bool UsingAnimate { get { return (bool)GetValue(UsingAnimateProperty); } set { SetValue(UsingAnimateProperty, value); } } public static readonly DependencyProperty UsingAnimateProperty = DependencyProperty.Register("UsingAnimate", typeof(bool), typeof(PULineChart), new PropertyMetadata(true)); #endregion } } ================================================ FILE: Panuon.UI.Charts/1_LineChart/PULineChart.xaml ================================================  ================================================ FILE: Panuon.UI.Charts/1_LineChart/PULineChart.xaml.cs ================================================ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Globalization; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace Panuon.UI.Charts { /// /// PULineChart.xaml 的交互逻辑 /// public partial class PULineChart : UserControl { #region Identity private double _yWidth = 100; private double _xHeight = 30; #endregion public PULineChart() { InitializeComponent(); } public override void OnApplyTemplate() { base.OnApplyTemplate(); Loaded += delegate { Draw(); }; } #region Property /// /// X轴显示间距。 /// public int XAxisGap { get { return (int)GetValue(XAxisGapProperty); } set { SetValue(XAxisGapProperty, value); } } public static readonly DependencyProperty XAxisGapProperty = DependencyProperty.Register("XAxisGap", typeof(int), typeof(PULineChart), new PropertyMetadata(0, OnXAxisGapChanged)); private static void OnXAxisGapChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var chart = d as PULineChart; if (chart.IsLoaded) { chart.LoadXAxis(chart.ActualWidth); } } /// /// 获取或设置使用动画的方式。默认值为始终使用(Always)。 /// public AnimationModes AnimationMode { get { return (AnimationModes)GetValue(AnimationModeProperty); } set { SetValue(AnimationModeProperty, value); } } public static readonly DependencyProperty AnimationModeProperty = DependencyProperty.Register("AnimationMode", typeof(AnimationModes), typeof(PULineChart), new PropertyMetadata(AnimationModes.Always)); /// /// 获取或设置网格画刷。 /// public Brush GridBrush { get { return (Brush)GetValue(GridBrushProperty); } set { SetValue(GridBrushProperty, value); } } public static readonly DependencyProperty GridBrushProperty = DependencyProperty.Register("GridBrush", typeof(Brush), typeof(PULineChart), new PropertyMetadata(new SolidColorBrush(Colors.LightGray))); /// /// 获取或设置线条画刷。 /// public Brush LineBrush { get { return (Brush)GetValue(LineBrushProperty); } set { SetValue(LineBrushProperty, value); } } public static readonly DependencyProperty LineBrushProperty = DependencyProperty.Register("LineBrush", typeof(Brush), typeof(PULineChart), new PropertyMetadata(new SolidColorBrush(Colors.DimGray))); /// /// 获取或设置线条粗细。 /// public double LineThickness { get { return (double)GetValue(LineThicknessProperty); } set { SetValue(LineThicknessProperty, value); } } public static readonly DependencyProperty LineThicknessProperty = DependencyProperty.Register("LineThickness", typeof(double), typeof(PULineChart), new PropertyMetadata(1.0)); /// /// 获取或设置线条下方的区域画刷。 /// public Brush AreaBrush { get { return (Brush)GetValue(AreaBrushProperty); } set { SetValue(AreaBrushProperty, value); } } public static readonly DependencyProperty AreaBrushProperty = DependencyProperty.Register("AreaBrush", typeof(Brush), typeof(PULineChart)); /// /// 获取或设置点大小。 /// public double PointSize { get { return (double)GetValue(PointSizeProperty); } set { SetValue(PointSizeProperty, value); } } public static readonly DependencyProperty PointSizeProperty = DependencyProperty.Register("PointSize", typeof(double), typeof(PULineChart), new PropertyMetadata(8.0)); /// /// 获取或设置X轴的值数组。 /// public ObservableCollection XAxis { get { return (ObservableCollection)GetValue(XAxisProperty); } set { SetValue(XAxisProperty, value); } } public static readonly DependencyProperty XAxisProperty = DependencyProperty.Register("XAxis", typeof(ObservableCollection), typeof(PULineChart), new PropertyMetadata(OnXAxisChanged)); private static void OnXAxisChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var chart = d as PULineChart; if (chart.XAxis != null) { chart.XAxis.CollectionChanged -= chart.XAxisChanged; chart.XAxis.CollectionChanged += chart.XAxisChanged; chart.XAxisChanged(null, null); } } private void XAxisChanged(object sender, NotifyCollectionChangedEventArgs e) { LoadXAxis(ActualWidth); DrawGrid(ActualWidth, ActualHeight); } /// /// 获取或设置Y轴的值数组。 /// public ObservableCollection YAxis { get { return (ObservableCollection)GetValue(YAxisProperty); } set { SetValue(YAxisProperty, value); } } public static readonly DependencyProperty YAxisProperty = DependencyProperty.Register("YAxis", typeof(ObservableCollection), typeof(PULineChart), new PropertyMetadata(OnYAxisChanged)); private static void OnYAxisChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var chart = d as PULineChart; if (chart.YAxis != null) { chart.YAxis.CollectionChanged -= chart.YAxisChanged; chart.YAxis.CollectionChanged += chart.YAxisChanged; chart.YAxisChanged(null, null); } } private void YAxisChanged(object sender, NotifyCollectionChangedEventArgs e) { LoadYAxis(ActualHeight); DrawGrid(ActualWidth, ActualHeight); } /// /// 获取或设置点集合。 /// public ObservableCollection Points { get { return (ObservableCollection)GetValue(PointsProperty); } set { SetValue(PointsProperty, value); } } public static readonly DependencyProperty PointsProperty = DependencyProperty.Register("Points", typeof(ObservableCollection), typeof(PULineChart), new PropertyMetadata(OnPointsChanged)); private static void OnPointsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var chart = d as PULineChart; if (chart.Points != null) { chart.Points.CollectionChanged -= chart.PointsChanged; chart.Points.CollectionChanged += chart.PointsChanged; chart.PointsChanged(null, null); } } private void PointsChanged(object sender, NotifyCollectionChangedEventArgs e) { if (IsLoaded) { InitLine(ActualWidth, ActualHeight, AnimationMode == AnimationModes.Always); } } #endregion #region Funtion /// /// 重新绘制X、Y轴。 /// private void Draw() { var actualWidth = this.ActualWidth; var actualHeight = this.ActualHeight; if (Points == null) return; LoadXAxis(actualWidth); LoadYAxis(actualHeight); DrawGrid(actualWidth, actualHeight); InitLine(actualWidth, actualHeight, AnimationMode != AnimationModes.None); } private void LoadYAxis(double actualHeight) { if (YAxis == null) return; var yAxis = YAxis.Reverse().ToArray(); var xHeight = (actualHeight - _xHeight) / (yAxis.Length - 0.5); if (canvasYAxis.Children.Count > yAxis.Length) { var count = canvasYAxis.Children.Count; for (int i = 0; i < count - yAxis.Length; i++) { canvasYAxis.Children.RemoveAt(canvasYAxis.Children.Count - 1); } } for (int i = 0; i < canvasYAxis.Children.Count; i++) { var txt = canvasYAxis.Children[i] as TextBlock; txt.Text = yAxis[i]; Canvas.SetTop(txt, xHeight * (i + 0.5) - GetTexHeight(txt) / 2); } for (int i = canvasYAxis.Children.Count; i < yAxis.Length; i++) { var txt = new TextBlock() { Text = yAxis[i], }; var fore = new Binding() { Source = this, Path = new PropertyPath("Foreground"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(txt, TextBlock.ForegroundProperty, fore); Canvas.SetRight(txt, 10); Canvas.SetTop(txt, xHeight * (i + 0.5) - GetTexHeight(txt) / 2); canvasYAxis.Children.Add(txt); } } private void LoadXAxis(double actualWidth) { if (XAxis == null) return; var yWidth = (actualWidth - _yWidth) / (XAxis.Count - 0.5); if (canvasXAxis.Children.Count > XAxis.Count) { var count = canvasXAxis.Children.Count; for (int i = 0; i < count - XAxis.Count; i++) { canvasXAxis.Children.RemoveAt(canvasXAxis.Children.Count - 1); } } for (int i = 0; i < canvasXAxis.Children.Count; i++) { var txt = canvasXAxis.Children[i] as TextBlock; txt.Text = XAxisGap == 0 ? XAxis[i] : (i % (XAxisGap + 1) != 0 ? "" : XAxis[i]); Canvas.SetLeft(txt, yWidth * i + _yWidth - (GetTextWidth(txt) / 2)); } for (int i = canvasXAxis.Children.Count; i < XAxis.Count; i++) { var txt = new TextBlock() { Text = XAxis[i], }; var fore = new Binding() { Source = this, Path = new PropertyPath("Foreground"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(txt, TextBlock.ForegroundProperty, fore); Canvas.SetTop(txt, 5); Canvas.SetLeft(txt, yWidth * i + _yWidth - (GetTextWidth(txt) / 2)); canvasXAxis.Children.Add(txt); } } private double GetTextWidth(TextBlock textBlock) { var formattedText = new FormattedText( textBlock.Text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(textBlock.FontFamily, textBlock.FontStyle, textBlock.FontWeight, textBlock.FontStretch), textBlock.FontSize, Brushes.Black, new NumberSubstitution(), TextFormattingMode.Display); return formattedText.Width; } private double GetTexHeight(TextBlock textBlock) { var formattedText = new FormattedText( textBlock.Text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(textBlock.FontFamily, textBlock.FontStyle, textBlock.FontWeight, textBlock.FontStretch), textBlock.FontSize, Brushes.Black, new NumberSubstitution(), TextFormattingMode.Display); return formattedText.Height; } private void DrawGrid(double actualWidth, double actualHeight) { if (YAxis == null || XAxis == null) return; var cvaHeight = actualHeight - _xHeight; var cvaWidth = actualWidth - _yWidth; var xHeight = cvaHeight / (YAxis.Count - 0.5); var yWidth = cvaWidth / (XAxis.Count - 0.5); var path = ""; for (int i = 0; i < XAxis.Count; i++) { path += "M " + i * yWidth + ",0 V" + cvaHeight; } for (int i = 1; i <= YAxis.Count; i++) { path += "M 0," + (i - 0.5) * xHeight + " H" + cvaWidth; } pathGrid.Data = Geometry.Parse(path); } private void InitLine(double actualWidth, double actualHeight, bool usingAnima) { if (XAxis == null || YAxis == null || Points == null) return; ScaleTransform scale; if (usingAnima) scale = new ScaleTransform() { ScaleY = 0 }; else scale = new ScaleTransform() { ScaleY = 1 }; polygon.RenderTransform = scale; polyline.RenderTransform = scale; var cvaHeight = actualHeight - _xHeight; var cvaWidth = actualWidth - _yWidth; var xHeight = cvaHeight / (YAxis.Count - 0.5); var yWidth = cvaWidth / (XAxis.Count - 0.5); var realHeight = cvaHeight - xHeight * 0.5; polyline.Points.Clear(); polygon.Points.Clear(); canvasPoints.Children.Clear(); var count = XAxis.Count > Points.Count ? Points.Count : XAxis.Count; for (int i = 0; i < count; i++) { var point = new Point(yWidth * i, (1 - Points[i].Value) * realHeight + 0.5 * xHeight); polyline.Points.Add(point); polygon.Points.Add(point); var ell = new Ellipse(); var toolTip = new PUChartToolTip() { Header = XAxis[i], Value = Points[i].ValueTip }; var cover = new Binding() { Source = this, Path = new PropertyPath("LineBrush"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(toolTip, PUChartToolTip.CoverBrushProperty, cover); ell.ToolTip = toolTip; var back = new Binding() { Source = this, Path = new PropertyPath("LineBrush"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(ell, Ellipse.FillProperty, back); var size = new Binding() { Source = this, Path = new PropertyPath("PointSize"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(ell, Ellipse.WidthProperty, size); BindingOperations.SetBinding(ell, Ellipse.HeightProperty, size); Canvas.SetLeft(ell, yWidth * i - PointSize / 2); if (usingAnima) { Canvas.SetTop(ell, cvaHeight - PointSize / 2); ell.BeginAnimation(Canvas.TopProperty, GetDoubleAnimation((1 - Points[i].Value) * realHeight + 0.5 * xHeight - PointSize / 2, 1)); } else { Canvas.SetTop(ell, (1 - Points[i].Value) * realHeight + 0.5 * xHeight - PointSize / 2); } canvasPoints.Children.Add(ell); } polygon.Points.Add(new Point(yWidth * (Points.Count - 1), cvaHeight)); polygon.Points.Add(new Point(0, cvaHeight)); if (usingAnima) { scale.BeginAnimation(ScaleTransform.ScaleYProperty, GetDoubleAnimation(1, 1)); } } private DoubleAnimation GetDoubleAnimation(double to, double duration = 0.2) { return new DoubleAnimation() { To = to, Duration = TimeSpan.FromSeconds(duration), EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseInOut }, }; } #endregion #region Sys private void chart_SizeChanged(object sender, SizeChangedEventArgs e) { if (ActualWidth <= 0) throw new Exception("折线图控件的实际宽度必须大于0。"); canvasYAxis.Height = this.ActualHeight; canvasYAxis.Width = _yWidth; canvasXAxis.Width = this.ActualWidth; canvasXAxis.Height = _xHeight; canvasContainer.Width = this.ActualWidth - _yWidth; canvasContainer.Height = this.ActualHeight - _xHeight; Canvas.SetLeft(canvasContainer, _yWidth); canvasPoints.Width = this.ActualWidth - _yWidth; canvasPoints.Height = this.ActualHeight - _xHeight; polygon.Width = this.ActualWidth - _yWidth; polygon.Height = this.ActualHeight - _xHeight; polyline.Width = this.ActualWidth - _yWidth; polyline.Height = this.ActualHeight - _xHeight; if (IsLoaded) Draw(); } #endregion } } ================================================ FILE: Panuon.UI.Charts/Others/Enums.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/30 10:02:45 *说明: *日志:2018/11/30 10:02:45 创建。 *==============================================================*/ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UI.Charts { public enum AnimationModes { /// /// 从不使用动画。 /// None, /// /// 仅在首次加载时使用动画。 /// OneTime, /// /// 始终使用动画。 /// Always, } } ================================================ FILE: Panuon.UI.Charts/Panuon.UI.Charts.csproj ================================================  Debug AnyCPU {39898E4A-724F-4711-BA20-CEFB3DC379F0} Library Properties Panuon.UI.Charts Panuon.UI.Charts v4.0 512 true full false bin\Debug\ DEBUG;TRACE prompt 4 pdbonly true bin\Release\ TRACE prompt 4 PUChartToolTip.xaml PULineChart.xaml Designer MSBuild:Compile Designer MSBuild:Compile ================================================ FILE: Panuon.UI.Charts/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Panuon.UI.Charts")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Panuon.UI.Charts")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //将 ComVisible 设置为 false 将使此程序集中的类型 //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("39898e4a-724f-4711-ba20-cefb3dc379f0")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] ================================================ FILE: Panuon.UI.sln ================================================  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Panuon.UI", "Panuon.UI\Panuon.UI.csproj", "{72B3698E-1784-4101-99AE-FC7B8F48E96D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Panuon.UI.Charts", "Panuon.UI.Charts\Panuon.UI.Charts.csproj", "{39898E4A-724F-4711-BA20-CEFB3DC379F0}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Panuon.UIBrowser", "Panuon.UIBrowser\Panuon.UIBrowser.csproj", "{3D0CEF7D-5E24-45FA-BFBD-95EEECFE88C2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {72B3698E-1784-4101-99AE-FC7B8F48E96D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {72B3698E-1784-4101-99AE-FC7B8F48E96D}.Debug|Any CPU.Build.0 = Debug|Any CPU {72B3698E-1784-4101-99AE-FC7B8F48E96D}.Release|Any CPU.ActiveCfg = Release|Any CPU {72B3698E-1784-4101-99AE-FC7B8F48E96D}.Release|Any CPU.Build.0 = Release|Any CPU {39898E4A-724F-4711-BA20-CEFB3DC379F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {39898E4A-724F-4711-BA20-CEFB3DC379F0}.Debug|Any CPU.Build.0 = Debug|Any CPU {39898E4A-724F-4711-BA20-CEFB3DC379F0}.Release|Any CPU.ActiveCfg = Release|Any CPU {39898E4A-724F-4711-BA20-CEFB3DC379F0}.Release|Any CPU.Build.0 = Release|Any CPU {3D0CEF7D-5E24-45FA-BFBD-95EEECFE88C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D0CEF7D-5E24-45FA-BFBD-95EEECFE88C2}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D0CEF7D-5E24-45FA-BFBD-95EEECFE88C2}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D0CEF7D-5E24-45FA-BFBD-95EEECFE88C2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {854992E3-C079-4F01-A327-5CC0229995E1} EndGlobalSection EndGlobal ================================================ FILE: Panuon.UIBrowser/App.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/App.xaml.cs ================================================ using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Windows; namespace Panuon.UIBrowser { /// /// App.xaml 的交互逻辑 /// public partial class App : Application { } } ================================================ FILE: Panuon.UIBrowser/AppBootstrapper.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; using System.ComponentModel.Composition.Primitives; using System.Linq; using System.Windows; using System.Windows.Threading; using Caliburn.Micro; using Panuon.UI; namespace Panuon.UIBrowser { public class AppBootstrapper : BootstrapperBase { private CompositionContainer container; public AppBootstrapper() { Initialize(); } protected override void Configure() { container = new CompositionContainer(new AggregateCatalog( AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType())); var batch = new CompositionBatch(); batch.AddExportedValue(new WindowManager()); batch.AddExportedValue(new EventAggregator()); batch.AddExportedValue(container); container.Compose(batch); } protected override void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { base.OnUnhandledException(sender, e); PUMessageBox.ShowDialog("异常:" + e.Exception.Message); e.Handled = true; } protected override object GetInstance(Type serviceType, string key) { string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key; var exports = container.GetExportedValues(contract); if (exports.Any()) return exports.First(); throw new Exception($"找不到实例 {contract}。"); } protected override IEnumerable GetAllInstances(Type serviceType) { return container.GetExportedValues(AttributedModelServices.GetContractName(serviceType)); } protected override void BuildUp(object instance) { container.SatisfyImportsOnce(instance); } protected override void OnStartup(object sender, StartupEventArgs e) { DisplayRootViewFor(); } } } ================================================ FILE: Panuon.UIBrowser/IShell.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser { public interface IShell { } } ================================================ FILE: Panuon.UIBrowser/Models/DataSourceModel.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/15 13:16:48 *说明: 用于显示属性描述。 *日志:2018/11/15 13:16:48 创建。 *==============================================================*/ using System.ComponentModel; namespace Panuon.UIBrowser.Models { public class DataSourceModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public void NotifyOfPropertyChange(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } /// /// 名称。 /// public string Name { get { return _name; } set { _name = value; NotifyOfPropertyChange("Name"); } } private string _name; /// /// 属性类型。 /// public string Type { get { return _type; } set { _type = value; NotifyOfPropertyChange("Type"); } } private string _type; /// /// 描述。 /// public string Description { get { return _description; } set { _description = value; NotifyOfPropertyChange("Description"); } } private string _description; /// /// 默认值。 /// public string DefaultValue { get { return _defaultValue; } set { _defaultValue = value; NotifyOfPropertyChange("DefaultValue"); } } private string _defaultValue; } } ================================================ FILE: Panuon.UIBrowser/Panuon.UIBrowser.csproj ================================================  Debug AnyCPU {3D0CEF7D-5E24-45FA-BFBD-95EEECFE88C2} WinExe Properties Panuon.UIBrowser Panuon.UIBrowser v4.5 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 AnyCPU true full false bin\Debug\ DEBUG;TRACE prompt 4 false AnyCPU pdbonly true bin\Release\ TRACE prompt 4 false ..\packages\Caliburn.Micro.Core.3.2.0\lib\net40\Caliburn.Micro.dll True ..\packages\Caliburn.Micro.3.2.0\lib\net40\Caliburn.Micro.Platform.dll True ..\packages\Caliburn.Micro.3.2.0\lib\net40\System.Windows.Interactivity.dll True 4.0 MSBuild:Compile Designer App.xaml Code ChatWindow.xaml LoginWindow.xaml MultiNavWindow.xaml Code True True Resources.resx True Settings.settings True ResXFileCodeGenerator Resources.Designer.cs SettingsSingleFileGenerator Settings.Designer.cs MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile MSBuild:Compile Designer Designer MSBuild:Compile Designer MSBuild:Compile MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer MSBuild:Compile Designer {39898e4a-724f-4711-ba20-cefb3dc379f0} Panuon.UI.Charts {72b3698e-1784-4101-99ae-fc7b8f48e96d} Panuon.UI PreserveNewest ================================================ FILE: Panuon.UIBrowser/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Panuon.UIBrowser")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Panuon.UIBrowser")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //将 ComVisible 设置为 false 将使此程序集中的类型 //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] //若要开始生成可本地化的应用程序,请 // 中的 .csproj 文件中 //例如,如果您在源文件中使用的是美国英语, //使用的是美国英语,请将 设置为 en-US。 然后取消 //对以下 NeutralResourceLanguage 特性的注释。 更新 //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //主题特定资源词典所处位置 //(当资源未在页面 //或应用程序资源字典中找到时使用) ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 //(当资源未在页面 //、应用程序或任何主题专用资源字典中找到时使用) )] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] ================================================ FILE: Panuon.UIBrowser/Properties/Resources.Designer.cs ================================================ //------------------------------------------------------------------------------ // // 此代码由工具生成。 // 运行时版本:4.0.30319.42000 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ namespace Panuon.UIBrowser.Properties { using System; /// /// 一个强类型的资源类,用于查找本地化的字符串等。 /// // 此类是由 StronglyTypedResourceBuilder // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // (以 /str 作为命令选项),或重新生成 VS 项目。 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// 返回此类使用的缓存的 ResourceManager 实例。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Panuon.UIBrowser.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// 使用此强类型资源类,为所有资源查找 /// 重写当前线程的 CurrentUICulture 属性。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } ================================================ FILE: Panuon.UIBrowser/Properties/Resources.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: Panuon.UIBrowser/Properties/Settings.Designer.cs ================================================ //------------------------------------------------------------------------------ // // 此代码由工具生成。 // 运行时版本:4.0.30319.42000 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ namespace Panuon.UIBrowser.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } ================================================ FILE: Panuon.UIBrowser/Properties/Settings.settings ================================================  ================================================ FILE: Panuon.UIBrowser/ViewModels/Chart/LineChartViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI.Charts; using Panuon.UIBrowser.Models; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows.Controls; using System.Windows.Input; namespace Panuon.UIBrowser.ViewModels.Chart { public class LineChartViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public LineChartViewModel(IWindowManager windowManager) { _windowManager = windowManager; AnimationMode = AnimationModes.OneTime; XAxisGap = 0; Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public ObservableCollection APIList { get { return _apiList; } set { _apiList = value; NotifyOfPropertyChange(() => APIList); } } private ObservableCollection _apiList; /// /// X轴坐标 /// public ObservableCollection XAxis { get { return _xAxis; } set { _xAxis = value; NotifyOfPropertyChange(() => XAxis); } } private ObservableCollection _xAxis; /// /// Y轴坐标 /// public ObservableCollection YAxis { get { return _yAxis; } set { _yAxis = value; NotifyOfPropertyChange(() => YAxis); } } private ObservableCollection _yAxis; /// /// 点集合 /// public ObservableCollection Points { get { return _points; } set { _points = value; NotifyOfPropertyChange(() => Points); } } private ObservableCollection _points; public int XAxisGap { get { return _xAxisGap; } set { _xAxisGap = value; NotifyOfPropertyChange(() => XAxisGap); } } private int _xAxisGap; public double PointSize { get { return _pointSize; } set { _pointSize = value; NotifyOfPropertyChange(() => PointSize); } } private double _pointSize; public AnimationModes AnimationMode { get { return _animationMode; } set { _animationMode = value; NotifyOfPropertyChange(() => AnimationMode); } } private AnimationModes _animationMode; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// /// /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void AddItem() { } #endregion #region Function public async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "" ,Type = "" ,Description = "",DefaultValue = "" }, }; APIList = new ObservableCollection() { new DataSourceModel() { Name = "" ,Description = "" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "" ,Description = "" }, }; Points = new ObservableCollection() { new PUChartPoint() { Value = 0.3, ValueTip = "3" }, new PUChartPoint() { Value = 0.2, ValueTip = "2" }, new PUChartPoint() { Value = 0.3, ValueTip = "3" }, new PUChartPoint() { Value = 0.1, ValueTip = "1" }, new PUChartPoint() { Value = 0.5, ValueTip = "5" } }; XAxis = new ObservableCollection() { "1","2","3","4","5" }; YAxis = new ObservableCollection() { "0","1","2","3","4","5","6","7","8","9","10" }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/ButtonViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class ButtonViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public ButtonViewModel(IWindowManager windowManager) { _windowManager = windowManager; ButtonStyle = ButtonStyles.General; ClickStyle = ClickStyles.Classic; RadiusInteger = 20; Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#DDDDDD")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22FFFFFF")); Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public ButtonStyles ButtonStyle { get { return _buttonStyle; } set { _buttonStyle = value; NotifyOfPropertyChange(() => ButtonStyle); } } private ButtonStyles _buttonStyle; public ClickStyles ClickStyle { get { return _clickStyle; } set { _clickStyle = value; NotifyOfPropertyChange(() => ClickStyle); } } private ClickStyles _clickStyle; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; BorderCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public CornerRadius BorderCornerRadius { get { return _borderCornerRadius; } set { _borderCornerRadius = value; NotifyOfPropertyChange(() => BorderCornerRadius); } } private CornerRadius _borderCornerRadius; public Brush Background { get { return _background; } set { _background = value; NotifyOfPropertyChange(() => Background); } } private Brush _background; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void StyleChanged(string content) { ButtonStyle = (ButtonStyles)Enum.Parse(typeof(ButtonStyles), content); } public void ClickStyleChanged(string content) { ClickStyle = (ClickStyles)Enum.Parse(typeof(ClickStyles), content); } public void BackgroundChanged(string content) { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } #endregion #region Function private async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "ButtonStyle" ,Type = "ButtonStyles枚举类型" ,Description = "获取或设置按钮的基本样式。【可选值:General、Hollow、Outline、Link】",DefaultValue = "General" }, new DataSourceModel() { Name = "ClickStyle" ,Type = "ClickStyles枚举类型" ,Description = "获取或设置鼠标点击时按钮的效果。【可选值:Classic(无特殊效果)、Sink(点击时按钮下沉2个px)】",DefaultValue = "Classic" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置按钮的圆角大小。】",DefaultValue = "0" }, new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置鼠标悬浮时遮罩层的背景颜色(在Outline和Link样式下为前景色),默认值为#26FFFFFF(在Hollow、Outline和Link样式下为灰黑色)。】",DefaultValue = "#26FFFFFF / #3E3E3E" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "General样式" ,Description = "标准按钮,悬浮/点击时背景色*叠加*一层CoverBrush。" }, new DataSourceModel() { Name = "Hollow样式" ,Description = "带边框的无背景色按钮,悬浮时背景色变为CoverBrush,前景色变为白色;点击时背景色叠加0.1透明度的白色。" }, new DataSourceModel() { Name = "Outline样式" ,Description = "带边框的无背景色按钮,悬浮时前景色和边框*叠加*一层CoverBrush;点击时背景色叠加0.1透明度的CoverBrush。" }, new DataSourceModel() { Name = "Link样式" ,Description = "无边框无背景色的按钮,悬浮时前景色变为CoverBrush;点击时前景色叠加0.2透明度的白色。" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/CheckBoxViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class CheckBoxViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public CheckBoxViewModel(IWindowManager windowManager) { _windowManager = windowManager; CheckBoxStyle = CheckBoxStyles.General; RadiusInteger = 0; InnerHeight = 20; InnerWidth = 20; BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public CheckBoxStyles CheckBoxStyle { get { return _checkBoxStyle; } set { _checkBoxStyle = value; NotifyOfPropertyChange(() => CheckBoxStyle); } } private CheckBoxStyles _checkBoxStyle; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; BorderCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public double InnerWidth { get { return _innerWidth; } set { _innerWidth = value; NotifyOfPropertyChange(() => InnerWidth); } } private double _innerWidth; public double InnerHeight { get { return _innerHeight; } set { _innerHeight = value; NotifyOfPropertyChange(() => InnerHeight); } } private double _innerHeight; public CornerRadius BorderCornerRadius { get { return _borderCornerRadius; } set { _borderCornerRadius = value; NotifyOfPropertyChange(() => BorderCornerRadius); } } private CornerRadius _borderCornerRadius; public Brush BorderBrush { get { return _borderBrush; } set { _borderBrush = value; NotifyOfPropertyChange(() => BorderBrush); } } private Brush _borderBrush; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void StyleChanged(string content) { CheckBoxStyle = (CheckBoxStyles)Enum.Parse(typeof(CheckBoxStyles), content); if(CheckBoxStyle == CheckBoxStyles.Switch) { if (InnerHeight == InnerWidth) InnerWidth = InnerHeight * 1.5; } } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void BorderBrushChanged(string content) { BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } #endregion #region Function private async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "CheckBoxStyle" ,Type = "Brush" ,Description = "获取或设置选择框的基本样式。【可选项:General、Classic、Switch、Branch、Button】",DefaultValue = "General" }, new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置鼠标悬浮时子项的背景颜色。",DefaultValue = "#EEEEEE" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置选择框的圆角大小。",DefaultValue = "0" }, new DataSourceModel() { Name = "InnerWidth" ,Type = "Double" ,Description = "获取或设置选择框的宽度。",DefaultValue = "20 / 30 (Switch)" }, new DataSourceModel() { Name = "InnerHeight" ,Type = "Double" ,Description = "获取或设置选择框的高度。",DefaultValue = "20" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "General样式" ,Description = "一个勾号为CoverBrush、内框没有背景色的选择框。" }, new DataSourceModel() { Name = "Classic样式" ,Description = "一个勾号为白色,选中时内框背景色为CoverBrush的选择框。" }, new DataSourceModel() { Name = "Switch样式" ,Description = "一个开关样式的,选中时内框背景色为CoverBrush的选择框。BorderCornerRadius属性不会对它造成影响。" }, new DataSourceModel() { Name = "Branch样式" ,Description = "一个只有单边框的,初始背景色为BorderBrush,选中时背景色为CoverBrush的选择框(如要调整单边框的边长或位置,可以调整BorderThickness,默认值为5,0,0,0)。" }, new DataSourceModel() { Name = "Button样式" ,Description = "一个按钮样式的,选中时背景色为CoverBrush,前景色变为白色的选择框。" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/ComboBoxViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class ComboBoxViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public ComboBoxViewModel(IWindowManager windowManager) { _windowManager = windowManager; SelectedValue = 1; RadiusInteger = 3; SelectedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#DDDDDD")); BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D3D3D3")); Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#696969")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#EEEEEE")); ShadowColor = (Color)ColorConverter.ConvertFromString("#888888"); SearchMode = SearchModes.None; DeleteMode = DeleteModes.Delete; Init(); } #endregion #region Bindings public BindableCollection ComboBoxItems { get { return _comboBoxItems; } set { _comboBoxItems = value; NotifyOfPropertyChange(() => ComboBoxItems); } } private BindableCollection _comboBoxItems; public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection DependencyPropertyList2 { get { return _dependencyPropertyList2; } set { _dependencyPropertyList2 = value; NotifyOfPropertyChange(() => DependencyPropertyList2); } } private ObservableCollection _dependencyPropertyList2; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; BorderCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public bool EditableIsChecked { get { return _editableIsChecked; } set { _editableIsChecked = value; NotifyOfPropertyChange(() => EditableIsChecked); } } private bool _editableIsChecked; public bool CanDeleteIsChecked { get { return _canDeleteIsChecked; } set { _canDeleteIsChecked = value; ComboBoxItems.Apply(x => x.CanDelete = value); NotifyOfPropertyChange(() => CanDeleteIsChecked); } } private bool _canDeleteIsChecked; public CornerRadius BorderCornerRadius { get { return _borderCornerRadius; } set { _borderCornerRadius = value; NotifyOfPropertyChange(() => BorderCornerRadius); } } private CornerRadius _borderCornerRadius; public Brush BorderBrush { get { return _borderBrush; } set { _borderBrush = value; NotifyOfPropertyChange(() => BorderBrush); } } private Brush _borderBrush; public Brush SelectedBrush { get { return _selectedBrush; } set { _selectedBrush = value; NotifyOfPropertyChange(() => SelectedBrush); } } private Brush _selectedBrush; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public Color ShadowColor { get { return _shadowColor; } set { _shadowColor = value; NotifyOfPropertyChange(() => ShadowColor); } } private Color _shadowColor; public SearchModes SearchMode { get { return _searchMode; } set { _searchMode = value; NotifyOfPropertyChange(() => SearchMode); } } private SearchModes _searchMode; public DeleteModes DeleteMode { get { return _deleteMode; } set { _deleteMode = value; NotifyOfPropertyChange(() => DeleteMode); } } private DeleteModes _deleteMode; public int SelectedValue { get { return _selectedValue; } set { _selectedValue = value; NotifyOfPropertyChange(() => SelectedValue); } } private int _selectedValue; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void AddItem() { ComboBoxItems.Add(new PUComboBoxItemModel() { CanDelete = CanDeleteIsChecked, Header = "Item" + (ComboBoxItems.Count + 1), Value = (ComboBoxItems.Count + 1), }); } public void RemoveItem() { if (ComboBoxItems.Count > 0) ComboBoxItems.RemoveAt(ComboBoxItems.Count - 1); } public void SelectedBrushChanged(string content) { SelectedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ShadowColorChanged(string content) { ShadowColor = (Color)ColorConverter.ConvertFromString(content); } public void BorderBrushChanged(string content) { BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void SearchModeChanged(string content) { SearchMode = (SearchModes)Enum.Parse(typeof(SearchModes), content); } public void DeleteModeChanged(string content) { DeleteMode = (DeleteModes)Enum.Parse(typeof(DeleteModes), content); } public void DeleteItem(RoutedPropertyChangedEventArgs e) { if (DeleteMode == DeleteModes.Delete) return; var comboBoxItem = e.NewValue; //移除绑定值的Model即可,切记不能直接操作ComboBox的Items属性,否则会出现混乱 var model = ComboBoxItems.FirstOrDefault(x => x.Uid == comboBoxItem.Uid); if (model != null && PUMessageBox.ShowConfirm("确认要删除该选项吗?") == true) { ComboBoxItems.Remove(model); } } #endregion #region Function private async void Init() { await Task.Delay(100); ComboBoxItems = new BindableCollection() { new PUComboBoxItemModel() { Header = "Item1", Value =1 }, new PUComboBoxItemModel() { Header = "Item2", Value =2 }, }; DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置鼠标悬浮时子项的背景颜色。",DefaultValue = "#EEEEEE" }, new DataSourceModel() { Name = "SelectedBrush" ,Type = "Brush" ,Description = "获取或设置子项被选中时的背景颜色。",DefaultValue = "#DDDDDD" }, new DataSourceModel() { Name = "ShadowColor" ,Type = "Color" ,Description = "获取或设置下拉框激活时阴影的颜色。",DefaultValue = "#888888" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置显示框和下拉框的圆角大小。",DefaultValue = "0" }, new DataSourceModel() { Name = "DeleteMode" ,Type = "DeleteModes枚举" ,Description = "获取或设置当子项目可删除时,用户点击删除按钮后的操作。【可选项:Delete、EventOnly】",DefaultValue = "Delete" }, new DataSourceModel() { Name = "BindingItems" ,Type = "IObservableCollection" ,Description = "若使用MVVM绑定,请使用此依赖属性。",DefaultValue = "NULL" }, new DataSourceModel() { Name = "SearchMode" ,Type = "SearchModes枚举" ,Description = "获取或设置搜索模式。【可选项:None、TextChanged、Enter】",DefaultValue = "None" }, new DataSourceModel() { Name = "SelectedValuePath" ,Type = "SelectedValuePaths枚举" ,Description = "获取或设置当子项目被选中时,SelectedValue应呈现子项目的哪一个值。【可选项:Header、Value】",DefaultValue = "None" }, }; DependencyPropertyList2 = new ObservableCollection() { new DataSourceModel() { Name = "CanDelete" ,Type = "Boolean" ,Description = "获取或设置是否显示删除按钮。",DefaultValue = "False" }, new DataSourceModel() { Name = "Value" ,Type = "Object" ,Description = "获取或设置用以标记该项目的值(类似于Tag属性)。",DefaultValue = "#DDDDDD" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "控件可能会在设计器中突然变透明" ,Description = "目前尚未发现是何种原因导致设计器渲染时出现了问题,但控件依旧能如期运行。" }, new DataSourceModel() { Name = "已禁用ItemsSource属性" ,Description = "ItemsSource属性不能自动生成PUComboBoxItem,因此隐藏了Set方法(为了防止误用)。若要使用MVVM绑定,请使用BindingItems属性。该属性已实现双向绑定,当BindingItems属性发生改变时,ComboBox的Items将同步发生变化;反之亦然。请根据需要来选择是否设置Mode=TwoWay。\n此外,PUComboBoxItemModel在初始化时会为其Uid属性(只读的)生成一个值;BindingItem在生成子控件时,会将该Model中的Uid值赋给它所对应子控件的Uid属性。这意味着你可以通过该Model的Uid属性来查找真实的控件。" }, new DataSourceModel() { Name = "如果你想在删除前进行验证" ,Description = "DeleteMode提供了两种方式来处理删除事件。Delete选项表示当用户点击删除按钮时,应当立即删除项目并触发DeleteItem路由事件;而EventOnly选项则只会触发DeleteItem路由事件,不会删除项目。你可以监听该事件的发生,并判断是否应该删除该项目。" }, new DataSourceModel() { Name = "关于SelectedValuePath" ,Description = "PanuonUI中的大多数组合型容器控件都重写了此属性。重写后的SelectedValuePath只有两个选项:Header和Value。Header选项表示SelectedValue属性应当呈现被选择项的Content属性,而Value选项则表示SelectedValue属性应呈现被选择项的Value属性。" }, new DataSourceModel() { Name = "关于SelectedValue" ,Description = "当选中项发生改变时,该属性的值会依据SelectedValuePath的设定发生变化。同时,你可以通过对该属性赋值来搜索并选中项目(至于是通过子项的Content还是Value进行搜索,这同样取决于SelectedValuePath的值)。请注意,搜索时使用的是Equal方法,这意味着1和“1”是完全不同的(错误赋值可能会导致搜索不到子项)。" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/ContextMenuViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class ContextMenuViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public ContextMenuViewModel(IWindowManager windowManager) { _windowManager = windowManager; TextBoxStyle = TextBoxStyles.General; RadiusInteger = 3; Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#33AAAAAA")); Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D3D3D3")); ShadowColor = (Color)ColorConverter.ConvertFromString("#22888888"); Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public TextBoxStyles TextBoxStyle { get { return _textboxStyle; } set { _textboxStyle = value; NotifyOfPropertyChange(() => TextBoxStyle); } } private TextBoxStyles _textboxStyle; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; BorderCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public bool ClearButtonIsChecked { get { return _clearButtonIsChecked; } set { _clearButtonIsChecked = value; NotifyOfPropertyChange(() => ClearButtonIsChecked); } } private bool _clearButtonIsChecked; public CornerRadius BorderCornerRadius { get { return _borderCornerRadius; } set { _borderCornerRadius = value; NotifyOfPropertyChange(() => BorderCornerRadius); } } private CornerRadius _borderCornerRadius; public Brush Background { get { return _background; } set { _background = value; NotifyOfPropertyChange(() => Background); } } private Brush _background; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public Brush BorderBrush { get { return _borderBrush; } set { _borderBrush = value; NotifyOfPropertyChange(() => BorderBrush); } } private Brush _borderBrush; public Color ShadowColor { get { return _shadowColor; } set { _shadowColor = value; NotifyOfPropertyChange(() => ShadowColor); } } private Color _shadowColor; #endregion #region Event public void TextBoxStyleChanged(string content) { TextBoxStyle = (TextBoxStyles)Enum.Parse(typeof(TextBoxStyles), content); } public void BackgroundChanged(string content) { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ShadowColorChanged(string content) { ShadowColor = (Color)ColorConverter.ConvertFromString(content); } public void BorderBrushChanged(string content) { BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } #endregion #region Function public async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "TextBoxStyle" ,Type = "TextBoxStyles枚举" ,Description = "获取或设置文本框的基本样式。【可选值:General、IconGroup】",DefaultValue = "General" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置文本框的圆角大小。",DefaultValue = "0" }, new DataSourceModel() { Name = "ShadowColor" ,Type = "Color" ,Description = "获取或设置输入框获得焦点时阴影的颜色。",DefaultValue = "#66888888" }, new DataSourceModel() { Name = "Watermark" ,Type = "String" ,Description = "获取或设置水印内容。",DefaultValue = "Null" }, new DataSourceModel() { Name = "Icon" ,Type = "Object" ,Description = "获取或设置输入框获得焦点时阴影的颜色,仅在IconGroup样式下生效。",DefaultValue = "#66888888" }, new DataSourceModel() { Name = "IconWidth" ,Type = "Color" ,Description = "获取或设置图标的宽度。",DefaultValue = "30" }, new DataSourceModel() { Name = "IsClearButtonShow" ,Type = "Boolean" ,Description = "获取或设置当鼠标悬浮时是否显示清除按钮。",DefaultValue = "False" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "关于ShadowColor" ,Description = "当文本框获得焦点时,文本框会获得一个0.4透明度、5px大小的阴影。DropShadow效果的Color不支持8位HEX(仅支持6位HEX),因而透明度被限制在0.4。" }, }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/DatePickerViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class DatePickerViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public DatePickerViewModel(IWindowManager windowManager) { _windowManager = windowManager; Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#696969")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); DatePickerMode = DatePickerModes.DateOnly; Init(); SelectedDateTime = DateTime.Now.Date; } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public DatePickerModes DatePickerMode { get { return _datePickerModes; } set { _datePickerModes = value; NotifyOfPropertyChange(() => DatePickerMode); } } private DatePickerModes _datePickerModes; public DateTime? MaxDateTime { get { return _maxDateTime; } set { _maxDateTime = value; NotifyOfPropertyChange(() => MaxDateTime); } } private DateTime? _maxDateTime; public DateTime? MinDateTime { get { return _minDateTime; } set { _minDateTime = value; NotifyOfPropertyChange(() => MinDateTime); } } private DateTime? _minDateTime; public DateTime SelectedDateTime { get { return _selectedDateTime; } set { _selectedDateTime = value; NotifyOfPropertyChange(() => SelectedDateTime); } } private DateTime _selectedDateTime; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void LimitMinDateTime(bool toLimit) { if (toLimit) { MinDateTime = DateTime.Now.AddMonths(-1); } else { MinDateTime = null; } } public void LimitMaxDateTime(bool toLimit) { if (toLimit) { MaxDateTime = DateTime.Now.AddMonths(1); } else { MaxDateTime = null; } } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void DatePickerModeChanged(string content) { DatePickerMode = (DatePickerModes)Enum.Parse(typeof(DatePickerModes), content); } #endregion #region Function private async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置主题颜色。",DefaultValue = "#3E3E3E" }, new DataSourceModel() { Name = "MaxDateTime" ,Type = "DateTime?" ,Description = "获取或设置可以选择的最大日期。该属性不能限制用户选择的时间。",DefaultValue = "Null" }, new DataSourceModel() { Name = "MinDateTime" ,Type = "DateTime?" ,Description = "获取或设置可以选择的最小日期。该属性不能限制用户选择的时间。",DefaultValue = "Null" }, new DataSourceModel() { Name = "SelectedDateTime" ,Type = "DateTime" ,Description = "获取或设置当前选中的日期和时间。",DefaultValue = "0" }, new DataSourceModel() { Name = "DatePickerMode" ,Type = "DatePickerModes枚举" ,Description = "获取或设置日期选择器的模式。【可选项:DateOnly、TimeOnly、DateTime】",DefaultValue = "DateTime" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "必须指定SelectedDateTime的初始值" ,Description = "否则会因无法计算而引发异常。" }, new DataSourceModel() { Name = "不能限制时间选择" ,Description = "MaxDateTime和MinDateTime属性只对日期有效,不能限制用户选择时间。" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/ListBoxViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class ListBoxViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; private PUListBox _listBox; #endregion #region Constructor public ListBoxViewModel(IWindowManager windowManager) { _windowManager = windowManager; SelectedValue = 1; SelectedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E6E6E6")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22E6E6E6")); SearchBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#44444444")); Init(); } #endregion #region Bindings public ObservableCollection ListBoxItems { get { return _listBoxItems; } set { _listBoxItems = value; NotifyOfPropertyChange(() => ListBoxItems); } } private ObservableCollection _listBoxItems; public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection DependencyPropertyList2 { get { return _dependencyPropertyList2; } set { _dependencyPropertyList2 = value; NotifyOfPropertyChange(() => DependencyPropertyList2); } } private ObservableCollection _dependencyPropertyList2; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public ObservableCollection APIList { get { return _apiList; } set { _apiList = value; NotifyOfPropertyChange(() => APIList); } } private ObservableCollection _apiList; public ObservableCollection EventList2 { get { return _eventList2; } set { _eventList2 = value; NotifyOfPropertyChange(() => EventList2); } } private ObservableCollection _eventList2; public Brush SelectedBrush { get { return _selectedBrush; } set { _selectedBrush = value; NotifyOfPropertyChange(() => SelectedBrush); } } private Brush _selectedBrush; public Brush SearchBrush { get { return _searchBrush; } set { _searchBrush = value; NotifyOfPropertyChange(() => SearchBrush); } } private Brush _searchBrush; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; public int SelectedValue { get { return _selectedValue; } set { _selectedValue = value; NotifyOfPropertyChange(() => SelectedValue); } } private int _selectedValue; public string SearchText { get { return _searchText; } set { _searchText = value; NotifyOfPropertyChange(() => SearchText); } } private string _searchText; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void ListBoxLoaded(object sender) { _listBox = sender as PUListBox; } public void Search() { if (_listBox == null) throw new Exception("未知异常:ListBox为Null。"); SearchText = SearchText ?? ""; _listBox.SearchItemByContent(SearchText, true); } public void AddItem() { ListBoxItems.Add(new PUListBoxItemModel() { Header = "Line" + (ListBoxItems.Count + 1), Value = (ListBoxItems.Count + 1), }); } public void RemoveItem() { if (ListBoxItems.Count > 0) ListBoxItems.RemoveAt(ListBoxItems.Count - 1); } public void SelectedBrushChanged(string content) { SelectedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void SearchBrushChanged(string content) { SearchBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } #endregion #region Function private async void Init() { await Task.Delay(100); ListBoxItems = new ObservableCollection() { new PUListBoxItemModel() { Header = "Line1", Value =1 }, new PUListBoxItemModel() { Header = "Line2", Value =2 }, new PUListBoxItemModel() { Header = "Line3", Value =3 }, new PUListBoxItemModel() { Header = "Line4", Value =4 }, new PUListBoxItemModel() { Header = "Line5", Value =5 }, }; DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置当鼠标悬浮时ListBoxItem的背景色。",DefaultValue = "#EEEEEE" }, new DataSourceModel() { Name = "SelectedBrush" ,Type = "Brush" ,Description = "获取或设置当ListBoxItem被选中时的背景色。",DefaultValue = "#DDDDDD" }, new DataSourceModel() { Name = "SearchBrush" ,Type = "Brush" ,Description = "获取或设置当搜索ListBoxItem时,ListBoxItem被找到时应呈现的背景色。",DefaultValue = "#EEEEEE" }, new DataSourceModel() { Name = "SelectedValuePath" ,Type = "SelectedValuePaths枚举" ,Description = "该属性指定了当子项目被选中时,SelectedValue应呈现子项目的哪一个值。【可选值:Header(其实对应的是Content属性)、Value】",DefaultValue = "Header" }, new DataSourceModel() { Name = "SelectedValue" ,Type = "Object" ,Description = "获取被选中PUTabItem的Header(即Content属性)或Value属性(这取决于SelectedValuePath),或反向选中子项目。",DefaultValue = "Null" }, new DataSourceModel() { Name = "BindingItems" ,Type = "ObservableCollection" ,Description = "若使用MVVM绑定,请使用此依赖属性。详见注解”已禁用ItemSource属性“。",DefaultValue = "Null" }, }; DependencyPropertyList2 = new ObservableCollection() { new DataSourceModel() { Name = "Value" ,Type = "Object" ,Description = "获取或设置用以标记该项目的值(类似于Tag属性)。",DefaultValue = "#DDDDDD" }, }; APIList = new ObservableCollection() { new DataSourceModel() { Name = "GetListBoxItemByContent(object content)" ,Description = "通过内容获取符合条件的第一个子项。" }, new DataSourceModel() { Name = "GetListBoxItemByValue(object value)" ,Description = "通过Value获取符合条件的第一个子项。"}, new DataSourceModel() { Name = "GetListBoxItemByUid(string uid)" ,Description = "通过Uid获取符合条件的第一个子项。"}, new DataSourceModel() { Name = "SearchItemByContent(string content, bool allowFuzzySearch = true)" ,Description = "通过内容查询符合条件的第一个子项,滚动到该项目并高亮(子项的内容须为string类型)。" }, new DataSourceModel() { Name = "SearchItemByValue(object value)" ,Description = "通过Value查询符合条件的第一个子项,滚动到该项目并高亮。" }, new DataSourceModel() { Name = "SearchItemByUid(string uid)" ,Description = "通过Uid查询符合条件的第一个子项,滚动到该项目并高亮。" }, }; EventList2 = new ObservableCollection() { new DataSourceModel() { Name = "Searched" ,Description = "当子项被搜索到时,触发此事件。" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "已禁用ItemsSource属性" ,Description = "ItemsSource属性不能自动生成PUListBoxItem,因此隐藏了Set方法(为了防止误用)。若要使用MVVM绑定,请使用BindingItems属性。该属性已实现双向绑定,当BindingItems属性发生改变时,ListBox的Items将同步发生变化;反之亦然。请根据需要来选择是否设置Mode=TwoWay。\n此外,PUListBoxItemModel在初始化时会为其Uid属性(只读的)生成一个值;BindingItem在生成子控件时,会将该Model中的Uid值赋给它所对应子控件的Uid属性。这意味着你可以通过该Model的Uid属性来查找真实的控件。" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/PasswordBoxViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class PasswordBoxViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public PasswordBoxViewModel(IWindowManager windowManager) { _windowManager = windowManager; PasswordBoxStyle = PasswordBoxStyles.General; RadiusInteger = 3; Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF")); Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D3D3D3")); ShadowColor = (Color)ColorConverter.ConvertFromString("#22888888"); Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public PasswordBoxStyles PasswordBoxStyle { get { return _PasswordBoxStyle; } set { _PasswordBoxStyle = value; NotifyOfPropertyChange(() => PasswordBoxStyle); } } private PasswordBoxStyles _PasswordBoxStyle; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; BorderCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public bool ShowPwdButtonIsChecked { get { return _showPwdButtonIsChecked; } set { _showPwdButtonIsChecked = value; NotifyOfPropertyChange(() => ShowPwdButtonIsChecked); } } private bool _showPwdButtonIsChecked; public CornerRadius BorderCornerRadius { get { return _borderCornerRadius; } set { _borderCornerRadius = value; NotifyOfPropertyChange(() => BorderCornerRadius); } } private CornerRadius _borderCornerRadius; public Brush Background { get { return _background; } set { _background = value; NotifyOfPropertyChange(() => Background); } } private Brush _background; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public Brush BorderBrush { get { return _borderBrush; } set { _borderBrush = value; NotifyOfPropertyChange(() => BorderBrush); } } private Brush _borderBrush; public Color ShadowColor { get { return _shadowColor; } set { _shadowColor = value; NotifyOfPropertyChange(() => ShadowColor); } } private Color _shadowColor; #endregion #region Event public void PasswordBoxStyleChanged(string content) { PasswordBoxStyle = (PasswordBoxStyles)Enum.Parse(typeof(PasswordBoxStyles), content); } public void BackgroundChanged(string content) { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ShadowColorChanged(string content) { ShadowColor = (Color)ColorConverter.ConvertFromString(content); } public void BorderBrushChanged(string content) { BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } #endregion #region Function public async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "PasswordBoxStyle" ,Type = "PasswordBoxStyles枚举" ,Description = "获取或设置密码框的基本样式。【可选值:General、IconGroup】",DefaultValue = "General" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置密码框的圆角大小。",DefaultValue = "0" }, new DataSourceModel() { Name = "ShadowColor" ,Type = "Color" ,Description = "获取或设置密码框获得焦点时阴影的颜色。",DefaultValue = "#66888888" }, new DataSourceModel() { Name = "Watermark" ,Type = "String" ,Description = "获取或设置水印内容。",DefaultValue = "Null" }, new DataSourceModel() { Name = "Icon" ,Type = "Object" ,Description = "获取或设置密码框获得焦点时阴影的颜色,仅在IconGroup样式下生效。",DefaultValue = "#66888888" }, new DataSourceModel() { Name = "IconWidth" ,Type = "Color" ,Description = "获取或设置图标的宽度。",DefaultValue = "30" }, new DataSourceModel() { Name = "IsShowPwdButtonShow" ,Type = "Boolean" ,Description = "获取或设置当鼠标悬浮时是否显示 显示密码 按钮。",DefaultValue = "False" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "关于ShadowColor" ,Description = "当密码框获得焦点时,密码框会获得一个0.4透明度、5px大小的阴影。DropShadow效果的Color不支持8位HEX(仅支持6位HEX),因而透明度被限制在0.4。" }, new DataSourceModel() { Name = "该控件继承自TextBox" ,Description = "原生的PasswordBox提供了安全加密算法,使得其他程序无法通过读取计算机内存来获得用户输入的密码。由于PasswordBox是一个密封类,PUPasswordBox事实上是一个继承自TextBox的控件。该控件不能像原生控件那样提供内存安全保护,因而不建议在高风险环境中使用。" }, new DataSourceModel() { Name = "已隐藏Text属性的Set方法" ,Description = "控件提供了Password和PasswordChar属性,并对外隐藏了Text属性的Set方法。" }, }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/ProgressBarViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class ProgressBarViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public ProgressBarViewModel(IWindowManager windowManager) { _windowManager = windowManager; ProgressBarStyle = ProgressBarStyles.Ring; RadiusInteger = 0; Height = 100; Width = 100; BorderThicknessInterger = 3; Percent = 0.2; ShowPercentIsChecked = true; BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D3D3D3")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); Background = new SolidColorBrush(Colors.Transparent); Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AAAAAA")); Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public ObservableCollection EventList { get { return _eventList; } set { _eventList = value; NotifyOfPropertyChange(() => EventList); } } private ObservableCollection _eventList; public ProgressBarStyles ProgressBarStyle { get { return _ProgressBarStyle; } set { _ProgressBarStyle = value; NotifyOfPropertyChange(() => ProgressBarStyle); } } private ProgressBarStyles _ProgressBarStyle; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; BorderCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public double Width { get { return _width; } set { _width = value; NotifyOfPropertyChange(() => Width); } } private double _width; public double Height { get { return _Height; } set { _Height = value; NotifyOfPropertyChange(() => Height); } } private double _Height; public double Percent { get { return _percent; } set { _percent = value; NotifyOfPropertyChange(() => Percent); } } private double _percent; public int BorderThicknessInterger { get { return _borderThicknessInterger; } set { _borderThicknessInterger = value; BorderThickness = new Thickness(value); NotifyOfPropertyChange(() => BorderThicknessInterger); } } private int _borderThicknessInterger; public Thickness BorderThickness { get { return _borderThickness; } set { _borderThickness = value; NotifyOfPropertyChange(() => BorderThickness); } } private Thickness _borderThickness; public CornerRadius BorderCornerRadius { get { return _borderCornerRadius; } set { _borderCornerRadius = value; NotifyOfPropertyChange(() => BorderCornerRadius); } } private CornerRadius _borderCornerRadius; public Brush BorderBrush { get { return _borderBrush; } set { _borderBrush = value; NotifyOfPropertyChange(() => BorderBrush); } } private Brush _borderBrush; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; public Brush Background { get { return _background; } set { _background = value; NotifyOfPropertyChange(() => Background); } } private Brush _background; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public bool ShowPercentIsChecked { get { return _showPercentIsChecked; } set { _showPercentIsChecked = value; NotifyOfPropertyChange(() => ShowPercentIsChecked); } } private bool _showPercentIsChecked; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void StyleChanged(string content) { ProgressBarStyle = (ProgressBarStyles)Enum.Parse(typeof(ProgressBarStyles), content); } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void BorderBrushChanged(string content) { BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void BackgroundChanged(string content) { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } #endregion #region Function private async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "Percent" ,Type = "Double" ,Description = "获取或设置当前进度条的百分比,从0~1的值。",DefaultValue = "0" }, new DataSourceModel() { Name = "ProgressBarStyle" ,Type = "ProgressBarStyles枚举" ,Description = "获取或设置进度条的基本样式。【可选项:General、Ring】",DefaultValue = "General" }, new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置进度条的填充颜色。",DefaultValue = "#3E3E3E" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置进度条的圆角大小。",DefaultValue = "0" }, new DataSourceModel() { Name = "AnimationDuration" ,Type = "TimeSpan" ,Description = "获取或设置进度条的填充动画持续时间。",DefaultValue = "0.4秒" }, new DataSourceModel() { Name = "IsPercentShow" ,Type = "Boolean" ,Description = "获取或设置是否显示百分比。",DefaultValue = "False" }, new DataSourceModel() { Name = "ProgressDirection" ,Type = "ProgressDirections枚举" ,Description = "获取或设置进度条填充方向。【可选值:LeftToRight、RightToLeft、BottomToTop、TopToBottom】",DefaultValue = "LeftToRight" }, }; EventList = new ObservableCollection() { new DataSourceModel() { Name = "PercentChanged" ,Description = "当Percent属性发生变化时,触发此事件。事件参数:Percent属性值。" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "继承自Control" ,Description = "该控件继承自Control控件(而非ProgressBar),无法使用Maximuim、Minimium、Value等属性。" }, new DataSourceModel() { Name = "支持纵向进度条" ,Description = "ProgressDirection支持从左到右、从右到左、从上到下、从下到上的填充方式。标准的横向进度条应是LeftToRight,纵向进度条应是BottomToTop。" }, new DataSourceModel() { Name = "关于Ring样式" ,Description = "环形进度条的圆环初始色取决于BorderBrush,进度填充色取决于CoverBrush,环的粗细取决于BorderThickness。如果控件的长宽大小不等,会导致圆环异常扭曲。" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/RadioButtonViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class RadioButtonViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public RadioButtonViewModel(IWindowManager windowManager) { _windowManager = windowManager; RadioButtonStyle = RadioButtonStyles.General; RadiusInteger = 0; InnerHeight = 20; InnerWidth = 20; BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public RadioButtonStyles RadioButtonStyle { get { return _RadioButtonStyle; } set { _RadioButtonStyle = value; NotifyOfPropertyChange(() => RadioButtonStyle); } } private RadioButtonStyles _RadioButtonStyle; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; BorderCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public double InnerWidth { get { return _innerWidth; } set { _innerWidth = value; NotifyOfPropertyChange(() => InnerWidth); } } private double _innerWidth; public double InnerHeight { get { return _innerHeight; } set { _innerHeight = value; NotifyOfPropertyChange(() => InnerHeight); } } private double _innerHeight; public CornerRadius BorderCornerRadius { get { return _borderCornerRadius; } set { _borderCornerRadius = value; NotifyOfPropertyChange(() => BorderCornerRadius); } } private CornerRadius _borderCornerRadius; public Brush BorderBrush { get { return _borderBrush; } set { _borderBrush = value; NotifyOfPropertyChange(() => BorderBrush); } } private Brush _borderBrush; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void StyleChanged(string content) { RadioButtonStyle = (RadioButtonStyles)Enum.Parse(typeof(RadioButtonStyles), content); } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void BorderBrushChanged(string content) { BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } #endregion #region Function private async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "RadioButtonStyle" ,Type = "Brush" ,Description = "获取或设置选择框的基本样式。【可选项:General、Classic、Switch、Branch、Button】",DefaultValue = "General" }, new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置鼠标悬浮时子项的背景颜色。",DefaultValue = "#EEEEEE" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置选择框的圆角大小。",DefaultValue = "0" }, new DataSourceModel() { Name = "InnerWidth" ,Type = "Double" ,Description = "获取或设置选择框的宽度。",DefaultValue = "20 / 30 (Switch)" }, new DataSourceModel() { Name = "InnerHeight" ,Type = "Double" ,Description = "获取或设置选择框的高度。",DefaultValue = "20" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/SliderViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class SliderViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public SliderViewModel(IWindowManager windowManager) { _windowManager = windowManager; Maximuim = 10; Minimuim = 0; Value = 5; Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D3D3D3")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#696969")); ShadowColor = (Color)ColorConverter.ConvertFromString("#888888"); Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public Color ShadowColor { get { return _shadowColor; } set { _shadowColor = value; NotifyOfPropertyChange(() => ShadowColor); } } private Color _shadowColor; public int Maximuim { get { return _maximuim; } set { _maximuim = value; NotifyOfPropertyChange(() => Maximuim); } } private int _maximuim; public int Minimuim { get { return _minimuim; } set { _minimuim = value; NotifyOfPropertyChange(() => Minimuim); } } private int _minimuim; public int Value { get { return _value; } set { _value = value; NotifyOfPropertyChange(() => Value); } } private int _value; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ShadowColorChanged(string content) { ShadowColor = (Color)ColorConverter.ConvertFromString(content); } #endregion #region Function private async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置滑块覆盖区域(左侧)的颜色。",DefaultValue = "#696969" }, new DataSourceModel() { Name = "Maximuim" ,Type = "Int" ,Description = "获取或设置滑块的最大值。",DefaultValue = "100" }, new DataSourceModel() { Name = "Minimuim" ,Type = "Int" ,Description = "获取或设置滑块的最小值。",DefaultValue = "0" }, new DataSourceModel() { Name = "Value" ,Type = "Int" ,Description = "获取或设置滑块当前选择的值。",DefaultValue = "0" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "有关滑块的颜色" ,Description = "滑块右侧的颜色受CoverBrush影响,左侧的颜色受Foreground影响。滑块的边框(白色)不能更改。" }, new DataSourceModel() { Name = "若要实现步长功能" ,Description = "步长功能可以由Value乘以某个值来展示给用户(这也可以应用于小数)。" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/TabControlViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Linq; namespace Panuon.UIBrowser.ViewModels.Control { public class TabControlViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public TabControlViewModel(IWindowManager windowManager) { _windowManager = windowManager; TabControlStyle = TabControlStyles.General; SelectedValue = 1; Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#696969")); SelectedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D3D3D3")); Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection DependencyPropertyList2 { get { return _dependencyPropertyList2; } set { _dependencyPropertyList2 = value; NotifyOfPropertyChange(() => DependencyPropertyList2); } } private ObservableCollection _dependencyPropertyList2; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public TabControlStyles TabControlStyle { get { return _tabControlStyles; } set { _tabControlStyles = value; NotifyOfPropertyChange(() => TabControlStyle); } } private TabControlStyles _tabControlStyles; public bool CanDeleteIsChecked { get { return _canDeleteIsChecked; } set { _canDeleteIsChecked = value; TabItems.Apply(x => x.CanDelete = value); NotifyOfPropertyChange(() => CanDeleteIsChecked); } } private bool _canDeleteIsChecked; public Brush BorderBrush { get { return _borderBrush; } set { _borderBrush = value; NotifyOfPropertyChange(() => BorderBrush); } } private Brush _borderBrush; public Brush SelectedBrush { get { return _selectedBrush; } set { _selectedBrush = value; NotifyOfPropertyChange(() => SelectedBrush); } } private Brush _selectedBrush; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public ObservableCollection TabItems { get { return _tabItems; } set { _tabItems = value; NotifyOfPropertyChange(() => TabItems); } } private ObservableCollection _tabItems; public int SelectedValue { get { return _selectedValue; } set { _selectedValue = value; NotifyOfPropertyChange(() => SelectedValue); } } private int _selectedValue; #endregion #region Event public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void AddItem() { TabItems.Add(new PUTabItemModel() { CanDelete = CanDeleteIsChecked, Header = "TabItem" + (TabItems.Count + 1), Value = (TabItems.Count + 1), Content = "Page " + (TabItems.Count + 1), }); } public void RemoveItem() { if (TabItems.Count > 0) TabItems.RemoveAt(TabItems.Count - 1); } public void StyleChanged(string content) { TabControlStyle = (TabControlStyles)Enum.Parse(typeof(TabControlStyles), content); } public void SelectedBrushChanged(string content) { SelectedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void BorderBrushChanged(string content) { BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } #endregion #region Function private async void Init() { await Task.Delay(100); TabItems = new BindableCollection() { new PUTabItemModel() { Header = "TabItem1",Value =1, Content = "Page 1", }, new PUTabItemModel() { Header = "TabItem2",Value =2, Content = "Page 2", }, new PUTabItemModel() { Header = "TabItem3",Value =3, Content = "Page 3", }, }; DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "TabControlStyle" ,Type = "TabControlStyles枚举类型" ,Description = "获取或设置选项卡的基本样式。【可选值:General、Classic】",DefaultValue = "General" }, new DataSourceModel() { Name = "DeleteMode" ,Type = "DeleteModes枚举类型" ,Description = "获取或设置当子项设置为可删除时,用户点击删除按钮后应执行的操作。【可选值:Delete(立即删除项目并触发DeleteItem事件)、EventOnly(不删除项目,仅触发DeleteItem事件)】",DefaultValue = "Delete" }, new DataSourceModel() { Name = "SelectedBrush" ,Type = "Brush" ,Description = "获取或设置当某个子项被选中时的前景色。",DefaultValue = "#3E3E3E" }, new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置鼠标悬浮时遮罩层的背景颜色",DefaultValue = "0" }, new DataSourceModel() { Name = "SelectedValuePath" ,Type = "SelectedValuePaths枚举" ,Description = "该属性指定了当子项目被选中时,SelectedValue应呈现子项目的哪一个值。【可选值:Header、Value】",DefaultValue = "Header" }, new DataSourceModel() { Name = "SelectedValue" ,Type = "Object" ,Description = "获取被选中PUTabItem的Header或Value属性(这取决于SelectedValuePath),或反向选中子项目。",DefaultValue = "Null" }, new DataSourceModel() { Name = "BindingItems" ,Type = "ObservableCollection" ,Description = "若使用MVVM绑定,请使用此依赖属性。详见注解”已禁用ItemSource属性“。",DefaultValue = "Null" }, }; DependencyPropertyList2 = new ObservableCollection() { new DataSourceModel() { Name = "CanDelete" ,Type = "Boolean" ,Description = "获取或设置选项卡的基本样式。【可选值:General、Classic】",DefaultValue = "General" }, new DataSourceModel() { Name = "Icon" ,Type = "Object" ,Description = "获取或设置显示在选项卡前的图标。",DefaultValue = "Null" }, new DataSourceModel() { Name = "Value" ,Type = "Object" ,Description = "获取或设置该子项可以携带的值,不会对前端显示造成影响。",DefaultValue = "Null" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "TabItem的样式" ,Description = "TabItem的前景色、边框颜色都会使用TabControl的前景色和边框颜色,无需再为每个TabItem单独设置。" }, new DataSourceModel() { Name = "已禁用ItemsSource属性" ,Description = "ItemsSource属性不能自动生成PUTabItem,因此隐藏了Set方法(为了防止误用)。若要使用MVVM绑定,请使用BindingItems属性。该属性已实现双向绑定,当BindingItems属性发生改变时,TabControl的Items将同步发生变化;反之亦然。请根据需要来选择是否设置Mode=TwoWay。\n此外,PUTabItemModel在初始化时会为其Uid属性(只读的)生成一个值;BindingItem在生成子控件时,会将该Model中的Uid值赋给它所对应子控件的Uid属性。这意味着你可以通过该Model的Uid属性来查找真实的控件。" }, new DataSourceModel() { Name = "如果你想在删除前进行验证" ,Description = "DeleteMode提供了两种方式来处理删除事件。Delete选项表示当用户点击删除按钮时,应当立即删除项目并触发DeleteItem路由事件;而EventOnly选项则只会触发DeleteItem路由事件,不会删除项目。你可以监听该事件的发生,并判断是否应该删除该项目。" }, new DataSourceModel() { Name = "关于SelectedValuePath" ,Description = "PanuonUI中的大多数组合型容器控件都重写了此属性。重写后的SelectedValuePath只有两个选项:Header和Value。Header选项表示SelectedValue属性应当呈现被选择项的Header属性,而Value选项则表示SelectedValue属性应呈现被选择项的Value属性。" }, new DataSourceModel() { Name = "关于SelectedValue" ,Description = "当选中项发生改变时,该属性的值会依据SelectedValuePath的设定发生变化。同时,你可以通过对该属性赋值来搜索并选中项目(至于是通过子项的Header还是Value进行搜索,这同样取决于SelectedValuePath的值)。请注意,搜索时使用的是Equal方法,这意味着1和“1”是完全不同的(错误赋值可能会导致搜索不到子项)。" }, new Models.DataSourceModel() { Name ="不支持动态修改TabStripPlacement属性", Description ="在初始化后设置TabStripPlacement属性可能会导致异常。" } }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/TextBoxViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class TextBoxViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public TextBoxViewModel(IWindowManager windowManager) { _windowManager = windowManager; TextBoxStyle = TextBoxStyles.General; RadiusInteger = 3; Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF")); Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D3D3D3")); ShadowColor = (Color)ColorConverter.ConvertFromString("#22888888"); TextType = TextTypes.Text; Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public TextBoxStyles TextBoxStyle { get { return _textboxStyle; } set { _textboxStyle = value; NotifyOfPropertyChange(() => TextBoxStyle); } } private TextBoxStyles _textboxStyle; public TextTypes TextType { get { return _textType; } set { _textType = value; NotifyOfPropertyChange(() => TextType); } } private TextTypes _textType; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; BorderCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public bool ClearButtonIsChecked { get { return _clearButtonIsChecked; } set { _clearButtonIsChecked = value; NotifyOfPropertyChange(() => ClearButtonIsChecked); } } private bool _clearButtonIsChecked; public CornerRadius BorderCornerRadius { get { return _borderCornerRadius; } set { _borderCornerRadius = value; NotifyOfPropertyChange(() => BorderCornerRadius); } } private CornerRadius _borderCornerRadius; public Brush Background { get { return _background; } set { _background = value; NotifyOfPropertyChange(() => Background); } } private Brush _background; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public Brush BorderBrush { get { return _borderBrush; } set { _borderBrush = value; NotifyOfPropertyChange(() => BorderBrush); } } private Brush _borderBrush; public Color ShadowColor { get { return _shadowColor; } set { _shadowColor = value; NotifyOfPropertyChange(() => ShadowColor); } } private Color _shadowColor; #endregion #region Event public void NumberLimit(bool isLimit) { if (isLimit) TextType = TextTypes.Number; else TextType = TextTypes.Text; } public void TextBoxStyleChanged(string content) { TextBoxStyle = (TextBoxStyles)Enum.Parse(typeof(TextBoxStyles), content); } public void BackgroundChanged(string content) { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ShadowColorChanged(string content) { ShadowColor = (Color)ColorConverter.ConvertFromString(content); } public void BorderBrushChanged(string content) { BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } #endregion #region Function public async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "TextBoxStyle" ,Type = "TextBoxStyles枚举" ,Description = "获取或设置文本框的基本样式。【可选值:General、IconGroup】",DefaultValue = "General" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置文本框的圆角大小。",DefaultValue = "0" }, new DataSourceModel() { Name = "ShadowColor" ,Type = "Color" ,Description = "获取或设置输入框获得焦点时阴影的颜色。",DefaultValue = "#66888888" }, new DataSourceModel() { Name = "Watermark" ,Type = "String" ,Description = "获取或设置水印内容。",DefaultValue = "Null" }, new DataSourceModel() { Name = "Icon" ,Type = "Object" ,Description = "获取或设置输入框获得焦点时阴影的颜色,仅在IconGroup样式下生效。",DefaultValue = "#66888888" }, new DataSourceModel() { Name = "IconWidth" ,Type = "Color" ,Description = "获取或设置图标的宽度。",DefaultValue = "30" }, new DataSourceModel() { Name = "IsClearButtonShow" ,Type = "Boolean" ,Description = "获取或设置当鼠标悬浮时是否显示清除按钮。",DefaultValue = "False" }, new DataSourceModel() { Name = "TextType" ,Type = "TextTypes枚举" ,Description = "获取或设置允许输入的文本类型。【可选值:Text、Number、Decimal】",DefaultValue = "Text" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "关于ShadowColor" ,Description = "当文本框获得焦点时,文本框会获得一个0.4透明度、5px大小的阴影。DropShadow效果的Color不支持8位HEX(仅支持6位HEX),因而透明度被限制在0.4。" }, }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/TreeViewViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UI.Utils; using Panuon.UIBrowser.Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Control { public class TreeViewViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public TreeViewViewModel(IWindowManager windowManager) { _windowManager = windowManager; TreeViewStyle = TreeViewStyles.General; ExpandMode = ExpandModes.Click; ChoosedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#DDDDDD")); Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#696969")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#EEEEEE")); Init(); ChoosedValue = "1-1"; } #endregion #region Bindings public ObservableCollection TreeViewItems { get { return _treeViewItems; } set { _treeViewItems = value; NotifyOfPropertyChange(() => TreeViewItems); } } private ObservableCollection _treeViewItems; public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection DependencyPropertyList2 { get { return _dependencyPropertyList2; } set { _dependencyPropertyList2 = value; NotifyOfPropertyChange(() => DependencyPropertyList2); } } private ObservableCollection _dependencyPropertyList2; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public TreeViewStyles TreeViewStyle { get { return _treeViewStyle; } set { _treeViewStyle = value; NotifyOfPropertyChange(() => TreeViewStyle); } } private TreeViewStyles _treeViewStyle; public Brush ChoosedBrush { get { return _choosedBrush; } set { _choosedBrush = value; NotifyOfPropertyChange(() => ChoosedBrush); } } private Brush _choosedBrush; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; public Brush Foreground { get { return _foreground; } set { _foreground = value; NotifyOfPropertyChange(() => Foreground); } } private Brush _foreground; public string ChoosedValue { get { return _choosedValue; } set { _choosedValue = value; NotifyOfPropertyChange(() => ChoosedValue); } } private string _choosedValue; public ExpandModes ExpandMode { get { return _expandMode; } set { _expandMode = value; NotifyOfPropertyChange(() => ExpandMode); } } private ExpandModes _expandMode; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void AddItem() { TreeViewItems.Add(new PUTreeViewItemModel() { Header = "第" + (TreeViewItems.Count + 1) + "部分", Value = (TreeViewItems.Count + 1).ToString(), Items = new List() { new PUTreeViewItemModel() { Header = "Value : " + (TreeViewItems.Count + 1) + "-1" , Value = (TreeViewItems.Count + 1) + "-1", }, new PUTreeViewItemModel() { Header = "Value : " + (TreeViewItems.Count + 1) + "-2", Value = (TreeViewItems.Count + 1) + "-2" , }, } }); } public void RemoveItem() { if (TreeViewItems.Count > 0) TreeViewItems.RemoveAt(TreeViewItems.Count - 1); } public void SelectedBrushChanged(string content) { ChoosedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ForegroundChanged(string content) { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void StyleChanged(string content) { TreeViewStyle = (TreeViewStyles)Enum.Parse(typeof(TreeViewStyles), content); } public void ExpandModeChanged(string content) { ExpandMode = (ExpandModes)Enum.Parse(typeof(ExpandModes), content); } #endregion #region Function private async void Init() { await Task.Delay(100); TreeViewItems = new BindableCollection() { new PUTreeViewItemModel() { Header = "第1部分", Value = "1", Items = new List() { new PUTreeViewItemModel() { Header = "Value : 1-1" , Value = "1-1", }, new PUTreeViewItemModel() { Header = "Value : 1-2", Value = "1-2" , }, } }, new PUTreeViewItemModel() { Header = "第2部分", Value = "2", Items = new List() { new PUTreeViewItemModel() { Header = "Value : 2-1" , Value = "2-1", }, new PUTreeViewItemModel() { Header = "Value : 2-2", Value = "2-2" , }, } }, new PUTreeViewItemModel() { Header = "第3部分", Value = "3", Items = new List() { new PUTreeViewItemModel() { Header = "Value : 3-1" , Value = "3-1", }, new PUTreeViewItemModel() { Header = "Value : 3-2", Value = "3-2" , }, } }, }; DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "TreeViewStyle" ,Type = "TreeViewStyles枚举类型" ,Description = "获取或设置树视图的基本样式。【可选值:General、Classic】",DefaultValue = "General" }, new DataSourceModel() { Name = "InnerHeight" ,Type = "Double" ,Description = "获取或设置子项目的单行元素高度。",DefaultValue = "40" }, new DataSourceModel() { Name = "ChoosedItem" ,Type = "PUTreeViewItem" ,Description = "获取被选中的元素。只读。",DefaultValue = "#3E3E3E" }, new DataSourceModel() { Name = "ChoosedBrush" ,Type = "Brush" ,Description = "获取或设置当某个子项被选中时的前景色。",DefaultValue = "#3E3E3E" }, new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置鼠标悬浮时遮罩层的背景颜色。",DefaultValue = "0" }, new DataSourceModel() { Name = "ChoosedValuePath" ,Type = "SelectedValuePaths枚举" ,Description = "该属性指定了当子项目被选中时,SelectedValue应呈现子项目的哪一个值。【可选值:Header、Value】",DefaultValue = "Header" }, new DataSourceModel() { Name = "ChoosedValue" ,Type = "Object" ,Description = "获取被选中PUTabItem的Header或Value属性(这取决于SelectedValuePath),或反向选中子项目。",DefaultValue = "Null" }, new DataSourceModel() { Name = "ExpandMode" ,Type = "ExpandModes枚举类型" ,Description = "获取或设置是否需要展开父项的方式。【可选值:Click、DoubleClick】",DefaultValue = "Click" }, new DataSourceModel() { Name = "BindingItems" ,Type = "ObservableCollection" ,Description = "若使用MVVM绑定,请使用此依赖属性。详见注解”已禁用ItemSource属性“。",DefaultValue = "Null" }, }; DependencyPropertyList2 = new ObservableCollection() { new DataSourceModel() { Name = "IsChoosed" ,Type = "Boolean" ,Description = "获取或设置该子项是否已被选中,含有子项目的行项目无法被选中。",DefaultValue = "General" }, new DataSourceModel() { Name = "Value" ,Type = "Object" ,Description = "获取或设置该子项可以携带的值,不会对前端显示造成影响。",DefaultValue = "Null" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "不要使用Select系列属性" ,Description = "由于原生TreeView中带有子项的行项目也能被选中,因此新建了ChoosedItem来区别它。IsSelected、SelectedValuePath、SelectedValue属性已被隐藏Set方法,请改用IsChoosed、ChoosedValuePath和ChoosedValue属性。" }, new DataSourceModel() { Name = "已禁用ItemsSource属性" ,Description = "ItemsSource属性不能自动生成PUTreeViewItem,因此隐藏了Set方法(为了防止误用)。若要使用MVVM绑定,请使用BindingItems属性。该属性已实现双向绑定,当BindingItems属性发生改变时,TreeView的Items将同步发生变化;反之亦然。请根据需要来选择是否设置Mode=TwoWay。\n此外,PUTreeViewItemModel在初始化时会为其Uid属性(只读的)生成一个值;BindingItem在生成子控件时,会将该Model中的Uid值赋给它所对应子控件的Uid属性。这意味着你可以通过该Model的Uid属性来查找真实的控件。" }, new DataSourceModel() { Name = "关于ChoosedValuePath" ,Description = "ChoosedValuePath只有两个选项:Header和Value。Header选项表示ChoosedValue属性应当呈现被选择项的Header属性,而Value选项则表示ChoosedValue属性应呈现被选择项的Value属性。" }, new DataSourceModel() { Name = "关于ChoosedValue" ,Description = "当选中项发生改变时,该属性的值会依据ChoosedValuePath的设定发生变化。同时,你可以通过对该属性赋值来搜索并选中项目(至于是通过子项的Header还是Value进行搜索,这同样取决于ChoosedValuePath的值)。请注意,搜索时使用的是Equal方法,这意味着1和“1”是完全不同的(错误赋值可能会导致搜索不到子项)。" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Control/WindowViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System.Collections.ObjectModel; using System.Threading; using System.Threading.Tasks; using System.Windows.Controls; using System.Windows.Input; namespace Panuon.UIBrowser.ViewModels.Control { public class WindowViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public WindowViewModel(IWindowManager windowManager) { _windowManager = windowManager; Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection APIList { get { return _apiList; } set { _apiList = value; NotifyOfPropertyChange(() => APIList); } } private ObservableCollection _apiList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; #endregion #region Event public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } /// /// 使用数字作为参数不是一个好方法,这里为了方便 /// /// public void Display(int category) { switch (category) { case 1: var window1 = new Views.Control.Examples.MultiNavWindow(); window1.ShowDialog(); if (!window1.Result.Equals(0)) PUMessageBox.ShowDialog("最后点击的按钮(缩放和关闭按钮不算)是第" + window1.Result + "个"); break; case 2: var window2 = new Views.Control.Examples.LoginWindow(); window2.Owner = (Parent as ShellWindowViewModel).GetCurrentWindow(); window2.ShowDialog(); break; case 3: var window4 = new Views.Control.Examples.ChatWindow(); window4.ShowDialog(); break; case 4: SetAwait(true); Task.Run(() => { Thread.Sleep(2000); App.Current.Dispatcher.Invoke(() => { SetAwait(false); }); }); break; case 5: PUMessageBox.ShowDialog("Hello World"); break; case 6: PUMessageBox.ShowConfirm("Hello World"); break; case 7: PUMessageBox.ShowAwait("正在执行......", delegate { PUMessageBox.CloseAwait(delegate { PUMessageBox.ShowDialog("已取消。"); }); }); break; } } #endregion #region Function private async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "AnimationStyle" ,Type = "AnimationStyles枚举" ,Description = "获取或设置窗体动画类型。【可选值:Gradual(从上到下的渐变显示)、Scale(淡入淡出+缩放)、Fade(淡入淡出)】",DefaultValue = "Scale" }, new DataSourceModel() { Name = "AnimateIn" ,Type = "Boolean" ,Description = "获取或设置是否在窗体打开时使用动画。",DefaultValue = "True" }, new DataSourceModel() { Name = "AnimateOut" ,Type = "Boolean" ,Description = "获取或设置是否在窗体关闭时使用动画。",DefaultValue = "True" }, new DataSourceModel() { Name = "AllowShowDelay" ,Type = "Boolean" ,Description = "获取或设置是否允许延迟显示内容。当页面内容较为复杂时,启用此选项有助于减少启动动画卡顿。",DefaultValue = "False" }, new DataSourceModel() { Name = "IsCoverMaskShow" ,Type = "Boolean" ,Description = "获取或设置是否打开窗体的遮罩层。",DefaultValue = "False" }, new DataSourceModel() { Name = "IsAwaitShow" ,Type = "Boolean" ,Description = "获取或设置是否打开窗体的遮罩层,以及等待控件(显示为多个旋转的小球)。",DefaultValue = "False" }, new DataSourceModel() { Name = "NavButtonVisibility" ,Type = "Visibility" ,Description = "获取或设置右侧标题栏按钮的显示状态。",DefaultValue = "Visible" }, new DataSourceModel() { Name = "NavbarBackground" ,Type = "Brush" ,Description = "获取或设置标题栏的背景颜色。",DefaultValue = "White" }, new DataSourceModel() { Name = "NavbarHeight" ,Type = "Double" ,Description = "获取或设置标题栏的高度。",DefaultValue = "30" }, new DataSourceModel() { Name = "NavButtonHeight" ,Type = "Double" ,Description = "获取或设置标题栏按钮的高度。",DefaultValue = "30" }, new DataSourceModel() { Name = "NavButtonWidth" ,Type = "Double" ,Description = "获取或设置标题栏按钮的宽度。",DefaultValue = "40" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置窗体的圆角大小。",DefaultValue = "0" }, new DataSourceModel() { Name = "Header" ,Type = "Object" ,Description = "获取或设置窗体的标题。若为空,则窗体标题将使用Title的值。",DefaultValue = "Null" }, new DataSourceModel() { Name = "AllowAutoOwner" ,Type = "Boolean" ,Description = "获取或设置是否允许窗体在初始化时,尝试将系统中排在最前面的活动窗口设置为自己的Owner。",DefaultValue = "True" }, new DataSourceModel() { Name = "AllowAutoCoverMask" ,Type = "Boolean" ,Description = "获取或设置是否允许在调用Show或ShowDialog方法时自动打开父窗体(若Owner为Null或Owner不是PUWindow类型,则无效)的遮罩层,并在Close时将其关闭。",DefaultValue = "False" }, new DataSourceModel() { Name = "AllowForcingClose" ,Type = "Boolean" ,Description = "获取或设置是否允许用户使用Alt + F4组合键强制关闭当前窗体。",DefaultValue = "True" }, new DataSourceModel() { Name = "Result" ,Type = "Object" ,Description = "获取或设置窗体的返回结果,不会对前端显示造成影响。",DefaultValue = "Null" }, }; APIList = new ObservableCollection() { new DataSourceModel() { Name = "AppendNavButton(object content, RoutedEventHandler clickHandler)" ,Description = "向标题栏右侧控制按钮组中添加一个新的按钮,该按钮将被添加在按钮组的最左侧。" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "Owner属性" ,Description = "在PUWindow初始化时,Owner会被自动设置为当前的首个活动窗口(若AllowAutoOwner为False,不会执行此操作;如果失败,不会触发异常),以便于使用AllowAutoCoverMask属性或WindowStartupLocation属性。如果你在窗体Show或ShowDialog前手动指定了窗体的Owner,则将以你的为准。请注意以下情况:当你希望关闭当前窗体并立即打开一个新窗体时,您需要注意新窗体的Owner问题。AutoOwner可能会把即将关闭的窗体设置为自己的Owner,从而导致新窗体一打开就被立即关闭(因为它的Owner关闭了)。" }, new DataSourceModel() { Name = "Result" ,Description = "DialogResult属性只有True、False和Null三种选项。若返回结果较为复杂,可以使用该属性。" }, new DataSourceModel() { Name = "窗体背景色" ,Description = "若要设置覆盖全窗体的背景色,需要在设置Background的同时将NavBackground设置为Transparent。" }, new DataSourceModel() { Name = "有关Header属性" ,Description = "Title属性会同时作用于窗体的左上角标题和任务栏标题。如果你期望使用不同的值,使用Header属性可以单独设置左上角的标题。若Header属性为空,PanuonUI将使用Title属性的值作为左上角标题。若不希望使用任何左上角标题,请将Header属性设置为空格(而不是为空)" }, new DataSourceModel() { Name = "PanuonUI中带有“Brush”字样的属性" ,Description = "你可以使用渐变画刷或图像画刷来设置它们(这些属性都是Brush类型的)。" }, new DataSourceModel() { Name = "PanuonUI中的“Icon”属性" ,Description = "Icon属性通常都是Object类型的。所有Icon的默认字体样式(因为它的本质是一个Label)都是 {DynamicResource IconFont},你可以直接将FontAwesome图标字体赋值给Icon属性,也可以将该属性设置为任意一个控件。" }, }; } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Example.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/15 13:12:35 *说明: 样板。 *日志:2018/11/15 13:12:35 创建。 *==============================================================*/ using Caliburn.Micro; using Panuon.UIBrowser.Models; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows.Controls; using System.Windows.Input; namespace Panuon.UIBrowser.ViewModels { public class Example : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public Example(IWindowManager windowManager) { _windowManager = windowManager; Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public ObservableCollection APIList { get { return _apiList; } set { _apiList = value; NotifyOfPropertyChange(() => APIList); } } private ObservableCollection _apiList; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// /// /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } #endregion #region Function public async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "" ,Type = "" ,Description = "",DefaultValue = "" }, }; APIList = new ObservableCollection() { new DataSourceModel() { Name = "" ,Description = "" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "" ,Description = "" }, }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/IntroductionViewModel.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/12/21 15:24:39 *说明: *日志:2018/12/21 15:24:39 创建。 *==============================================================*/ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Caliburn.Micro; using System.Collections.ObjectModel; using Panuon.UIBrowser.Models; namespace Panuon.UIBrowser.ViewModels { public class IntroductionViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public IntroductionViewModel(IWindowManager windowManager) { _windowManager = windowManager; Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public ObservableCollection APIList { get { return _apiList; } set { _apiList = value; NotifyOfPropertyChange(() => APIList); } } private ObservableCollection _apiList; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// /// /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } #endregion #region Function public async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "" ,Type = "" ,Description = "",DefaultValue = "" }, }; APIList = new ObservableCollection() { new DataSourceModel() { Name = "" ,Description = "" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "" ,Description = "" }, }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/MainWindowViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.ViewModels.Partial; using System; using System.ComponentModel.Composition; using System.Windows.Threading; namespace Panuon.UIBrowser.ViewModels { [Export(typeof(IShell))] public class MainWindowViewModel : Conductor.Collection.OneActive, IShell { public MainWindowViewModel() { ActivateItem(new IntroductionViewModel()); } public void ChangeSelect(int select) { switch (select) { case 0: ActivateItem(new IntroductionViewModel()); return; case 1: ActivateItem(new WindowsViewModel()); return; case 2: ActivateItem(new ButtonsViewModel()); return; case 3: ActivateItem(new TextBoxsViewModel()); return; case 4: ActivateItem(new ComboBoxsViewModel()); return; case 5: ActivateItem(new PasswordBoxsViewModel()); return; case 6: ActivateItem(new CheckBoxsViewModel()); return; case 7: ActivateItem(new RadioButtonsViewModel()); return; case 8: ActivateItem(new TreeViewsViewModel()); return; case 9: ActivateItem(new ProgressBarsViewModel()); return; case 10: ActivateItem(new TabControlsViewModel()); return; case 11: ActivateItem(new SpecialViewModel()); return; case 12: ActivateItem(new ListBoxsViewModel()); return; case 13: ActivateItem(new SlidersViewModel()); return; case 14: ActivateItem(new DataGridsViewModel()); return; case 15: ActivateItem(new ImageCuterViewModel()); return; case 16: ActivateItem(new DatePickersViewModel()); return; case 17: ActivateItem(new PagingNavsViewModel()); return; case 18: ActivateItem(new BubblesViewModel()); return; case 19: ActivateItem(new ContextMenusViewModel()); return; case 98: ActivateItem(new ContextMenusViewModel()); return; case 99: ActivateItem(new UtilsViewModel()); return; case 101: ActivateItem(new LineChartsViewModel()); return; case 201: ActivateItem(new GridsViewModel()); return; } } public void ShowAwait() { (GetView() as PUWindow).IsAwaitShow = true; } public void CloseAwait() { (GetView() as PUWindow).IsAwaitShow = false; } } } ================================================ FILE: Panuon.UIBrowser/ViewModels/OverviewViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels { public class OverviewViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public OverviewViewModel(IWindowManager windowManager) { _windowManager = windowManager; ChangeThemeBrush(new RoutedPropertyChangedEventArgs(1, 1)); ProgressPercent = 0; } #endregion #region Bindings public Brush DeepCoverBrush { get { return _deepCoverBrush; } set { _deepCoverBrush = value; NotifyOfPropertyChange(() => DeepCoverBrush); } } private Brush _deepCoverBrush; public Brush LightCoverBrush { get { return _lightCoverBrush; } set { _lightCoverBrush = value; NotifyOfPropertyChange(() => LightCoverBrush); } } private Brush _lightCoverBrush; public Color LightColor { get { return _lightColor; } set { _lightColor = value; NotifyOfPropertyChange(() => LightColor); } } private Color _lightColor; public double ProgressPercent { get { return _progressPercent; } set { _progressPercent = value; NotifyOfPropertyChange(() => ProgressPercent); } } private double _progressPercent; #endregion #region Event int percent = 0; public void AddPercent() { if (percent < 5) { percent++; ProgressPercent = percent * 0.2; } } public void ReducePercent() { if (percent > 0) { percent--; ProgressPercent = percent * 0.2; } } public void Detail(string category) { switch (category) { case "Button": PUMessageBox.ShowDialog("123"); break; } } public void ChangeThemeBrush(RoutedPropertyChangedEventArgs e) { switch (e.NewValue) { case 1: DeepCoverBrush = new LinearGradientBrush() { GradientStops = new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#444444"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#CC444444"), Offset = 1 } } }; LightCoverBrush = new LinearGradientBrush() { GradientStops = new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#66444444"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#44444444"), Offset = 1 } } }; LightColor = (Color)ColorConverter.ConvertFromString("#44444444"); break; case 2: DeepCoverBrush = new LinearGradientBrush() { GradientStops = new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#49A9C0"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#CC49A9C0"), Offset = 1 } } }; LightCoverBrush = new LinearGradientBrush() { GradientStops = new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#6649A9C0"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#4449A9C0"), Offset = 1 } } }; LightColor = (Color)ColorConverter.ConvertFromString("#4449A9C0"); break; case 3: DeepCoverBrush = new LinearGradientBrush() { GradientStops = new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#E089B8"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#CCE089B8"), Offset = 1 } } }; LightCoverBrush = new LinearGradientBrush() { GradientStops = new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#66E089B8"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#44E089B8"), Offset = 1 } } }; LightColor = (Color)ColorConverter.ConvertFromString("#44E089B8"); break; case 4: DeepCoverBrush = new LinearGradientBrush() { GradientStops = new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#F4A758"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#CCF4A758"), Offset = 1 } } }; LightCoverBrush = new LinearGradientBrush() { GradientStops = new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#66F4A758"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#44F4A758"), Offset = 1 } } }; LightColor = (Color)ColorConverter.ConvertFromString("#44F4A758"); break; } } #endregion #region Function public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/BubblesViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Controls; namespace Panuon.UIBrowser.ViewModels.Partial { public class BubblesViewModel : Screen, IShell { #region Binding public AnglePositions AnglePosition { get { return _anglePosition; } set { _anglePosition = value; NotifyOfPropertyChange(() => AnglePosition); } } private AnglePositions _anglePosition = AnglePositions.Left; #endregion #region Event public void SelectionChanged(SelectionChangedEventArgs e) { var comboBoxItem = e.AddedItems[0] as PUComboBoxItem; var value = Int32.Parse(comboBoxItem.Value.ToString()); switch (value) { case 1: AnglePosition = AnglePositions.Left; break; case 2: AnglePosition = AnglePositions.Right; break; case 3: AnglePosition = AnglePositions.BottomLeft; break; case 4: AnglePosition = AnglePositions.BottomCenter; break; case 5: AnglePosition = AnglePositions.BottomRight; break; } } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/ButtonsViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class ButtonsViewModel : Screen, IShell { } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/CheckBoxsViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class CheckBoxsViewModel : Screen, IShell { } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/ComboBoxsViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Partial { public class ComboBoxsViewModel : Screen, IShell { public ComboBoxsViewModel() { } protected override void OnViewLoaded(object view) { base.OnViewLoaded(view); var comboList = new List(); comboList.Add(new PUComboBoxItemModel() { Header = "它的Value为123", CanDelete = true, Value = 123, }); comboList.Add(new PUComboBoxItemModel() { Header = "它的Value为456", CanDelete = true, Value = 456, }); ComboBoxItemsList = new BindableCollection(comboList); } #region Binding public string Password { get { return _password; } set { _password = value; NotifyOfPropertyChange(() => Password); } } private string _password = "12345"; public BindableCollection ComboBoxItemsList { get { return _comboBoxItemsList; } set { _comboBoxItemsList = value; NotifyOfPropertyChange(() => ComboBoxItemsList); } } private BindableCollection _comboBoxItemsList; public object SelectedValue { get { return _selectedValue; } set { _selectedValue = value; NotifyOfPropertyChange(() => SelectedValue); } } private object _selectedValue ; #endregion #region Event public void Delete(ItemCollection sender, RoutedPropertyChangedEventArgs e) { var item = e.NewValue as PUComboBoxItem; if(PUMessageBox.ShowConfirm("确定要删除该选项吗?") == true) { sender.Remove(item); } } public void GetValue() { PUMessageBox.ShowDialog($"该选项的Value为“{SelectedValue?.ToString()}”。\n你可以通过修改PUComboBoxItem的Value属性来控制它。"); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/ContextMenusViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; namespace Panuon.UIBrowser.ViewModels.Partial { public class ContextMenusViewModel : Screen, IShell { #region Binding public string Text { get { return _text; } set { _text = value; NotifyOfPropertyChange(() => Text); } } private string _text = "右击打开菜单"; #endregion #region Event public void Cut() { Clipboard.SetText(Text); Text = ""; } public void Copy() { Clipboard.SetText(Text); } public void Paste() { Text += Clipboard.GetText(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/DataGridsViewModel.cs ================================================ using Caliburn.Micro; using Microsoft.Win32; using Panuon.UI; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Media.Imaging; using System.ComponentModel; using System.Collections.ObjectModel; namespace Panuon.UIBrowser.ViewModels.Partial { public class DataGridsViewModel : Screen, IShell { public DataGridsViewModel() { var list = new List() { new ItemModel(1,"SUM0000001","Sams"), new ItemModel(2,"SUM0000002","Jack"), new ItemModel(3,"SUM0000003","Michael"), new ItemModel(4,"SUM0000004","Rechard"), new ItemModel(5,"SUM0000005","Woods"), }; ItemsList = new ObservableCollection(list); } #region Binding public ObservableCollection ItemsList { get { return _itemsList; } set { _itemsList = value; NotifyOfPropertyChange(() => ItemsList); } } private ObservableCollection _itemsList; #endregion #region Event public void Delete(long id) { var item = ItemsList.FirstOrDefault(x => x.ID == id); if (item == null) return; ItemsList.Remove(item); } #endregion } public class ItemModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public void NotifyOfPropertyChange(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } public ItemModel() { } public ItemModel(long id, string number, string name) { ID = id; Number = number; Name = name; } public long ID { get { return _id; } set { _id = value; NotifyOfPropertyChange("ID"); } } private long _id; public string Number { get { return _number; } set { _number = value; NotifyOfPropertyChange("Number"); } } private string _number; public string Name { get { return _name; } set { _name = value; NotifyOfPropertyChange("Name"); } } private string _name; } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/DatePickersViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UI.Utils; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; namespace Panuon.UIBrowser.ViewModels.Partial { public class DatePickersViewModel : Screen, IShell { public DatePickersViewModel() { SelectedDateTimeString = ((DateTime)SelectedDateTime).ToString("yyyy-MM-dd HH:mm:ss"); } #region Bindings public DateTime SelectedDateTime { get { return _selectedDate; } set { _selectedDate = value; SelectedDateTimeString = ((DateTime)SelectedDateTime).ToString("yyyy-MM-dd HH:mm:ss"); NotifyOfPropertyChange(() => SelectedDateTime); } } private DateTime _selectedDate = DateTime.Now.Date; public DateTime? MaxDateTime { get { return _maxDateTime; } set { _maxDateTime = value; NotifyOfPropertyChange(() => MaxDateTime); } } private DateTime? _maxDateTime; public DateTime? MinDateTime { get { return _minDateTime; } set { _minDateTime = value; NotifyOfPropertyChange(() => MinDateTime); } } private DateTime? _minDateTime; public string SelectedDateTimeString { get { return _selectedDateString; } set { _selectedDateString = value; NotifyOfPropertyChange(() => SelectedDateTimeString); } } private string _selectedDateString; public bool LimitMaxDateIsChecked { get { return _limitMaxDateIsChecked; } set { _limitMaxDateIsChecked = value; NotifyOfPropertyChange(() => LimitMaxDateIsChecked); } } private bool _limitMaxDateIsChecked; public bool LimitMinDateIsChecked { get { return _limitMinDateIsChecked; } set { _limitMinDateIsChecked = value; NotifyOfPropertyChange(() => LimitMinDateIsChecked); } } private bool _limitMinDateIsChecked; public DatePickerModes DatePickerMode { get { return _datePickerMode; } set { _datePickerMode = value; NotifyOfPropertyChange(() => DatePickerMode); } } private DatePickerModes _datePickerMode = DatePickerModes.DateTime; #endregion #region Event public void LimitMaxDate(bool toLimit) { if (toLimit) { MaxDateTime = DateTime.Now.AddMonths(1).Date; } else { MaxDateTime = null; } } public void LimitMinDate(bool toLimit) { if (toLimit) { MinDateTime = DateTime.Now.AddMonths(-1).Date; } else { MinDateTime = null; } } public void SelectionChanged(SelectionChangedEventArgs e) { var comboBoxItem = e.AddedItems[0] as PUComboBoxItem; var value = Int32.Parse(comboBoxItem.Value.ToString()); switch (value) { case 1: DatePickerMode = DatePickerModes.DateTime; break; case 2: DatePickerMode = DatePickerModes.DateOnly; break; case 3: DatePickerMode = DatePickerModes.TimeOnly; break; } } public void DateTimeInputChanged() { if (String.IsNullOrEmpty(SelectedDateTimeString)) { return; } DateTime date; if(!DateTime.TryParse(SelectedDateTimeString,out date)) { SelectedDateTime = DateTime.Now.Date; return; } SelectedDateTime = date; } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/GridsViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Controls; namespace Panuon.UIBrowser.ViewModels.Partial { public class GridsViewModel : Screen, IShell { } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/ImageCuterViewModel.cs ================================================ using Caliburn.Micro; using Microsoft.Win32; using Panuon.UI; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Media.Imaging; namespace Panuon.UIBrowser.ViewModels.Partial { public class ImageCuterViewModel : Screen, IShell { private PUImageCuter _cuter; private Image _image; public BitmapImage ImageSource { get { return _imageSource; } set { _imageSource = value; NotifyOfPropertyChange(() => ImageSource); } } private BitmapImage _imageSource; public BitmapImage CutImageSource { get { return _cutImageSource; } set { _cutImageSource = value; NotifyOfPropertyChange(() => CutImageSource); } } private BitmapImage _cutImageSource; #region Event public void BtnSelectFile() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "图像文件|*.jpg;*.png;*.jpeg;*.bmp"; if (ofd.ShowDialog() != true) return; var file = ofd.FileName; ImageSource = new BitmapImage(new Uri(file)); } #endregion public void ImageCuterLoaded(object sender) { _cuter = sender as PUImageCuter; } public void ImageLoaded(object sender) { _image = sender as Image; } public void BtnCut() { using (MemoryStream ms = new MemoryStream()) { _cuter.CutImageSource.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); BitmapImage image = new BitmapImage(); image.BeginInit(); ms.Seek(0, SeekOrigin.Begin); image.StreamSource = ms; image.EndInit(); _image.Source = image; Clipboard.SetImage(image); } } public void SelectionChanged(object sender) { var comboBox = sender as PUComboBox; switch (comboBox.SelectedValue as string) { case "Rectangle": _cuter.AreaStyle = PUImageCuter.AreaStyles.Rectangle; return; case "Square": _cuter.AreaStyle = PUImageCuter.AreaStyles.Square; return; } } } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/IntroductionViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class IntroductionViewModel : Screen,IShell { public string Website { get { return _website; } set { _website = value; NotifyOfPropertyChange(() => Website); } } private string _website = "https://blog.csdn.net/qq_36663276/article/details/80209684"; public void OpenWebsite() { System.Diagnostics.Process.Start("explorer.exe", Website); } } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/LineChartsViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI.Charts; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Windows; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Partial { public class LineChartsViewModel : Screen, IShell { private int _currentQuantity = 6; private int _currentMode = 0; private int _currentColor = 0; public LineChartsViewModel() { XAxis = new string[] { "1", "2", "3", "4", "5", "6" }; YAxis = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; Points = new ObservableCollection() { new PUChartPoint() { Value = 0.1, ValueTip = "1" }, new PUChartPoint() { Value = 0.2, ValueTip = "2" }, new PUChartPoint() { Value = 0.3, ValueTip = "3" }, new PUChartPoint() { Value = 0.4, ValueTip = "4" }, new PUChartPoint() { Value = 0.5, ValueTip = "5" }, new PUChartPoint() { Value = 0.6, ValueTip = "6" }, }; } #region Bindings public string[] XAxis { get { return _xAxis; } set { _xAxis = value; NotifyOfPropertyChange(() => XAxis); } } private string[] _xAxis; public string[] YAxis { get { return _yAxis; } set { _yAxis = value; NotifyOfPropertyChange(() => YAxis); } } private string[] _yAxis; public ObservableCollection Points { get { return _points; } set { _points = value; NotifyOfPropertyChange(() => Points); } } private ObservableCollection _points; public Brush AreaBrush { get { return _areaBrush; } set { _areaBrush = value; NotifyOfPropertyChange(() => AreaBrush); } } private Brush _areaBrush = new LinearGradientBrush(new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#AAAAAAAA"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#22AAAAAA"), Offset = 1 } }, 90); public Brush GridBrush { get { return _gridBrush; } set { _gridBrush = value; NotifyOfPropertyChange(() => GridBrush); } } private Brush _gridBrush = new SolidColorBrush(Colors.LightGray); public Brush LineBrush { get { return _lineBrush; } set { _lineBrush = value; NotifyOfPropertyChange(() => LineBrush); } } private Brush _lineBrush = new SolidColorBrush(Colors.Gray); public bool UsingAnimation { get { return _usingAnimation; } set { _usingAnimation = value; NotifyOfPropertyChange(() => UsingAnimation); } } private bool _usingAnimation = true; public int XAxisGap { get { return _xAxisGap; } set { _xAxisGap = value; NotifyOfPropertyChange(() => XAxisGap); } } private int _xAxisGap = 0; #endregion #region Event public void RandomValue() { if (_currentMode == 0) { var list = new List(); for (int i = 0; i < _currentQuantity; i++) { var value = GetRandomDecimal1(); list.Add(new PUChartPoint() { Value = value, ValueTip = (value * 10).ToString("f2"), }); } Points = new ObservableCollection(list); } else if (_currentMode == 1) { var temp = new string[] { "等级一", "等级二", "等级三", "等级四", "等级五", "等级六" }; var list = new List(); for (int i = 0; i < _currentQuantity; i++) { var value = GetRandomDecimal2(); list.Add(new PUChartPoint() { Value = value, ValueTip = temp[((int)(value * 5))], }); } Points = new ObservableCollection(list); } } public void ChangeAxis() { if (_currentMode == 0) { _currentQuantity = 7; XAxis = new string[] { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期天" }; YAxis = new string[] { "等级一", "等级二", "等级三", "等级四", "等级五", "等级六" }; _currentMode = 1; RandomValue(); } else if (_currentMode == 1) { _currentQuantity = 6; XAxis = new string[] { "1", "2", "3", "4", "5", "6" }; YAxis = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; _currentMode = 0; RandomValue(); } } public void AddValues() { if(_currentMode == 0) { _currentQuantity++; var list = XAxis.ToList(); list.Add(_currentQuantity.ToString()); if(list.Count > 60) { XAxisGap = 3; } else if (list.Count > 40) { XAxisGap = 2; } else if (list.Count > 20) { XAxisGap = 1; } XAxis = list.ToArray(); var value = GetRandomDecimal1(); var valuelist = Points.ToList(); valuelist.Add(new PUChartPoint() { Value = value, ValueTip = (value * 10).ToString("f2"), }); Points = new ObservableCollection(valuelist); } } public void ChangeColor() { switch (_currentColor) { case 0: GridBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AA49A9C0")); AreaBrush = new LinearGradientBrush(new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#AA49A9C0"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#5549A9C0"), Offset = 1 } }, 90); LineBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#49A9C0")); _currentColor = 1; break; case 1: GridBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AAF4A758")); AreaBrush = new LinearGradientBrush(new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#AAF4A758"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#55F4A758"), Offset = 1 } }, 90); LineBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F4A758")); _currentColor = 2; break; case 2: GridBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AAE089B8")); AreaBrush = new LinearGradientBrush(new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#AAE089B8"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#55E089B8"), Offset = 1 } }, 90); LineBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E089B8")); _currentColor = 3; break; case 3: GridBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AAAAAAAA")); AreaBrush = new LinearGradientBrush(new GradientStopCollection() { new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#AAAAAAAA"), Offset = 0 }, new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#55DDDDDD"), Offset = 1 } }, 90); LineBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AAAAAA")); _currentColor = 0; break; } } #endregion #region Function Random _rand; private double GetRandomDecimal1() { if (_rand == null) _rand = new Random(DateTime.Now.Millisecond); return _rand.NextDouble(); } private double GetRandomDecimal2() { var array = new double[6] { 0, 0.2, 0.4, 0.6, 0.8, 1 }; if (_rand == null) _rand = new Random(DateTime.Now.Millisecond); return array[_rand.Next(0, 6)]; } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/ListBoxsViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class ListBoxsViewModel : Screen, IShell { private PUListBox _listBox; public void Search(string contentWord) { _listBox.SearchItemByContent(contentWord, true); } // 作为Value实现精准查询 //public void Search(object contentWord) //{ // _listBox.SearchItemByValue(contentWord); //} public void ListBoxLoaded(object sender) { _listBox = sender as PUListBox; } } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/PagingNavsViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class PagingNavsViewModel : Screen, IShell { public int TotalPage { get { return _totalPage; } set { _totalPage = value; NotifyOfPropertyChange(() => TotalPage); } } private int _totalPage = 10; public int CurrentPage { get { return _currentPage; } set { _currentPage = value; NotifyOfPropertyChange(() => CurrentPage); } } private int _currentPage = 1; } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/PasswordBoxsViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class PasswordBoxsViewModel : Screen, IShell { public string Password { get { return _password; } set { _password = value; NotifyOfPropertyChange(() => Password); } } private string _password = "12345"; public string Password2 { get { return _password2; } set { _password2 = value; NotifyOfPropertyChange(() => Password2); } } private string _password2 = "54321"; } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/ProgressBarsViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class ProgressBarsViewModel : Screen, IShell { } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/RadioButtonsViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class RadioButtonsViewModel : Screen, IShell { } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/SlidersViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class SlidersViewModel : Screen, IShell { public int Value { get { return _value; } set { _value = value; NotifyOfPropertyChange(() => Value); } } private int _value = 30; } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/SpecialViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class SpecialViewModel : Screen, IShell { public bool IsRunning { get { return _isRunning; } set { _isRunning = value; NotifyOfPropertyChange(() => IsRunning); } } private bool _isRunning = true; public void Switch() { IsRunning = !IsRunning; } } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/TabControlsViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class TabControlsViewModel : Screen, IShell { public TabControlsViewModel() { var list = new List(); list.Add(new PUTabItemModel() { Header = "Test1", Icon = "", CanDelete = false, Content = "1", Value = 1.1, }); list.Add(new PUTabItemModel() { Header = "Test2", Icon= "", CanDelete = true, Content = "2", Value = 2.2, }); list.Add(new PUTabItemModel() { Header = "Test3", Icon= "", CanDelete = false, Content = "3", Value = 3.3, }); TabItemList = new BindableCollection(list); } public BindableCollection TabItemList { get { return _tabItemList; } set { _tabItemList = value; NotifyOfPropertyChange(() => TabItemList); } } private BindableCollection _tabItemList; } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/TextBoxsViewModel.cs ================================================ using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Panuon.UIBrowser.ViewModels.Partial { public class TextBoxsViewModel : Screen, IShell { public string Password { get { return _password; } set { _password = value; NotifyOfPropertyChange(() => Password); } } private string _password = "12345"; } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/TreeViewsViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using static Panuon.UI.PUTreeView; namespace Panuon.UIBrowser.ViewModels.Partial { public class TreeViewsViewModel : Screen, IShell { public TreeViewsViewModel() { TreeViewItems = new ObservableCollection(); LoadTreeView(); } #region Binding public ObservableCollection TreeViewItems { get { return _treeViewItems; } set { _treeViewItems = value; NotifyOfPropertyChange(() => TreeViewItems); } } private ObservableCollection _treeViewItems; public object ChoosedHeader { get { return _choosedHeader; } set { _choosedHeader = value; NotifyOfPropertyChange(() => ChoosedHeader); } } private object _choosedHeader; public object ChoosedValue { get { return _choosedValue; } set { _choosedValue = value; NotifyOfPropertyChange(() => ChoosedValue); } } private object _choosedValue; public TreeViewStyles TreeViewStyle { get { return _treeViewStyle; } set { _treeViewStyle = value; NotifyOfPropertyChange(() => TreeViewStyle); } } private TreeViewStyles _treeViewStyle= TreeViewStyles.General; #endregion #region Event public void ChoosedItemChanged(RoutedPropertyChangedEventArgs e) { var choosedItem = e.NewValue; if(choosedItem != null) ChoosedHeader = choosedItem.Header; } #endregion #region Function public void LoadTreeView() { TreeViewItems.Add(new PUTreeViewItemModel() { Header = "第一章", Value = "1", Items = new List() { new PUTreeViewItemModel() { Header = "第一节", Value = "1.1", }, new PUTreeViewItemModel() { Header = "第二节", Value = "1.2", }, }, }); TreeViewItems.Add(new PUTreeViewItemModel() { Header = "第二章", Value = "2", Items = new List() { new PUTreeViewItemModel() { Header = "第一节", Value ="2.1", }, new PUTreeViewItemModel() { Header = "第二节", Value = "2.2", }, }, }); TreeViewItems.Add(new PUTreeViewItemModel() { Header = "第三章", Value = "3", Items = new List() { new PUTreeViewItemModel() { Header = "第一节", Value = "3.1", }, new PUTreeViewItemModel() { Header = "第二节", Value = "3.2", }, }, }); NotifyOfPropertyChange(() => TreeViewItems); } public void SelectionChanged(SelectionChangedEventArgs e) { var comboBoxItem = e.AddedItems[0] as PUComboBoxItem; switch (comboBoxItem.Value.ToString()) { case "1": TreeViewStyle = TreeViewStyles.General; break; case "2": TreeViewStyle = TreeViewStyles.Classic; break; } } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/UtilsViewModel.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/5 17:49:13 *说明: *日志:2018/11/5 17:49:13 创建。 *==============================================================*/ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Collections.Generic; using System.Linq; using System.Text; using Panuon.UI; using Panuon.UI.Utils; using System.Threading.Tasks; using System.Threading; using Caliburn.Micro; using System.Collections.Concurrent; namespace Panuon.UIBrowser.ViewModels.Partial { public class UtilsViewModel : Screen,IShell { private PUListBox _listbox; private ConcurrentBag _cancellatonBag; public UtilsViewModel() { _cancellatonBag = new ConcurrentBag(); MaxTaskQuantity = 1; } #region Binding public int MaxTaskQuantity { get { return _maxTaskQuantity; } set { _maxTaskQuantity = value; TaskPoll.MaxTaskQuantity = value; NotifyOfPropertyChange(() => MaxTaskQuantity); } } private int _maxTaskQuantity; #endregion #region Event public void ListBoxLoaded(object sender) { _listbox = sender as PUListBox; } public void Clear() { foreach(var cts in _cancellatonBag) { cts.Cancel(); } _cancellatonBag = new ConcurrentBag(); _listbox.Items.Clear(); } public void AddTask() { var cts = new CancellationTokenSource(); var pgb = new PUProgressBar() { Height = 30, Width = 200 }; var task = new Task(() => { for (int i = 0; i < 10; i++) { if (cts.Token.IsCancellationRequested) return; App.Current.Dispatcher.Invoke(new System.Action(() => { pgb.Percent += 0.1; })); Thread.Sleep(1000); } }, cts.Token); _listbox.Items.Add(new PUListBoxItem() { Height = 40, VerticalContentAlignment = VerticalAlignment.Center, Content = pgb, }); _cancellatonBag.Add(cts); TaskPoll.StartNew(task); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Partial/WindowsViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Views.Partial; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Panuon.UIBrowser.ViewModels.Partial { public class WindowsViewModel : Screen, IShell { public void OpenDialog(string type) { switch (type) { case "scale": PUMessageBox.ShowDialog("这是一个PUMessageBox对话框。"); return; case "gradual": PUMessageBox.ShowDialog("这是一个PUMessageBox对话框。", "提示", true, UI.PUWindow.AnimationStyles.Gradual); return; case "fade": PUMessageBox.ShowDialog("这是一个PUMessageBox对话框。", "提示", true, UI.PUWindow.AnimationStyles.Fade); return; } } public void ShowAwait() { var parent = Parent as MainWindowViewModel; parent.ShowAwait(); var task = new Task(() => { Thread.Sleep(2000); App.Current.Dispatcher.BeginInvoke(new System.Action(() => { parent.CloseAwait(); })); }); task.Start(); } } } ================================================ FILE: Panuon.UIBrowser/ViewModels/ShellWindowViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UI.Utils; using System; using System.ComponentModel.Composition; using System.Windows; using System.Windows.Threading; namespace Panuon.UIBrowser.ViewModels { [Export(typeof(IShell))] public class ShellWindowViewModel : Conductor.Collection.OneActive, IShell { #region Identity private PUWindow CurrentWindow { get { if (_currentWindow == null) _currentWindow = (GetView()) as PUWindow; return _currentWindow; } } private PUWindow _currentWindow; private IWindowManager _windowManager; #endregion #region Constructor [ImportingConstructor] public ShellWindowViewModel(IWindowManager windowManager) { _windowManager = windowManager; } public void BtnTest() { ChoosedValue = "1234"; } #endregion #region Bindings public string ChoosedValue { get { return _choosedValue; } set { _choosedValue = value; UpdateActivePage(); NotifyOfPropertyChange(() => ChoosedValue); } } private string _choosedValue; #endregion #region Event public void UpdateActivePage() { switch (ChoosedValue) { case "Overview": ActivateItem(new OverviewViewModel(_windowManager)); break; case "Window": ActivateItem(new Control.WindowViewModel(_windowManager)); break; case "Button": ActivateItem(new Control.ButtonViewModel(_windowManager)); break; case "TextBox": ActivateItem(new Control.TextBoxViewModel(_windowManager)); break; case "PasswordBox": ActivateItem(new Control.PasswordBoxViewModel(_windowManager)); break; case "ComboBox": ActivateItem(new Control.ComboBoxViewModel(_windowManager)); break; case "CheckBox": ActivateItem(new Control.CheckBoxViewModel(_windowManager)); break; case "RadioButton": ActivateItem(new Control.RadioButtonViewModel(_windowManager)); break; case "ProgressBar": ActivateItem(new Control.ProgressBarViewModel(_windowManager)); break; case "TreeView": ActivateItem(new Control.TreeViewViewModel(_windowManager)); break; case "TabControl": ActivateItem(new Control.TabControlViewModel(_windowManager)); break; case "DatePicker": ActivateItem(new Control.DatePickerViewModel(_windowManager)); break; case "ListBox": ActivateItem(new Control.ListBoxViewModel(_windowManager)); break; case "Slider": ActivateItem(new Control.SliderViewModel(_windowManager)); break; case "ContextMenu": ActivateItem(new Control.ContextMenuViewModel(_windowManager)); break; case "PagingNav": ActivateItem(new Special.PagingNavViewModel(_windowManager)); break; case "ResizeGrid": ActivateItem(new Special.ResizeGridViewModel(_windowManager)); break; case "Bubble": ActivateItem(new Special.BubbleViewModel(_windowManager)); break; case "Loading": ActivateItem(new Special.LoadingViewModel(_windowManager)); break; case "SplitLine": ActivateItem(new Special.SplitLineViewModel(_windowManager)); break; case "ImageCuter": ActivateItem(new Special.ImageCuterViewModel(_windowManager)); break; case "DropDown": ActivateItem(new Special.DropDownViewModel(_windowManager)); break; case "LineChart": ActivateItem(new Chart.LineChartViewModel(_windowManager)); break; } } #endregion #region Function #endregion #region APIs public Window GetCurrentWindow() { return GetView() as Window; } /// /// 打开等待控件。 /// public void ShowAwait() { CurrentWindow.IsAwaitShow = true; } /// /// 关闭等待控件。 /// public void CloseAwait() { CurrentWindow.IsAwaitShow = false; } /// /// 打开遮罩层。 /// public void ShowCoverMask() { CurrentWindow.IsCoverMaskShow = true; } /// /// 关闭遮罩层。 /// public void CloseCoverMask() { CurrentWindow.IsCoverMaskShow = false; } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Special/BubbleViewModel.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/15 13:12:35 *说明: 样板。 *日志:2018/11/15 13:12:35 创建。 *==============================================================*/ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Special { public class BubbleViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public BubbleViewModel(IWindowManager windowManager) { _windowManager = windowManager; RadiusInteger = 3; Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#666666")); CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#555555")); AnglePosition = AnglePositions.Left; Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection AnnotationList { get { return _annotationList; } set { _annotationList = value; NotifyOfPropertyChange(() => AnnotationList); } } private ObservableCollection _annotationList; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; BorderCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public AnglePositions AnglePosition { get { return _anglePosition; } set { _anglePosition = value; NotifyOfPropertyChange(() => AnglePosition); } } private AnglePositions _anglePosition; public CornerRadius BorderCornerRadius { get { return _borderCornerRadius; } set { _borderCornerRadius = value; NotifyOfPropertyChange(() => BorderCornerRadius); } } private CornerRadius _borderCornerRadius; public Brush Background { get { return _background; } set { _background = value; NotifyOfPropertyChange(() => Background); } } private Brush _background; public Brush CoverBrush { get { return _coverBrush; } set { _coverBrush = value; NotifyOfPropertyChange(() => CoverBrush); } } private Brush _coverBrush; #endregion #region Event public void AnglePositionChanged(string content) { AnglePosition = (AnglePositions)Enum.Parse(typeof(AnglePositions), content); } public void BackgroundChanged(string content) { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void CoverBrushChanged(string content) { CoverBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } #endregion #region Function public async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "AnglePosition" ,Type = "AnglePositions枚举" ,Description = "获取或设置气泡的尖角位置。【可选值:Left、BottomLeft、BottomCenter、BottomRight、Right】",DefaultValue = "Left" }, new DataSourceModel() { Name = "BorderCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置气泡的圆角大小。",DefaultValue = "0" }, new DataSourceModel() { Name = "CoverBrush" ,Type = "Brush" ,Description = "获取或设置鼠标悬浮时遮罩层的背景颜色。",DefaultValue = "#555555" }, }; AnnotationList = new ObservableCollection() { new DataSourceModel() { Name = "哪些属性会影响气泡的颜色?" ,Description = "气泡的边框受BorderBrush和BorderThickness影响,背景色受Background影响,前景色受Foreground影响。" }, }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Special/DropDownViewModel.cs ================================================ using Caliburn.Micro; using Microsoft.Win32; using Panuon.UI; using System; using System.IO; using System.Windows; using System.Windows.Controls; using System.Windows.Media.Imaging; namespace Panuon.UIBrowser.ViewModels.Special { public class DropDownViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public DropDownViewModel(IWindowManager windowManager) { _windowManager = windowManager; } #endregion #region Binding #endregion #region Event #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Special/ImageCuterViewModel.cs ================================================ using Caliburn.Micro; using Microsoft.Win32; using Panuon.UI; using System; using System.IO; using System.Windows; using System.Windows.Controls; using System.Windows.Media.Imaging; namespace Panuon.UIBrowser.ViewModels.Special { public class ImageCuterViewModel : Screen, IShell { #region Identity private PUImageCuter _cuter; private Image _image; private IWindowManager _windowManager; #endregion #region Constructor public ImageCuterViewModel(IWindowManager windowManager) { _windowManager = windowManager; } #endregion #region Binding public BitmapImage ImageSource { get { return _imageSource; } set { _imageSource = value; NotifyOfPropertyChange(() => ImageSource); } } private BitmapImage _imageSource; public BitmapImage CutImageSource { get { return _cutImageSource; } set { _cutImageSource = value; NotifyOfPropertyChange(() => CutImageSource); } } private BitmapImage _cutImageSource; #endregion #region Event public void BtnSelectFile() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "图像文件|*.jpg;*.png;*.jpeg;*.bmp"; if (ofd.ShowDialog() != true) return; var file = ofd.FileName; ImageSource = new BitmapImage(new Uri(file)); } public void ImageCuterLoaded(object sender) { _cuter = sender as PUImageCuter; } public void ImageLoaded(object sender) { _image = sender as Image; } public void BtnCut() { if (_cuter.GetCutedImage() == null) { PUMessageBox.ShowDialog("没有图片源。"); return; } _image.Source = _cuter.GetCutedImage(); } public void SelectionChanged(object sender) { var comboBox = sender as PUComboBox; switch (comboBox.SelectedValue as string) { case "Rectangle": _cuter.ImageType = ImageType.Rectangle; return; case "Square": _cuter.ImageType = ImageType.Square; return; } } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Special/LoadingViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UIBrowser.Models; using System.Collections.ObjectModel; using System.Threading.Tasks; namespace Panuon.UIBrowser.ViewModels.Special { public class LoadingViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public LoadingViewModel(IWindowManager windowManager) { _windowManager = windowManager; Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; #endregion #region Function public async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "IsRunning" ,Type = "Boolean" ,Description = "获取或设置等待控件的运行状态",DefaultValue = "False" }, }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Special/PagingNavViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UI; using Panuon.UIBrowser.Models; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace Panuon.UIBrowser.ViewModels.Special { public class PagingNavViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public PagingNavViewModel(IWindowManager windowManager) { _windowManager = windowManager; RadiusInteger = 3; CurrentPage = 1; TotalPage = 10; SelectedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3E3E3E")); ButtonBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AA3E3E3E")); Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; public ObservableCollection EventList { get { return _eventList; } set { _eventList = value; NotifyOfPropertyChange(() => EventList); } } private ObservableCollection _eventList; public int RadiusInteger { get { return _radiusInteger; } set { _radiusInteger = value; ButtonCornerRadius = new CornerRadius(value); NotifyOfPropertyChange(() => RadiusInteger); } } private int _radiusInteger; public int TotalPage { get { return _totalPage; } set { _totalPage = value; NotifyOfPropertyChange(() => TotalPage); } } private int _totalPage; public int CurrentPage { get { return _currentPage; } set { _currentPage = value; NotifyOfPropertyChange(() => CurrentPage); } } private int _currentPage; public CornerRadius ButtonCornerRadius { get { return _buttonCornerRadius; } set { _buttonCornerRadius = value; NotifyOfPropertyChange(() => ButtonCornerRadius); } } private CornerRadius _buttonCornerRadius; public Brush SelectedBrush { get { return _selectedBrush; } set { _selectedBrush = value; NotifyOfPropertyChange(() => SelectedBrush); } } private Brush _selectedBrush; public Brush ButtonBrush { get { return _buttonBrush; } set { _buttonBrush = value; NotifyOfPropertyChange(() => ButtonBrush); } } private Brush _buttonBrush; #endregion #region Event /// /// 阻止滚轮事件传播给DataGrid。 /// public void HandleMouseWheel(object sender, MouseWheelEventArgs e) { var scv = (ScrollViewer)sender; scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); e.Handled = true; } public void SelectedBrushChanged(string content) { SelectedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } public void ButtonBrushChanged(string content) { ButtonBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(content)); } #endregion #region Function private async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "TotalPage" ,Type = "Int" ,Description = "获取或设置当前的总页数。",DefaultValue = "1" }, new DataSourceModel() { Name = "CurrentPage" ,Type = "Int" ,Description = "获取或设置当前的页码。",DefaultValue = "1" }, new DataSourceModel() { Name = "ButtonBrush" ,Type = "Brush" ,Description = "获取或设置按钮的背景颜色。",DefaultValue = "#AA3E3E3E" }, new DataSourceModel() { Name = "SelectedBrush" ,Type = "Brush" ,Description = "获取或设置按钮被选中或点击时的颜色。",DefaultValue = "#3E3E3E" }, new DataSourceModel() { Name = "ButtonCornerRadius" ,Type = "CornerRadius" ,Description = "获取或设置按钮的圆角大小。",DefaultValue = "3" }, new DataSourceModel() { Name = "IsSideButtonShow" ,Type = "Boolean" ,Description = "获取或设置左右两侧的翻页按钮是否显示。",DefaultValue = "True" }, }; EventList = new ObservableCollection() { new DataSourceModel() { Name = "CurrentPageChanged" ,Description = "当CurrentPage(当前页码)属性发生变化时,触发此事件。事件参数:Percent属性值。" }, }; } private void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } private void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Special/ResizeGridViewModel.cs ================================================ using Caliburn.Micro; namespace Panuon.UIBrowser.ViewModels.Special { public class ResizeGridViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public ResizeGridViewModel(IWindowManager windowManager) { _windowManager = windowManager; } #endregion } } ================================================ FILE: Panuon.UIBrowser/ViewModels/Special/SplitLineViewModel.cs ================================================ using Caliburn.Micro; using Panuon.UIBrowser.Models; using System.Collections.ObjectModel; using System.Threading.Tasks; namespace Panuon.UIBrowser.ViewModels.Special { public class SplitLineViewModel : Screen, IShell { #region Identity private IWindowManager _windowManager; #endregion #region Constructor public SplitLineViewModel(IWindowManager windowManager) { _windowManager = windowManager; Init(); } #endregion #region Bindings public ObservableCollection DependencyPropertyList { get { return _dependencyPropertyList; } set { _dependencyPropertyList = value; NotifyOfPropertyChange(() => DependencyPropertyList); } } private ObservableCollection _dependencyPropertyList; #endregion #region Function public async void Init() { await Task.Delay(100); DependencyPropertyList = new ObservableCollection() { new DataSourceModel() { Name = "Alignment" ,Type = "Alignments枚举" ,Description = "获取或设置分割线的位置。【可选项:Left、Top、Bottom、Right】",DefaultValue = "Top" }, }; } public void SetMaskCover(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowCoverMask(); else parent.CloseCoverMask(); } public void SetAwait(bool toOpen) { var parent = Parent as ShellWindowViewModel; if (toOpen) parent.ShowAwait(); else parent.CloseAwait(); } #endregion } } ================================================ FILE: Panuon.UIBrowser/Views/Chart/LineChartView.xaml ================================================  PULineChart 折线图 依赖属性概览 注解 PUButton 按钮示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/ButtonView.xaml ================================================  PUButton 按钮 依赖属性概览 注解 PUButton 按钮示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/CheckBoxView.xaml ================================================  PUCheckBox 复选框 依赖属性概览 注解 PUCheckBox 复选框示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/ComboBoxView.xaml ================================================  PUComboBox / PUComboBoxItem 下拉选择框 PUComboBox依赖属性概览 PUComboBoxItem依赖属性概览 注解 PUComboBox下拉框示例(使用BindingItems属性) 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/ContextMenuView.xaml ================================================  PUContextMenu 右键菜单 依赖属性概览 注解 PUContextMenu 右键菜单示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/DatePickerView.xaml ================================================  PUDatePicker 日期时间选择器 PUDatePicker依赖属性概览 注解 PUDatePicker日期时间选择器示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/Examples/ChatWindow.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Controls/Examples/ChatWindow.xaml.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/16 14:51:55 *说明: *日志:2018/11/16 14:51:55 创建。 *==============================================================*/ using Panuon.UI; using System; using System.Threading; using System.Threading.Tasks; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; namespace Panuon.UIBrowser.Views.Control.Examples { /// /// ChatWindow.xaml 的交互逻辑 /// public partial class ChatWindow : PUWindow { #region Identity private double _height = 40; #endregion public ChatWindow() { InitializeComponent(); Init(); } #region Event private async void btnSend_Click(object sender, System.Windows.RoutedEventArgs e) { if (tbInput.Text == "") return; stkMain.Children.Add(GetBubbleGrid(tbInput.Text)); tbInput.Text = ""; await Task.Delay(500); stkMain.Children.Add(GetBubbleGrid("❤爱你哟!", true, true)); svMain.ScrollToBottom(); } private void btnClose_Click(object sender, System.Windows.RoutedEventArgs e) { Close(); } #endregion #region Function public void Init() { stkMain.Children.Add(GetBubbleGrid("欢迎使用PanuonUI !", true, true)); } private Grid GetBubbleGrid(string content, bool isTopOne = false, bool isSystemMsg = false) { var grd = new Grid() { Margin = isTopOne ? new System.Windows.Thickness(0, 20, 0, 0) : new System.Windows.Thickness(0, 10, 0, 0), MinHeight = _height, Opacity = 0, }; var img = new Image() { Source = new BitmapImage(new Uri("pack://application:,,,/Panuon.UIBrowser;component/Resources/head_img.jpg")), Height = _height - 10, Width = _height - 10, VerticalAlignment = System.Windows.VerticalAlignment.Center, HorizontalAlignment = isSystemMsg ? System.Windows.HorizontalAlignment.Left : System.Windows.HorizontalAlignment.Right, Margin = isSystemMsg ? new System.Windows.Thickness(5, 0, 0, 0) : new System.Windows.Thickness(0, 0, 10, 0), }; grd.Children.Add(img); var text = new TextBlock() { TextWrapping = System.Windows.TextWrapping.Wrap, Text = content, VerticalAlignment = System.Windows.VerticalAlignment.Center, }; var bubble = new PUBubble() { Margin = isSystemMsg ? new System.Windows.Thickness(_height + 5, 0, 0, 0) : new System.Windows.Thickness(0, 0, _height + 10, 0), AnglePosition = isSystemMsg ? AnglePositions.Left : AnglePositions.Right, Content = text, MinHeight = _height - 6, BorderCornerRadius = new System.Windows.CornerRadius(3), HorizontalAlignment = isSystemMsg ? System.Windows.HorizontalAlignment.Left : System.Windows.HorizontalAlignment.Right, VerticalAlignment = System.Windows.VerticalAlignment.Center, Background = new SolidColorBrush(((Color)ColorConverter.ConvertFromString("#FF49A9C0"))), CoverBrush = new SolidColorBrush(((Color)ColorConverter.ConvertFromString("#CC49A9C0"))), Padding = new System.Windows.Thickness(10, 0, 10, 0), }; grd.Children.Add(bubble); var anima = new DoubleAnimation() { To = 1, Duration = TimeSpan.FromSeconds(0.4), }; var anima2 = new ThicknessAnimation() { To = isTopOne ? new System.Windows.Thickness(0, 10, 0, 0) : new System.Windows.Thickness(0, 0, 0, 0), Duration = TimeSpan.FromSeconds(0.2), }; grd.BeginAnimation(OpacityProperty, anima); grd.BeginAnimation(MarginProperty, anima2); return grd; } #endregion } } ================================================ FILE: Panuon.UIBrowser/Views/Controls/Examples/LoginWindow.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Controls/Examples/LoginWindow.xaml.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/16 14:11:41 *说明: *日志:2018/11/16 14:11:41 创建。 *==============================================================*/ using Panuon.UI; using System.Windows; namespace Panuon.UIBrowser.Views.Control.Examples { /// /// LoginWindow.xaml 的交互逻辑 /// public partial class LoginWindow : PUWindow { public LoginWindow() { InitializeComponent(); } private void Login_Click(object sender, RoutedEventArgs e) { Close(); } } } ================================================ FILE: Panuon.UIBrowser/Views/Controls/Examples/MultiNavWindow.xaml ================================================  注意看右上角的按钮组,试试点击 ================================================ FILE: Panuon.UIBrowser/Views/Controls/Examples/MultiNavWindow.xaml.cs ================================================ /*============================================================== *作者:ZEOUN *时间:2018/11/16 9:32:52 *说明: *日志:2018/11/16 9:32:52 创建。 *==============================================================*/ using Panuon.UI; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Panuon.UIBrowser.Views.Control.Examples { /// /// MultiNavWindow.xaml 的交互逻辑 /// public partial class MultiNavWindow : PUWindow { public MultiNavWindow() { InitializeComponent(); LoadNavButtons(); Result = 0; } #region Event public void LoadNavButtons() { var lbl1 = new TextBlock() { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Text = "", FontFamily = FindResource("IconFont") as FontFamily, }; var lbl2 = new TextBlock() { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Text = "", FontFamily = FindResource("IconFont") as FontFamily, }; AppendNavButton("H", new RoutedEventHandler((s, e) => { PUMessageBox.ShowDialog("你点击了第三个按钮!"); Result = 3; })); AppendNavButton(lbl1, new RoutedEventHandler((s, e) => { PUMessageBox.ShowDialog("你点击了第二个按钮!"); Result = 2; })); AppendNavButton(lbl2, new RoutedEventHandler((s, e) => { PUMessageBox.ShowDialog("你点击了第一个按钮!"); Result = 1; })); } #endregion } } ================================================ FILE: Panuon.UIBrowser/Views/Controls/ListBoxView.xaml ================================================  PUListBox / PUListBoxItem 列表 PUListBox依赖属性概览 PUListBoxItem依赖属性概览 PUListBox方法 PUListBoxItem事件 注解 PUListBox列表示例(使用BindingItems属性) 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/PasswordBoxView.xaml ================================================  PUPasswordBox 密码框 依赖属性概览 注解 PUPasswordBox 密码框示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/ProgressBarView.xaml ================================================  PUProgressBar 进度条 依赖属性概览 事件 注解 PUProgressBar 进度条 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/RadioButtonView.xaml ================================================  PURadioButton 单选按钮 依赖属性概览 PURadioButton 单选按钮示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/SliderView.xaml ================================================  PUSlider 滑块 依赖属性概览 注解 PUSlider滑块示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/TabControlView.xaml ================================================  PUTabControl / PUTabItem 选项卡 TabControl依赖属性概览 TabItem依赖属性概览 注解 PUTabControl选项卡示例(使用BindingItems属性) 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/TextBoxView.xaml ================================================  PUTextBox 文本框 依赖属性概览 注解 PUTextBox 文本框示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/TreeViewView.xaml ================================================  PUTreeView / PUTreeViewItem 树视图 PUTreeView依赖属性概览 PUTreeViewItem依赖属性概览 注解 PUTreeView树视图示例(使用BindingItems属性) 实例 ================================================ FILE: Panuon.UIBrowser/Views/Controls/WindowView.xaml ================================================  PUWindow 窗体 依赖属性概览 方法概览 注解 PUWindow 窗体示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/MainWindowView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/OverviewView.xaml ================================================  Ovewview 总览 *拖动滑块以改变当前页面的主题色 ================================================ FILE: Panuon.UIBrowser/Views/Partial/BubblesView.xaml ================================================  CoverBrush 获取或设置当鼠标悬浮在气泡上时,气泡应呈现的背景色。【Brush类型】。默认值为#555555。 AnglePosition 获取或设置尖角的位置,默认为左侧。【AnglePositions枚举类型】。默认值为Left。 BorderCornerRadius 获取或设置气泡的圆角大小。【CornerRadius类型】。默认值为0。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/ButtonsView.xaml ================================================  ButtonStyle 获取或设置按钮的基本样式。【ButtonStyles枚举类型】可选项为:General、Hollow、Outline、Link。默认值为General。 ClickStyle 获取或设置鼠标点击时按钮的效果。【ClickStyles类型】可选项为Classic、Sink。默认值为Classic。 BorderCornerRadius 获取或设置按钮的圆角大小。【CornerRadius类型】。默认值为0。 CoverBrush 获取或设置鼠标悬浮时按钮的背景颜色(General和Hollow样式时)或前景颜色(Outline和Link样式时)。【Brush类型】。默认值为#FFFFFF(作为背景颜色时)或#3E3E3E(作为前景颜色时)。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/CheckBoxsView.xaml ================================================  CheckBoxStyle 获取或设置复选框的基本样式。【CheckBoxStyles枚举类型】可选项为:General、Switch、Branch。默认值为General。 BorderCornerRadius 获取或设置复选框的圆角大小。【CornerRadius类型】。默认值为0。 CoverBrush 获取或设置当复选框被选中时,对号的前景色(General样式时)或开关背景色(Switch样式)或侧边填充色(Branch样式时)(General和Hollow样式时)或前景颜色(Outline和Link样式时)。【Brush类型】。默认值为#3E3E3E(General或Branch样式时)或LightGray(Switch样式时)。 InnerWidth 获取或设置内部选择框的宽度。【Double类型】。默认值为20或30(Switch样式)。 InnerHeight 获取或设置内部选择框的高度。【Double类型】可选项为Classic、Sink。默认值为Classic。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/ComboBoxsView.xaml ================================================  PUComboBoxItem DeleteButtonVisibility 获取或设置下拉选择项后侧删除按钮的显示状态。【Visibility类型】。默认值为Collpased。 Value 获取或设置下拉选择项可以携带的值,仅用于标记该子项的实际内容,不会对前端显示造成影响。【Object类型】。默认值为空。 PUComboBoxItemModel 用于绑定到PUComboBox子项集合的模型类,参见PUComboBox的BindingItems属性。 PUComboBox BorderCornerRadius 获取或设置下拉框的圆角大小。【CornerRadius类型】。默认值为0。 ShadowColor 获取或设置下拉框激活时阴影的颜色。【Color类型】。默认值为#88888 CoverBrush 获取或设置鼠标悬浮时下拉选择项的背景颜色。【Brush类型】。默认值为#EEEEEE。 SelectedBrush 获取或设置下拉选择项被选中时的背景颜色。【Brush类型】。默认值为#DDDDDD。 DeleteMode 获取或设置当用户点击下拉框子项的删除按钮时,应该执行的操作。【DeleteModes枚举类型】可选项为Delete、EventOnly。默认值为Delete(删除项目并触发DeleteItem路由事件)。 BindingItems 获取或设置绑定对象模板,通过该属性可以将内容绑定到Model类集合,而不是UI对象集合。【<PUComboBoxItemModel>集合】。默认值为空。 SelectedValuePath 获取或设置当子项目被选中时,SelectedValue应呈现子项PUComboBoxItem的哪一个值。【SelectedValuePaths枚举类型】可选项为:Header、Value。默认值为Header。 SelectedValue 获取被选中的子项PUComboBoxItem的Header或Value属性(取决于SelectedValuePath的值),或通过设置该值来选中指定的子项目。【Object类型】。默认值为空。 DeleteItem 当用户点击子项PUComboBoxItem的删除按钮时,触发此路由事件。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/ContextMenusView.xaml ================================================  PUContextMenuItem Value 获取或设置子项可以携带的值,仅用于标记该子项的实际内容,不会对前端显示造成影响。【Object类型】。默认值为空。 PUContextMenu CoverBrush 获取或设置鼠标悬浮时子项的背景颜色。【Brush类型】。默认值为#33AAAAAA。 BorderCornerRadius 获取或设置边框圆角大小。【CornerRadius类型】。默认值为0。 ShadowColor 获取或设置边框的阴影颜色。【Color类型】。默认值为#44444444。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/DataGridsView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Partial/DatePickersView.xaml ================================================  CoverBrush 获取或设置主题颜色。【Brush类型】。默认值为#3E3E3E。 MaxDateTime 获取或设置可以选择的最大日期,不能限制时间。【DateTime?类型】。默认值为Null。 MinDateTime 获取或设置可以选择的最小日期,不能限制时间。【DateTime?类型】。默认值为Null。 SelectedDateTime 获取或设置当前选中的日期和时间。【DateTime类型】。默认值为当天的0时0分0秒。 DatePickerMode 获取或设置日期选择器的模式。【DatePickerModes枚举类型】可选项为DateTime、DateOnly、TimeOnly。默认值为DateTime。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/HelpersView.xaml ================================================  栅格 仅适用于单行或单列元素。通过简单配值来设置父容器(必须是Grid)的 RowDefinition或ColomnDefinition。若没有在设计器中立即生效,请重新生成当前项目。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/ImageCuterView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Partial/IntroductionView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Partial/LineChartsView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Partial/ListBoxsView.xaml ================================================  PUListBoxItem Value 获取或设置子项可以携带的值,仅用于标记该子项的实际内容,不会对前端显示造成影响。【Object类型】。默认值为空。 PUListBox CoverBrush 获取或设置鼠标悬浮时子项的背景颜色。【Brush类型】。默认值为#22E6E6E6。 SelectedBrush 获取或设置子项被选中时的背景颜色。【Brush类型】。默认值为#E6E6E6。 SearchBrush 获取或设置当子项被搜索到时展现1秒的背景颜色。【Brush类型】。默认值为#44444444。 SearchItemByContent(string content, bool allowFuzzySearch) 通过内容查找符合条件的第一个子项,滚动到该项目并高亮(内容必须是String类型才能调用该方法,支持模糊查询)。 SearchItemByValue(object value) 通过Value查找符合条件的第一个子项,滚动到该项目并高亮。 GetListBoxItemByContent(object content) 通过内容查找并返回符合条件的第一个子项。 GetListBoxItemByValue(object value) 通过Value查找并返回符合条件的第一个子项。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/PagingNavsView.xaml ================================================  TotalPage 获取或设置分页器的总页数。【Int类型】。默认值为1。 CurrnetPage 获取或设置分页器的当前页码。【Int类型】。默认值为1。 ButtonCornerRadius 获取或设置分页器的按钮圆角大小。【CornerRadius类型】。默认值为3。 ButtonBrush 获取或设置分页器的按钮背景色。【Brush类型】。默认值#AA3E3E3E。 SelectedBrush 获取或设置按钮被选中或点击时的颜色。【Brush类型】。默认值#3E3E3E。 IsSideButtonShow 获取或设置两侧的按钮是否显示。【Boolean类型】。默认值True。 CurrentPageChanged 当前页码发生改变时,触发此路由事件。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/PasswordBoxsView.xaml ================================================  "警告:此控件是从TextBox派生的(PasswordBox是一个密封类,无法继承),这意味着它无法在装有恶意软件的计算机上保证密码安全(某些恶意软件可以通过内存读取密码)。如果对密码安全有较高的需求(例如金融行业),切勿使用此控件。" PasswordBoxStyle 获取或设置密码框的基本样式。【PasswordBoxStyles枚举类型】可选项为:General、IconGroup。默认值为General。 BorderCornerRadius 获取或设置密码框的圆角大小。【CornerRadius类型】。默认值为0。 PasswordChar 获取或设置密码框的密码掩饰符。【Char类型】。默认值为'●'。 Password 获取或设置密码框的密码。请勿直接对Text属性进行操作。【String类型】。默认值为空。 ShadowColor 获取或设置密码框获得焦点时的阴影颜色。【Color类型】。默认值为#888888。 Watermark 获取或设置密码框的水印。【String类型】。默认值为空。 Icon 获取或设置密码框的前置图标,仅在IconGroup样式下生效。【Object类型】。默认值为空。 IconWidth 获取或设置密码框前置图标的宽度,仅在IconGroup样式下生效。【Double类型】。默认值为30。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/ProgressBarsView.xaml ================================================  ProgressBarStyles 获取或设置进度条的基础样式。【ProgressBarStyles枚举类型】可选项为General、Ring。默认值为General。 CoverBrush 获取或设置进度条的填充颜色。【Brush类型】。默认值为灰黑色。 AnimationDuration 获取或设置当百分比改变时渐进或渐退动画的持续时间。【TimeSpan类型】。默认值为0.6秒。 BorderCornerRadius 获取或设置圆角大小。仅在General样式下生效。【CornerRadius类型】。默认值为0。 Direction 获取或设置进度条填充方向。仅在General样式下生效。【Directions枚举类型】可选项为LeftToRight、RightToLeft、TopToBottom、BottomToTop。默认值为LeftToRight。 IsPercentShow 获取或设置是否显示百分比。【Boolean类型】。默认值为False。 Percent 获取或设置当前进度条的百分比,从0~1的值。【Double类型】。默认值为0。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/RadioButtonsView.xaml ================================================  CheckBoxStyle 获取或设置单选按钮的基本样式。【CheckBoxStyles枚举类型】可选项为:General、Switch、Branch。默认值为General。 BorderCornerRadius 获取或设置单选按钮的圆角大小。【CornerRadius类型】。默认值为0。 CoverBrush 获取或设置当单选按钮被选中时,对号的前景色(General样式时)或开关背景色(Switch样式)或侧边填充色(Branch样式时)(General和Hollow样式时)或前景颜色(Outline和Link样式时)。【Brush类型】。默认值为#3E3E3E(General或Branch样式时)或LightGray(Switch样式时)。 InnerWidth 获取或设置内部选择框的宽度。【Double类型】。默认值为20或30(Switch样式)。 InnerHeight 获取或设置内部选择框的高度。【Double类型】可选项为Classic、Sink。默认值为Classic。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/SlidersView.xaml ================================================  Maximuim 获取或设置滑块的最大值,必须为非负整数。【Int类型】。默认值为100。 Minimuim 获取或设置滑块的最小值,必须为非负整数。【Int类型】。默认值为0。 Value 获取或设置滑块的当前值。【Int类型】。默认值为0。 CoverBrush 获取或设置填充色。【Brush类型】。默认值DimGray。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/SpecialView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Partial/TabControlsView.xaml ================================================  PUTabItem Icon 获取或设置显示在选项卡前的图标。该图标可以是FontAwesome字体,也可以是一个对象。【Objecy类型】。默认值为空。 DeleteButtonVisibility 获取或设置下拉选择项后侧删除按钮的显示状态。【Visibility类型】。默认值为Collpased。 Value 获取或设置下拉选择项可以携带的值,仅用于标记该子项的实际内容,不会对前端显示造成影响。【Object类型】。默认值为空。 PUTabItemModel 用于绑定到PUTabControl子项集合的模型类,参见PUTabControl的BindingItems属性。 PUTabControl TabControlStyle 获取或设置选项卡的基础样式。【TabControlStyles枚举类型】可选项General、Classic。默认值为General。 CoverBrush 获取或设置当某个子项被选中时的前景色。【Brush类型】。默认值为#3E3E3E DeleteMode 获取或设置当用户点击下拉框子项的删除按钮时,应该执行的操作。【DeleteModes枚举类型】可选项为Delete、EventOnly。默认值为Delete(删除项目并触发DeleteItem路由事件)。 BindingItems 获取或设置绑定对象模板,通过该属性可以将内容绑定到Model类集合,而不是UI对象集合。【<PUComboBoxItemModel>集合】。默认值为空。 SelectedValuePath 获取或设置当子项目被选中时,SelectedValue应呈现子项PUComboBoxItem的哪一个值。【SelectedValuePaths枚举类型】可选项为:Header、Value。默认值为Header。 SelectedValue 获取被选中的子项PUComboBoxItem的Header或Value属性(取决于SelectedValuePath的值),或通过设置该值来选中指定的子项目。【Object类型】。默认值为空。 DeleteItem 当用户点击子项PUComboBoxItem的删除按钮时,触发此路由事件。 当内容长度超出控件长度时,将显示两侧的按钮。除了点击按钮,也可以直接在TabControl上使用鼠标滚轮。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/TextBoxsView.xaml ================================================  TextBoxStyle 获取或设置输入框的基本样式。【TextBoxStyles枚举类型】可选项为:General、IconGroup。默认值为General。 BorderCornerRadius 获取或设置输入框的圆角大小。【CornerRadius类型】。默认值为0。 ShadowColor 获取或设置输入框获得焦点时的阴影颜色。【Color类型】。默认值为#888888。 Watermark 获取或设置输入框的水印。【String类型】。默认值为空。 Icon 获取或设置输入框的前置图标,仅在IconGroup样式下生效。【Object类型】。默认值为空。 IconWidth 获取或设置输入框前置图标的宽度,仅在IconGroup样式下生效。【Double类型】。默认值为30。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/TreeViewsView.xaml ================================================  PUTreeViewItem IsChoosed 获取或设置该子项是否已被选中,含有子项目的行项目无法被选中。【Boolean类型】。默认值为False。 Value 获取或设置该子项可以携带的值,仅用于标记该子项的实际内容,不对前端显示造成影响。【Object类型】。默认值为空。 PUTreeViewItemModel 用于绑定到PUTreeView子项集合的模型类,参见PUTreeView的BindingItems属性。 PUTreeView InnerHeight 获取或设置子项的行高度。【Double类型】。默认值为40。 CoverBrush 获取或设置鼠标悬浮时子项的背景色。【Brush类型】。默认值为0。 ChoosedBrush 获取或设置子项被选中时,的背景色。【Brush类型】。默认值为#88888 BindingItems 获取或设置绑定对象模板,通过该属性可以将内容绑定到Model类集合,而不是UI对象集合。【<PUTreeViewItemModel>集合】。默认值为空。 IsExpandDoubleClick 获取或设置是否需要双击才能展开行项目的子项。【Boolean类型】。默认值为False。 ChoosedValuePath 获取或设置当子项目被选中时,ChoosedValue应呈现子项PUTreeViewItem的哪一个值。【ChoosedValuePaths枚举类型】可选项为:Header、Value。默认值为Header。 ChoosedValue 获取被选中的子项PUTreeViewItem的Header或Value属性(取决于ChoosedValuePath的值),或通过设置该值来选中指定的子项目。【Object类型】。默认值为空。 ChoosedItemChanged 当新的子项被选中时,触发此路由事件。 GetTreeViewItemByHeader(object header) 通过Header查找并返回符合条件的第一个子项。 GetTreeViewItemByValue(object value) 通过Value查找并返回符合条件的第一个子项。 ================================================ FILE: Panuon.UIBrowser/Views/Partial/UtilsView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Partial/WindowsView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/ShellWindowView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Special/BubbleView.xaml ================================================  PUBubble 气泡 依赖属性概览 注解 PUBubble 气泡示例 实例 ================================================ FILE: Panuon.UIBrowser/Views/Special/DropDownView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Special/ImageCuterView.xaml ================================================  ================================================ FILE: Panuon.UIBrowser/Views/Special/IndicatorView.xaml ================================================  PUSplitLine 分割线 依赖属性概览 ================================================ FILE: Panuon.UIBrowser/Views/Special/LoadingView.xaml ================================================  PULoading 等待控件 依赖属性概览 ================================================ FILE: Panuon.UIBrowser/Views/Special/PagingNavView.xaml ================================================  PUPagingNav 分页器 依赖属性概览 事件 PUPagingNav 分页器 实例 ================================================ FILE: Panuon.UIBrowser/Views/Special/ResizeGridView.xaml ================================================  PUResizeGrid 可变大小容器 拖动四周改变大小 ================================================ FILE: Panuon.UIBrowser/Views/Special/SplitLineView.xaml ================================================  PUSplitLine 分割线 依赖属性概览 ================================================ FILE: Panuon.UIBrowser/app.config ================================================ ================================================ FILE: Panuon.UIBrowser/packages.config ================================================  ================================================ FILE: README.md ================================================ # PanuonUI(v1.0.0 alpha) ### 本项目已停止维护。请使用全新的PanuonUI.Silver。 ```diff - 由于PanuonUI在设计初期的根本缺陷,PanuonUI从今日起已停止维护。 - 请使用全新的PanuonUI.Silver,它的样式与PanuonUI大致相同,但使用方式更贴合原生控件, - 且支持虚拟化。Silver的控件比PanuonUI更多,功能也更强大。如有任何问题,欢迎进群咨询。 - Panuon.UI.Silver : https://github.com/Ruris/Panuon.UI.Silver ``` 一个好看精致,不限制个人或商业使用的WPF控件库。
Panuon.UI现已加入NuGet包。 本库是一个正在开发的项目,如果遇到问题或有更好的建议,请发送邮件至970424424@qq.com,或在我的知乎账户上私信我(@末城via),欢迎加入QQ群(718778191)。
你可以在任何地方使用该库,包括移植到你自己的项目中。 ## 捐赠 Panuon.UI是一个无限制的开源控件库。您的支持与帮助是我们持续开发的动力。 支付宝:(支持花呗(眨眼)): ![](https://raw.githubusercontent.com/Ruris/Panuon.Documents/master/Resources/Global/zhifubao.jpg) Paypal: paypal.me/Zeoun ## 使用方式 1.添加对Panuon.UI.dll的引用
2.在你的项目中添加fontawesome.ttf字体文件,并在App.xaml中添加以下资源字典。
``` ``` 3.在需要使用PanuonUI的xaml文件中添加引用
``` xmlns:pu="clr-namespace:Panuon.UI;assembly=Panuon.UI" ``` ## 当前的所有控件 基础控件
[Window / MessageBox 窗体](#window-窗体)
[Button / RepeatButton 按钮](#button-按钮)
[TextBox 输入框](#textbox-输入框)
[PasswordBox 密码框](#passwordbox-密码框)
[ComboBox / ComboBoxItem 下拉框](#combobox-下拉框)
[CheckBox 复选框](#checkbox-复选框)
[RadioButton 单选按钮](#radiobutton-单选按钮)
[TreeView / TreeViewItem 树视图](#treeview-树视图)
[ProgressBar 进度条](#progressbar-进度条)
[TabControl / TabItem 选项卡](#tabcontrol-选项卡)
[ListBox / ListBoxItem 列表](#listbox-列表)
[Slider 滑块](#slider-滑块控件)
特殊控件
[ResizeGrid 可调大小容器](#resizegrid-可调大小容器)
[Loading 等待控件](#loading-等待控件)
[SlideShow 轮播控件](#slideshow-轮播控件)
[ImageCuter 图片裁剪器](#imagecuter-图片裁剪器)
[DatePicker 日期时间选择器](#datepicker-日期时间选择器)
[PagingNav 分页器](#pagingnav-分页器)
图表
[LineCharts 折线图](#linchart-折线图)
### v1.0.0 版本说明 全新的示例程序尚未开发完成,已加入此版本。
0.1.2版本中仍旧存在一些BUG。这些问题已在1.0版本中修复,并会在一些时间后再提交到0.1.2。
更新说明: 1. v0.1.2版本无法无损升级到此版本,您可能要对现有项目进行一些修改。
2. 将大多数的枚举类型移入到了Panuon.UI命名空间中。
3. 解决了ComboBox可能在虚拟化容器中出现BUG的问题。
4. 解决了多个控件在使用BindingItems属性时可能出现设置SelectedValue无效的问题。
5. 全新的示例程序(集成了属性说明、注意事项,左右滑动可以看到控件示例)。
6. Helper中的RowDefinition和ColumnDefinition已支持输入星号(例如pu:Helper.RowDefinition="1*"),纯数字则表示使用像素(例如pu:Helper.RowDefinition="40")。
7. DeleteButtonVisibility统一重命名为CanDelete 8. 图片裁剪器中存在未修复的BUG,不推荐使用。

### Window 窗体 PUWindow是一个继承自Window的控件,支持边角拖动缩放。
通过设置IsCoverMaskShow和IsAwaitShow属性,可以快速打开一个遮罩层,或同时打开遮罩层和等待控件。

PUWindow在创建时总是尝试将排在最前面的活动窗口设置为自己的Owner(如果将AllowAutoOwner设为False,则不会进行此操作;此外,如果你在Show或ShowDialog前手动指定了它的Owner,则将以你的为准),以便于使用WindowStartupLocation属性和AllowAutoCoverMask属性(当此属性为True,且Owner是PUWindow类型时,该窗体打开时将自动把其Owner窗体的遮罩层打开,并在关闭时将其遮罩层关闭)。但这可能在某些情况下对你造成困扰。当你在一个窗体中尝试Show出多个PUWindow子窗体时,必须全部指定这些子窗体的Owner属性为当前窗体(或将这些子窗体的AllowAutoOwner设为False),否则可能会出现预料不到的问题。

PUMessageBox是一个继承自PUWindow的控件,它可以提供一段消息显示,一个询问对话框,或一个可以取消的等待框。 ``` //1. 显示一个提示框 PUMessageBox.ShowDialog("你好啊"); //2. 显示一个确认框 if(PUMessageBox.ShowConfirm("确定执行?") == true) { PUMessageBox.ShowDialog("已开始执行"); } //3. 显示一个不能取消的等待框,该窗体将以Show的方式打开 PUMessageBox.ShowAwait("正在执行..."); //当任务执行完,将其关闭 PUMessageBox.CloseAwait(); //4. 显示一个可以取消的等待框,该窗体将以Show的方式打开 PUMessageBox.ShowAwait("正在执行...", delegate { //当用户点击取消按钮时,将把取消按钮禁用,前端文字显示为“正在取消”,并触发此回调。 PUMessageBox.CloseAwait(delegate { PUMessageBox.ShowDialog("您取消了此任务。"); }); }); //如果用户没有取消,当任务执行完,您可以再将其关闭 PUMessageBox.CloseAwait(); ``` 你可以使用PUMessageBox.ShowAwait(string content)来打开一个等待对话框,并用PUMessageBox.CloseAwait()方法来将其关闭。
但如果你希望在CloseAwait之后立即打开一个新的PUWindow窗体(PUMessageBox的所有Show方法亦在此列),你必须指定新窗体的Owner为当前的主窗体,或者使用另一个重载方法PUMessageBox.CloseAwait(EventHandle closedCallback)关闭等待窗口,并将打开窗体的方法放入此事件处理中。否则新打开的窗体将被立即关闭。 示例: ``` //这种代码会导致弹框刚显示就被关闭 PUMessageBox.ShowAwait("正在执行..."); PUMessageBox.CloseAwait(); PUMessageBox.ShowDialog("任务已完成"); //必须像下面这样 PUMessageBox.ShowAwait("正在执行..."); PUMessageBox.CloseAwait(delegate { PUMessageBox.ShowDialog("任务已完成"); }); //或这样 PUMessageBox.ShowAwait("正在执行..."); PUMessageBox.CloseAwait(); await Task.Delay(500); PUMessageBox.ShowDialog("任务已完成"); //或者向下面这样 PUMessageBox.CloseAwait(); var testWindow = new TestWindow(); testWindow.Owner = this; testWindow.ShowDialog(); ``` | 依赖属性 | 类型 | 含义 | | --- | --- | ---| | Header | Object | 通常情况下,Title属性会同时设置窗体的左上角标题和任务栏标题。如果你期望使用不同的值,可以单独设置Header属性来改变左上角的标题内容。如果设置为Null,左上角标题将默认使用Title属性的内容。默认值为Null。 | | Icon | Object | 显示在左上角标题之前的图标。默认值为Null。 | | AnimationStyle | AnimationStyles枚举 | 启动/关闭时使用的动画样式。默认值为Scale(其余可选项为Gradual、Fade)。 | | AnimateIn | Boolean | 打开窗体时是否使用动画。默认值为True。 | | AnimateOut | Boolean | 关闭窗体时是否使用动画。默认值为True。 | | NavButtonVisibilty | Visibility | 设置控制条右侧三个按钮的显示状态。默认值为Visible。 | | IsCoverMaskShow | Boolean | 是否显示窗体的遮罩层。默认值为False。 | | IsAwaitShow | Boolean | 是否打开窗体的遮罩层,并显示等待控件。默认值为False。 | | AllowShowDelay | Boolean | 是否允许在启动时延迟显示窗体内容。在页面较为复杂时,将此属性设置为True有助于减少启动动画卡顿。 | | NavbarBackground | Brush | 控制栏的背景色。默认值为White(白色)。 | | NavbarHeight | Double | 控制栏的高度。默认值为30。 | | NavButtonHeight | Double | 控制栏按钮的高度。默认值为30。 | | NavButtonWidth | Double | 控制栏按钮的宽度。默认值为40。 | | BorderCornerRadius | CornerRadius | 窗体圆角大小。默认值为0。 | | AllowAutoCoverMask* | Boolean | 获取或设置是否允许在调用Show或ShowDialog方法时自动打开父窗体的遮罩层,并在Close时将其关闭。默认值为False。 | | AllowForcingClose | Boolean | 获取或设置是否允许用户使用Alt+F4组合键强制关闭窗体(在窗体Load事件之后设置此属性无效)。默认值为True。 | | 方法 | 含义 | | --- | --- | | AppendNavButton(object content, RoutedEventHandler clickHandler) | 向标题栏右侧控制按钮组中添加一个新的按钮,该按钮将被添加在按钮组的最左侧。 | 注意:上一个版本的CloseWindow()方法将不再使用,直接使用Close()方法即可触发关闭动画(若AnimateOut为True)。
### Button 按钮 PUButton是一个继承自Button的控件,目前共有四种样式。
PURepeatButton和PUButton的样式、属性、方法完全一致。
![](https://github-1252047526.cos.ap-chengdu.myqcloud.com/button.png)
| 依赖属性 | 类型 | 含义 | | --- | --- | ---| | ButtonStyle | ButtonStyles枚举 | 按钮的基本样式。默认值为General(其他可选项为Hollow、Outline、Link)。 | | ClickStyle | ClickStyles枚举 | 鼠标点击时按钮的效果。默认值为Classic(其他可选项为Sink)。 | | BorderCornerRadius | CornerRadius | 按钮圆角大小。默认值为0。 | | CoverBrush | AnimationStyles枚举 | 鼠标悬浮时遮罩层的背景颜色(Outline和Link样式下为前景色)。默认值为白色(在Outline和Link样式下为灰色) | ### TextBox 输入框 PUTextBox是一个继承自TextBox的控件,目前共有两种样式。
![](https://github-1252047526.cos.ap-chengdu.myqcloud.com/textbox.png)
| 依赖属性 | 类型 | 含义 | | --- | --- | ---| | TextBoxStyle | TextBoxStyles枚举 | 输入框的基本样式。默认值为General(其他可选项为IconGroup)。 | | Watermark | String | 水印。默认值为空。 | | Icon | Object | 放置在输入框前的图标,仅在IconGroup样式下有效。默认值为空。 | | IconWidth | Double | 图标的宽度。默认值为30。 | | ShadowColor | Color | 输入框获得焦点时阴影的颜色。默认值为#888888。 | | BorderCornerRadius | CornerRadius | 输入框圆角大小。默认值为0。 | ### PasswordBox 密码框 #### PUPasswordBox继承自TextBox。恶意程序可能会通过内存读取用户输入的密码,请勿在较高安全要求环境中使用。
不要对Text属性进行赋值,可能会导致意外的错误。按原生PasswordBox的方式使用即可。 ![](https://github-1252047526.cos.ap-chengdu.myqcloud.com/passwordbox.png)
| 依赖属性 | 类型 | 含义 | | --- | --- | ---| | PasswordBoxStyle | PasswordBoxStyles枚举 | 密码框的基本样式。默认值为General(其他可选项为IconGroup)。 | | Watermark | String | 水印。默认值为空。 | | Icon | Object | 放置在输入框前的图标,仅在IconGroup样式下有效。默认值为空。 | | IconWidth | Double | 图标的宽度,仅在IconGroup样式下有效。默认值为30。 | | ShadowColor | Color | 密码框获得焦点时阴影的颜色。默认值为#888888。 | | BorderCornerRadius | CornerRadius | 密码框圆角大小。默认值为0。 | ### ComboBox 下拉框 ![](https://github-1252047526.cos.ap-chengdu.myqcloud.com/combobox.png)
#### PUComboBox依赖属性 | 依赖属性 | 类型 | 含义 | | --- | --- | ---| | ShadowColor | Color | 获下拉框激活时阴影的颜色。默认值为#88888。 | | CoverBrush | String | 鼠标悬浮在选择项时的背景颜色。默认值为#EEEEEE。 | | DeleteMode | DeleteModes枚举 | 当用户点击下拉框子项的删除按钮时,应该执行的操作。默认值为DeleteAndRouted(其他可选项为EventOnly)。 | | BindingItems | IList集合 | 绑定对象模板,通过该属性可以将内容绑定到Model类集合,而不是UI对象集合。默认值为空。 | | SelectedValuePath | SelectedValuePaths枚举 | 当子项目被选中时,SelectedValue应呈现子项PUComboBoxItem的哪一个值。默认值为Header(Value)。 | | SelectedValue | Object | 子项PUComboBoxItem的Header或Value属性(取决于SelectedValuePath的值),或通过设置该值来选中指定的子项目。默认值为空。 | | BorderCornerRadius | CornerRadius | 下拉框和输入框的圆角大小。默认值为0。 | PUComboBox包含以下一个额外的路由事件。
| 路由事件 | 含义 | | ----- | ----- | | DeleteItem | 当用户点击子项PUComboBoxItem的删除按钮时,触发此路由事件。 | #### PUComboBoxItem依赖属性 | 依赖属性 | 类型 | 含义 | | --- | --- | ---| | DeleteButtonVisibility | Visibility | 下拉选择项后侧删除按钮的显示状态。默认值为Collpased。 | | Value | Object | 下拉选择项可以携带的值,仅用于标记该子项的实际内容,不会对前端显示造成影响。默认值为Null。 | PUComboBoxItem包含以下一个额外的类。
| 类 | 含义 | | ----- | ----- | | PUComboBoxItemModel | 用于绑定到PUComboBox子项集合的模型类,参见PUComboBox的BindingItems属性。 | (文档更新中) ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/MonoAndroid10/Caliburn.Micro.Platform.Core.xml ================================================ Caliburn.Micro.Platform.Core A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets a collection of the public types defined in this assembly that are visible outside the assembly. The assembly. A collection of the public types defined in this assembly that are visible outside the assembly. Returns a value that indicates whether the specified type can be assigned to the current type. The target type The type to check. true if the specified type can be assigned to this type; otherwise, false. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/MonoAndroid10/Caliburn.Micro.Platform.xml ================================================ Caliburn.Micro.Platform Arguments for activity events Creates a new ActivityEventArgs. The activity this event corresponds to. The activity this event corresponds to. Handles callbacks for the activity lifecycle and exposes them as events Invoked when an activity is created Invoked when an acitivty is destroyed Invoked when an acitivty is paused Invoked when an acitivty is resumed Invoked when an acitities instance state is saved Invoked when an activity is started Invoked when an activity is stopped Invokes the ActivityCreated event The activity The saved instance state Invokes the ActivityDestroyed event The activity Invokes the ActivityPaused event The activity Invokes the ActivityResumed event The activity Invokes the ActivitySaveInstanceState event The activity The output state Invokes the ActivityStarted event The activity Invokes the ActivityStopped event The activity A implementation for the Xamarin Android platfrom. Creates an instance of . The Android Application Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. Encapsulates the app and its available services. Creates an instance of . A which contains the java.lang.Class JNI value corresponding to this type. How to handle ownership Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. B Start the framework. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/MonoTouch10/Caliburn.Micro.Platform.Core.xml ================================================ Caliburn.Micro.Platform.Core A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets a collection of the public types defined in this assembly that are visible outside the assembly. The assembly. A collection of the public types defined in this assembly that are visible outside the assembly. Returns a value that indicates whether the specified type can be assigned to the current type. The target type The type to check. true if the specified type can be assigned to this type; otherwise, false. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/MonoTouch10/Caliburn.Micro.Platform.xml ================================================ Caliburn.Micro.Platform Encapsulates the app and its available services. Creates an instance of . Creates an instance of . /// The handle for this class Creates an instance of . >Unused sentinel value, pass NSObjectFlag.Empty Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. B Start the framework. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. A implementation for the Xamarin iOS platfrom. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. An interface to allow the IOSPlatformProvider provide view lifecycle events Returns if the current view is already loaded Invoked when the view is loaded Invoked the view appears A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/Xamarin.iOS10/Caliburn.Micro.Platform.Core.xml ================================================ Caliburn.Micro.Platform.Core A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets a collection of the public types defined in this assembly that are visible outside the assembly. The assembly. A collection of the public types defined in this assembly that are visible outside the assembly. Returns a value that indicates whether the specified type can be assigned to the current type. The target type The type to check. true if the specified type can be assigned to this type; otherwise, false. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/Xamarin.iOS10/Caliburn.Micro.Platform.xml ================================================ Caliburn.Micro.Platform Encapsulates the app and its available services. Creates an instance of . Creates an instance of . /// The handle for this class Creates an instance of . >Unused sentinel value, pass NSObjectFlag.Empty Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. B Start the framework. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. A implementation for the Xamarin iOS platfrom. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. An interface to allow the IOSPlatformProvider provide view lifecycle events Returns if the current view is already loaded Invoked when the view is loaded Invoked the view appears A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/net40/Caliburn.Micro.Platform.xml ================================================ Caliburn.Micro.Platform A host for action related attached properties. A property definition representing the target of an . The DataContext of the element will be set to this instance. A property definition representing the target of an . The DataContext of the element is not set to this instance. Sets the target of the . The element to attach the target to. The target for instances of . Gets the target for instances of . The element to which the target is attached. The target for instances of Sets the target of the . The element to attach the target to. The target for instances of . The DataContext will not be set. Gets the target for instances of . The element to which the target is attached. The target for instances of Checks if the -Target was set. DependencyObject to check True if Target or TargetWithoutContext was set on Uses the action pipeline to invoke the method. The object instance to invoke the method on. The name of the method to invoke. The view. The source of the invocation. The event args. The method parameters. The context used during the execution of an Action or its guard. Determines whether the action can execute. Returns true if the action can execute, false otherwise. Any event arguments associated with the action's invocation. The actual method info to be invoked. The message being executed. The source from which the message originates. The instance on which the action is invoked. The view associated with the target. Gets or sets additional data needed to invoke the action. The data key. Custom data associated with the context. Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Called when the execution context is disposed Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked. Causes the action invocation to "double check" if the action should be invoked by executing the guard immediately before hand. This is disabled by default. If multiple actions are attached to the same element, you may want to enable this so that each individaul action checks its guard regardless of how the UI state appears. Causes the action to throw if it cannot locate the target or the method at invocation time. True by default. Represents the method name of an action message. Represents the parameters of an action message. Creates an instance of . Gets or sets the name of the method to be invoked on the presentation model class. The name of the method. Gets the parameters to pass as part of the method invocation. The parameters. Occurs before the message detaches from the associated object. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Forces an update of the UI's Enabled/Disabled state based on the the preconditions associated with the method. Returns a that represents the current . A that represents the current . Invokes the action using the specified Applies an availability effect, such as IsEnabled, to an element. Returns a value indicating whether or not the action is available. Finds the method on the target matching the specified message. The target. The message. The matching method, if available. Sets the target, method and view on the context. Uses a bubbling strategy by default. Prepares the action execution context for use. Try to find a candidate for guard function, having: - a name matching any of - no generic parameters - a bool return type - no parameters or a set of parameters corresponding to the action method The execution context Method names to look for. A MethodInfo, if found; null otherwise Returns the list of possible names of guard methods / properties for the given method. A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Hosts dependency properties for binding. Allows binding on an existing view. Use this on root UserControls, Pages and Windows; not in a DataTemplate. Allows binding on an existing view without setting the data context. Use this from within a DataTemplate. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Allows application of conventions at design-time. Gets whether or not conventions are being applied at design-time. The ui to apply conventions to. Whether or not conventions are applied. Sets whether or not do bind conventions at design-time. The ui to apply conventions to. Whether or not to apply conventions. Provides methods for searching a given scope for named elements. Searches through the list of named elements looking for a case-insensitive match. The named elements to search through. The name to search for. The named element or null if not found. Adds a child resolver. The type filter. The resolver. Adds a child resolver. The type filter. The resolver. Removes a child resolver. The resolver to remove. true, when the resolver was (found and) removed. Gets all the instances with names in the scope. Named instances in the provided scope. Pass in a and receive a list of named instances in the same scope. Gets the parent of the given object in the Visual Tree. The parent of the given object in the Visual Tree Finds a set of named instances in each hop in a . Searches all the elements in the parameter as well as the visual children of each of these elements, the , the HeaderedContentControl.Header, the , or the HeaderedItemsControl.Header, if any are found. Finds a path of dependency objects which traces through visual anscestry until a root which is , a , a Page with a dependency object Page.ContentProperty value, a dependency object with set to . and are included in the resulting in order to track which item in an items control we are scoped to. Maintains a connection in the visual tree of dependency objects in order to record a route through it. Gets or sets the starting point of the route. Adds a segment to the route. The source dependency object. The target dependency object. Tries to get a target dependency object given a source. The possible beginning of a route segment (hop). The target of a route segment (hop). if had a target recorded; otherwise. Inherit from this class in order to customize the configuration of the framework. The application. Creates an instance of the bootstrapper. Set this to false when hosting Caliburn.Micro inside and Office or WinForms application. The default is true. Initialize the framework. Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. Provides an opportunity to hook into the application object. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. Override this to add custom behavior to execute after the application starts. The sender. The args. Override this to add custom behavior on exit. The sender. The event args. Override this to add custom behavior for unhandled exceptions. The sender. The event args. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. The optional window settings. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. The optional window settings. Represents a resolver that takes a control and returns it's children Creates the ChildResolver using the given anonymous methods. The filter The resolver Can this resolve appy to the given type. The visual tree type. Returns true if this resolver applies. The element from the visual tree for the children to resolve. Generic strongly typed child resolver The type to filter on Creates a Used to configure the conventions used by the framework to apply bindings and create actions. Converters to/from . Indicates whether or not static properties should be included during convention name matching. False by default. Indicates whether or not the Content of ContentControls should be overwritten by conventional bindings. False by default. The default DataTemplate used for ItemsControls when required. The default DataTemplate used for Headered controls when required. Changes the provided word from a plural form to a singular form. Derives the SelectedItem property name. Creates a binding and sets it on the element, applying the appropriate conventions. Applies the appropriate binding mode to the binding. Determines whether or not and what type of validation to enable on the binding. Determines whether a value converter is is needed and applies one to the binding. Determines whether a custom string format is needed and applies it to the binding. Determines whether a custom update source trigger should be applied to the binding. Adds an element convention. The type of element. The default property for binding conventions. The default property for action parameters. The default event to trigger actions. Adds an element convention. Gets an element convention for the provided element type. The type of element to locate the convention for. The convention if found, null otherwise. Searches the class hierarchy for conventions. Determines whether a particular dependency property already has a binding on the provided element. Creates a binding and sets it on the element, guarding against pre-existing bindings. Creates a binding and set it on the element, guarding against pre-existing bindings and pre-existing values. Attempts to apply the default item template to the items control. The items control. The collection property. Configures the selected item convention. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. Configures the SelectedItem binding for matched selection path. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. The binding to configure. A bool indicating whether to apply binding Applies a header template based on Gets a property by name, ignoring case and searching all interfaces. The type to inspect. The property to search for. The property or null if not found. Class that abstracts the differences in creating a DepedencyProperty / BindableProperty on the different platforms. Register an attached dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred attached dependecy property Register a dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred dependecy property Represents the conventions for a particular element type. The type of element to which the conventions apply. Gets the default property to be used in binding conventions. The default trigger to be used when wiring actions on this element. The default property to be used for parameters of this type in actions. Applies custom conventions for elements of this type. Pass the view model type, property path, property instance, framework element and its convention. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Indicates that a message is parameterized. Represents the parameters of a message. Host's attached properties related to routed UI messaging. Places a message handler on this element. The element. The message handler. Gets the message handler for this element. The element. The message handler. A property definition representing attached triggers and messages. Sets the attached triggers and messages. The element to attach to. The parsable attachment text. Gets the attached triggers and messages. The element that was attached to. The parsable attachment text. A service that is capable of properly binding values to a method's parameters and creating instances of . The special parameter values recognized by the message binder along with their resolvers. Parameter names are case insensitive so the specified names are unique and can be used with different case variations Custom converters used by the framework registered by destination type for which they will be selected. The converter is passed the existing value to convert and a "context" object. Determines the parameters that a method should be invoked with. The action execution context. The parameters required to complete the invocation. The actual parameter values. Transforms the textual parameter into the actual parameter. Coerces the provided value to the destination type. The destination type. The provided value. An optional context value which can be used during conversion. The coerced value. Gets the default value for a type. The type. The default value. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text A collection that can exist as part of a behavior. The type of item in the attached collection. Creates an instance of Attached the collection. The dependency object to attach the collection to. Detaches the collection. Called when an item is added from the collection. The item that was added. Called when an item is removed from the collection. The item that was removed. Implemented by services that provide based navigation. Navigates to the view represented by the given view model. The view model to navigate to. Extra data to populate the view model with. Navigates to the view represented by the given view model. The view model to navigate to. Extra data to populate the view model with. Indicates whether the navigator can navigate back. Indicates whether the navigator can navigate forward. The current content. Stops the loading process. Navigates back. Navigates forward. Removes the most recent entry from the back stack. The entry that was removed. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Raised when a fragment navigation occurs. A basic implementation of designed to adapt the control. Creates an instance of The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. Occurs before navigation The event sender. The event args. Called to check whether or not to close current instance on navigating. The event sender from OnNavigating event. The event args from OnNavigating event. Occurs after navigation The event sender. The event args. Attempts to inject query string parameters from the view into the view model. The view model. The parameter. The source. Indicates whether the navigator can navigate back. Indicates whether the navigator can navigate forward. The current source. The current content. Stops the loading process. Navigates back. Navigates forward. Removes the most recent entry from the back stack. The entry that was removed. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Raised when a fragment navigation occurs. Extension methods related to navigation. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Builds a Uri in a strongly typed fashion, based on a ViewModel. Adds a query string parameter to the Uri. The type of the value. The property. The property value. Itself Attaches a navigation servies to this builder. The navigation service. Itself Navigates to the Uri represented by this builder. Represents a parameter of an . A dependency property representing the parameter's value. Gets or sets the value of the parameter. The value. Gets or sets the owner. When implemented in a derived class, creates a new instance of the derived class. The new instance. Makes the parameter aware of the that it's attached to. The action message. A service that manages windows. Shows a modal dialog for the specified model. The root model. The context. The optional dialog settings. The dialog result. Shows a non-modal window for the specified model. The root model. The context. The optional window settings. Shows a popup at the current mouse position. The root model. The view context. The optional popup settings. A service that manages windows. Shows a modal dialog for the specified model. The root model. The context. The dialog popup settings. The dialog result. Shows a window for the specified model. The root model. The context. The optional window settings. Shows a popup at the current mouse position. The root model. The view context. The optional popup settings. Creates a popup for hosting a popup window. The model. The optional popup settings. The popup. Creates a window. The view model. Whethor or not the window is being shown as a dialog. The view context. The optional popup settings. The window. Makes sure the view is a window is is wrapped by one. The view model. The view. Whethor or not the window is being shown as a dialog. The window. Infers the owner of the window. The window to whose owner needs to be determined. The owner. Creates the page. The root model. The context. The optional popup settings. The page. Ensures the view is a page or provides one. The model. The view. The page. Parses text into a fully functional set of instances with . Parses the specified message text. The target. The message text. The triggers parsed from the text. The function used to generate a trigger. The parameters passed to the method are the the target of the trigger and string representing the trigger. Creates an instance of by parsing out the textual dsl. The target of the message. The textual message dsl. The created message. Function used to parse a string identified as a message. Function used to parse a string identified as a message parameter. Creates a binding on a . The target to which the message is applied. The parameter object. The name of the element to bind to. The path of the element to bind to. The binding mode to use. Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". Hosts attached properties related to view models. A dependency property which allows the framework to track whether a certain element has already been loaded in certain scenarios. A dependency property which marks an element as a name scope root. A dependency property which allows the override of convention application behavior. A dependency property for assigning a context to a particular portion of the UI. A dependency property for attaching a model to the UI. Used by the framework to indicate that this element was generated. Executes the handler immediately if the element is loaded, otherwise wires it to the Loaded event. The element. The handler. true if the handler was executed immediately; false otherwise Executes the handler when the element is unloaded. The element. The handler. Executes the handler the next time the elements's LayoutUpdated event fires. The element. The handler. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Gets the convention application behavior. The element the property is attached to. Whether or not to apply conventions. Sets the convention application behavior. The element to attach the property to. Whether or not to apply conventions. Sets the model. The element to attach the model to. The model. Gets the model. The element the model is attached to. The model. Gets the context. The element the context is attached to. The context. Sets the context. The element to attach the context to. The context. Gets a value that indicates whether the process is running in design mode. A strategy for determining which view to use for a given model. Used to transform names. Separator used when resolving View names for context instances. Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) This method registers a View suffix or synonym so that View Context resolution works properly. It is automatically called internally when calling AddNamespaceMapping(), AddDefaultTypeMapping(), or AddTypeMapping(). It should not need to be called explicitly unless a rule that handles synonyms is added directly through the NameTransformer. Suffix for type name. Should be "View" or synonym of "View". Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Retrieves the view from the IoC container or tries to create it if not found. Pass the type of view as a parameter and recieve an instance of the view. Modifies the name of the type to be used at design time. Transforms a ViewModel type name into all of its possible View type names. Optionally accepts an instance of context object Enumeration of transformed names Arguments: typeName = The name of the ViewModel type being resolved to its companion View. context = An instance of the context or null. Locates the view type based on the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view type. Locates the view for the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view instance. Locates the view for the specified model instance. The view. Pass the model instance, display location (or null) and the context (or null) as parameters and receive a view instance. Transforms a view type into a pack uri. When a view does not contain a code-behind file, we need to automatically call InitializeCompoent. The element to initialize Binds a view to a view model. Gets or sets a value indicating whether to apply conventions by default. true if conventions should be applied by default; otherwise, false. Indicates whether or not the conventions have already been applied to the view. Determines whether a view should have conventions applied to it. The view to check. Whether or not conventions should be applied to the view. Creates data bindings on the view's controls based on the provided properties. Parameters include named Elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Attaches instances of to the view's controls based on the provided methods. Parameters include the named elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Allows the developer to add custom handling of named elements which were not matched by any default conventions. Binds the specified viewModel to the view. Passes the the view model, view and creation context (or null for default) to use in applying binding. A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. A implementation for the XAML platfrom. Initializes a new instance of the class. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/net40/System.Windows.Interactivity.xml ================================================ System.Windows.Interactivity Represents a collection of IAttachedObject with a shared AssociatedObject and provides change notifications to its contents when that AssociatedObject changes. An interface for an object that can be attached to another object. Attaches to the specified object. The object to attach to. Detaches this instance from its associated object. Gets the associated object. The associated object. Represents the object the instance is attached to. Initializes a new instance of the class. Internal, because this should not be inherited outside this assembly. Called immediately after the collection is attached to an AssociatedObject. Called when the collection is being detached from its AssociatedObject, but before it has actually occurred. Called when a new item is added to the collection. The new item. Called when an item is removed from the collection. The removed item. Cannot add the instance to a collection more than once. Attaches to the specified object. The object to attach to. The IAttachedObject is already attached to a different object. Detaches this instance from its associated object. The object on which the collection is hosted. Gets the associated object. The associated object. Encapsulates state information and zero or more ICommands into an attachable object. The type the can be attached to. Behavior is the base class for providing attachable state and commands to an object. The types the Behavior can be attached to can be controlled by the generic parameter. Override OnAttached() and OnDetaching() methods to hook and unhook any necessary handlers from the AssociatedObject. Encapsulates state information and zero or more ICommands into an attachable object. This is an infrastructure class. Behavior authors should derive from Behavior<T> instead of from this class. Called after the behavior is attached to an AssociatedObject. Override this to hook up functionality to the AssociatedObject. Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred. Override this to unhook functionality from the AssociatedObject. Attaches to the specified object. The object to attach to. The Behavior is already hosted on a different element. dependencyObject does not satisfy the Behavior type constraint. Detaches this instance from its associated object. The type to which this behavior can be attached. Gets the object to which this behavior is attached. Gets the associated object. The associated object. Initializes a new instance of the class. Gets the object to which this is attached. Represents a collection of behaviors with a shared AssociatedObject and provides change notifications to its contents when that AssociatedObject changes. Initializes a new instance of the class. Internal, because this should not be inherited outside this assembly. Called immediately after the collection is attached to an AssociatedObject. Called when the collection is being detached from its AssociatedObject, but before it has actually occurred. Called when a new item is added to the collection. The new item. Called when an item is removed from the collection. The removed item. Creates a new instance of the BehaviorCollection. The new instance. Enumerates possible values for reusable property value editors. Uses the element picker, if supported, to edit this property at design time. Uses the storyboard picker, if supported, to edit this property at design time. Uses the state picker, if supported, to edit this property at design time. Uses the element-binding picker, if supported, to edit this property at design time. Uses the property-binding picker, if supported, to edit this property at design time. Associates the given editor type with the property on which the CustomPropertyValueEditor is applied. Use this attribute to get improved design-time editing for properties that denote element (by name), storyboards, or states (by name). Initializes a new instance of the class. The custom property value editor. Gets or sets the custom property value editor. The custom property value editor. Provides design tools information about what to instantiate for a given action or command. Initializes a new instance of the class. The type this attribute applies to. The type of to instantiate. A single argument for the specified . is not derived from TriggerBase. This constructor is useful if the specifed has a single argument. The resulting code will be CLS compliant. Initializes a new instance of the class. The type this attribute applies to. The type of to instantiate. The constructor arguments for the specified . is not derived from TriggerBase. Instantiates this instance. The specified by the DefaultTriggerAttribute. Gets the type that this DefaultTriggerAttribute applies to. The type this DefaultTriggerAttribute applies to. Gets the type of the to instantiate. The type of the to instantiate. Gets the parameters to pass to the constructor. The parameters to pass to the constructor. This method will use the VisualTreeHelper.GetParent method to do a depth first walk up the visual tree and return all ancestors of the specified object, including the object itself. The object in the visual tree to find ancestors of. Returns itself an all ancestors in the visual tree. EventObserver is designed to help manage event handlers by detatching when disposed. Creating this object will also attach in the constructor. Creates an instance of EventObserver and attaches to the supplied event on the supplied target. Call dispose to detach. The event to attach and detach from. The target object the event is defined on. Null if the method is static. The delegate to attach to the event. Detaches the handler from the event. A trigger that listens for a specified event on its source and fires when that event is fired. Represents a trigger that can listen to an element other than its AssociatedObject. The type that this trigger can be associated with. EventTriggerBase extends TriggerBase to add knowledge of another object than the one it is attached to. This allows a user to attach a Trigger/Action pair to one element and invoke the Action in response to a change in another object somewhere else. Override OnSourceChanged to hook or unhook handlers on the source element, and OnAttached/OnDetaching for the associated element. The type of the Source element can be constrained by the generic type parameter. If you need control over the type of the AssociatedObject, set a TypeConstraintAttribute on your derived type. Represents a trigger that can listen to an object other than its AssociatedObject. This is an infrastructure class. Trigger authors should derive from EventTriggerBase<T> instead of this class. Represents an object that can invoke Actions conditionally. This is an infrastructure class. Trigger authors should derive from Trigger<T> instead of this class. Invoke all actions associated with this trigger. Derived classes should call this to fire the trigger. Called after the trigger is attached to an AssociatedObject. Called when the trigger is being detached from its AssociatedObject, but before it has actually occurred. Creates a new instance of the TriggerBase derived class. The new instance. Attaches to the specified object. The object to attach to. Cannot host the same trigger on more than one object at a time. dependencyObject does not satisfy the trigger type constraint. Detaches this instance from its associated object. Gets the object to which the trigger is attached. The associated object. Gets the type constraint of the associated object. The associated object type constraint. Gets the actions associated with this trigger. The actions associated with this trigger. Event handler for registering to PreviewInvoke. Gets the associated object. The associated object. Specifies the name of the Event this EventTriggerBase is listening for. Called when the event associated with this EventTriggerBase is fired. By default, this will invoke all actions on the trigger. The instance containing the event data. Override this to provide more granular control over when actions associated with this trigger will be invoked. Called when the source changes. The old source. The new source. This function should be overridden in derived classes to hook functionality to and unhook functionality from the changing source objects. Called after the trigger is attached to an AssociatedObject. Called when the trigger is being detached from its AssociatedObject, but before it has actually occurred. Could not find eventName on the Target. Gets the type constraint of the associated object. The associated object type constraint. Define a TypeConstraintAttribute on a derived type to constrain the types it may be attached to. Gets the source type constraint. The source type constraint. Gets or sets the target object. If TargetObject is not set, the target will look for the object specified by TargetName. If an element referred to by TargetName cannot be found, the target will default to the AssociatedObject. This is a dependency property. The target object. Gets or sets the name of the element this EventTriggerBase listens for as a source. If the name is not set or cannot be resolved, the AssociatedObject will be used. This is a dependency property. The name of the source element. Gets the resolved source. If is not set or cannot be resolved, defaults to AssociatedObject. The resolved source object. In general, this property should be used in place of AssociatedObject in derived classes. The element pointed to by does not satisify the type constraint. Initializes a new instance of the class. Called when the source property changes. Override this to hook functionality to and unhook functionality from the specified source, rather than the AssociatedObject. The old source. The new source. Gets the resolved source. If is not set or cannot be resolved, defaults to AssociatedObject. The resolved source object. In general, this property should be used in place of AssociatedObject in derived classes. Initializes a new instance of the class. Initializes a new instance of the class. Name of the event. Gets or sets the name of the event to listen for. This is a dependency property. The name of the event. Static class that owns the Triggers and Behaviors attached properties. Handles propagation of AssociatedObject change notifications. This property is used as the internal backing store for the public Triggers attached property. This property is not exposed publicly. This forces clients to use the GetTriggers and SetTriggers methods to access the collection, ensuring the collection exists and is set before it is used. This property is used as the internal backing store for the public Behaviors attached property. This property is not exposed publicly. This forces clients to use the GetBehaviors and SetBehaviors methods to access the collection, ensuring the collection exists and is set before it is used. Gets the TriggerCollection containing the triggers associated with the specified object. The object from which to retrieve the triggers. A TriggerCollection containing the triggers associated with the specified object. Gets the associated with a specified object. The object from which to retrieve the . A containing the behaviors associated with the specified object. Cannot host the same BehaviorCollection on more than one object at a time. Cannot host the same TriggerCollection on more than one object at a time. A helper function to take the place of FrameworkElement.IsLoaded, as this property is not available in Silverlight. The element of interest. True if the element has been loaded; otherwise, False. Gets or sets a value indicating whether to run as if in design mode. True if [should run in design mode]; otherwise, False. Not to be used outside unit tests. Executes a specified ICommand when invoked. Represents an attachable object that encapsulates a unit of functionality. The type to which this action can be attached. Represents an attachable object that encapsulates a unit of functionality. This is an infrastructure class. Action authors should derive from TriggerAction<T> instead of this class. Attempts to invoke the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. When implemented in a derived class, creates a new instance of the derived class. The new instance. Attaches to the specified object. The object to attach to. Cannot host the same TriggerAction on more than one object at a time. dependencyObject does not satisfy the TriggerAction type constraint. Detaches this instance from its associated object. Gets or sets a value indicating whether this action will run when invoked. This is a dependency property. True if this action will be run when invoked; otherwise, False. Gets the object to which this action is attached. The associated object. Gets the associated object type constraint. The associated object type constraint. Gets or sets a value indicating whether this instance is attached. True if this instance is attached; otherwise, False. Gets the associated object. The associated object. Initializes a new instance of the class. Gets the object to which this is attached. The associated object. Gets the associated object type constraint. The associated object type constraint. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Gets or sets the name of the command this action should invoke. The name of the command this action should invoke. This property will be superseded by the Command property if both are set. Gets or sets the command this action should invoke. This is a dependency property. The command to execute. This property will take precedence over the CommandName property if both are set. Gets or sets the command parameter. This is a dependency property. The command parameter. This is the value passed to ICommand.CanExecute and ICommand.Execute. Provides data about which objects were affected when resolving a name change. Helper class to handle the logic of resolving a TargetName into a Target element based on the context provided by a host element. Attempts to update the resolved object from the name within the context of the namescope reference element. The old resolved object. Resets the existing target and attempts to resolve the current TargetName from the context of the current Host. If it cannot resolve from the context of the Host, it will continue up the visual tree until it resolves. If it has not resolved it when it reaches the root, it will set the Target to null and write a warning message to Debug output. Occurs when the resolved element has changed. Gets or sets the name of the element to attempt to resolve. The name to attempt to resolve. The resolved object. Will return the reference element if TargetName is null or empty, or if a resolve has not been attempted. Gets or sets the reference element from which to perform the name resolution. The reference element. Gets or sets a value indicating whether the reference element load is pending. True if [pending reference element load]; otherwise, False. If the Host has not been loaded, the name will not be resolved. In that case, delay the resolution and track that fact with this property. Represents an action that can be targeted to affect an object other than its AssociatedObject. The type constraint on the target. TargetedTriggerAction extends TriggerAction to add knowledge of another element than the one it is attached to. This allows a user to invoke the action on an element other than the one it is attached to in response to a trigger firing. Override OnTargetChanged to hook or unhook handlers on the target element, and OnAttached/OnDetaching for the associated element. The type of the Target element can be constrained by the generic type parameter. If you need control over the type of the AssociatedObject, set a TypeConstraintAttribute on your derived type. Represents an action that can be targeted to affect an object other than its AssociatedObject. This is an infrastructure class. Action authors should derive from TargetedTriggerAction<T> instead of this class. Called when the target changes. The old target. The new target. This function should be overriden in derived classes to hook and unhook functionality from the changing source objects. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. Gets or sets the target object. If TargetObject is not set, the target will look for the object specified by TargetName. If an element referred to by TargetName cannot be found, the target will default to the AssociatedObject. This is a dependency property. The target object. Gets or sets the name of the object this action targets. If Target is set, this property is ignored. If Target is not set and TargetName is not set or cannot be resolved, the target will default to the AssociatedObject. This is a dependency property. The name of the target object. Gets the target object. If TargetObject is set, returns TargetObject. Else, if TargetName is not set or cannot be resolved, defaults to the AssociatedObject. The target object. In general, this property should be used in place of AssociatedObject in derived classes. The Target element does not satisfy the type constraint. Gets the associated object type constraint. The associated object type constraint. Define a TypeConstraintAttribute on a derived type to constrain the types it may be attached to. Gets the target type constraint. The target type constraint. Initializes a new instance of the class. Called when the target property changes. Override this to hook and unhook functionality on the specified Target, rather than the AssociatedObject. The old target. The new target. Gets the target object. If TargetName is not set or cannot be resolved, defaults to the AssociatedObject. The target. In general, this property should be used in place of AssociatedObject in derived classes. Represents a collection of actions with a shared AssociatedObject and provides change notifications to its contents when that AssociatedObject changes. Initializes a new instance of the class. Internal, because this should not be inherited outside this assembly. Called immediately after the collection is attached to an AssociatedObject. Called when the collection is being detached from its AssociatedObject, but before it has actually occurred. Called when a new item is added to the collection. The new item. Called when an item is removed from the collection. The removed item. Creates a new instance of the TriggerActionCollection. The new instance. Represents an object that can invoke actions conditionally. The type to which this trigger can be attached. TriggerBase is the base class for controlling actions. Override OnAttached() and OnDetaching() to hook and unhook handlers on the AssociatedObject. You may constrain the types that a derived TriggerBase may be attached to by specifying the generic parameter. Call InvokeActions() to fire all Actions associated with this TriggerBase. Initializes a new instance of the class. Gets the object to which the trigger is attached. The associated object. Gets the type constraint of the associated object. The associated object type constraint. Argument passed to PreviewInvoke event. Assigning Cancelling to True will cancel the invoking of the trigger. This is an infrastructure class. Behavior attached to a trigger base object can add its behavior as a listener to TriggerBase.PreviewInvoke. Represents a collection of triggers with a shared AssociatedObject and provides change notifications to its contents when that AssociatedObject changes. Initializes a new instance of the class. Internal, because this should not be inherited outside this assembly. Called immediately after the collection is attached to an AssociatedObject. Called when the collection is being detached from its AssociatedObject, but before it has actually occurred. Called when a new item is added to the collection. The new item. Called when an item is removed from the collection. The removed item. Creates a new instance of the . The new instance. Specifies type constraints on the AssociatedObject of TargetedTriggerAction and EventTriggerBase. Initializes a new instance of the class. The constraint type. Gets the constraint type. The constraint type. A strongly-typed resource class, for looking up localized strings, etc. Returns the cached ResourceManager instance used by this class. Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class. Looks up a localized string similar to Cannot set the same BehaviorCollection on multiple objects.. Looks up a localized string similar to An instance of a Behavior cannot be attached to more than one object at a time.. Looks up a localized string similar to Cannot host an instance of a TriggerAction in multiple TriggerCollections simultaneously. Remove it from one TriggerCollection before adding it to another.. Looks up a localized string similar to Cannot set the same TriggerCollection on multiple objects.. Looks up a localized string similar to An instance of a trigger cannot be attached to more than one object at a time.. Looks up a localized string similar to The command "{0}" does not exist or is not publicly exposed on {1}.. Looks up a localized string similar to "{0}" is not a valid type for the TriggerType parameter. Make sure "{0}" derives from TriggerBase.. Looks up a localized string similar to Cannot add the same instance of "{0}" to a "{1}" more than once.. Looks up a localized string similar to The event "{0}" on type "{1}" has an incompatible signature. Make sure the event is public and satisfies the EventHandler delegate.. Looks up a localized string similar to Cannot find an event named "{0}" on type "{1}".. Looks up a localized string similar to An object of type "{0}" cannot have a {3} property of type "{1}". Instances of type "{0}" can have only a {3} property of type "{2}".. Looks up a localized string similar to Cannot attach type "{0}" to type "{1}". Instances of type "{0}" can only be attached to objects of type "{2}".. Looks up a localized string similar to Unable to resolve TargetName "{0}".. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/net45/Caliburn.Micro.Platform.Core.xml ================================================ Caliburn.Micro.Platform.Core A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets a collection of the public types defined in this assembly that are visible outside the assembly. The assembly. A collection of the public types defined in this assembly that are visible outside the assembly. Returns a value that indicates whether the specified type can be assigned to the current type. The target type The type to check. true if the specified type can be assigned to this type; otherwise, false. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/net45/Caliburn.Micro.Platform.xml ================================================ Caliburn.Micro.Platform A host for action related attached properties. A property definition representing the target of an . The DataContext of the element will be set to this instance. A property definition representing the target of an . The DataContext of the element is not set to this instance. Sets the target of the . The element to attach the target to. The target for instances of . Gets the target for instances of . The element to which the target is attached. The target for instances of Sets the target of the . The element to attach the target to. The target for instances of . The DataContext will not be set. Gets the target for instances of . The element to which the target is attached. The target for instances of Checks if the -Target was set. DependencyObject to check True if Target or TargetWithoutContext was set on Uses the action pipeline to invoke the method. The object instance to invoke the method on. The name of the method to invoke. The view. The source of the invocation. The event args. The method parameters. The context used during the execution of an Action or its guard. Determines whether the action can execute. Returns true if the action can execute, false otherwise. Any event arguments associated with the action's invocation. The actual method info to be invoked. The message being executed. The source from which the message originates. The instance on which the action is invoked. The view associated with the target. Gets or sets additional data needed to invoke the action. The data key. Custom data associated with the context. Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Called when the execution context is disposed Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked. Causes the action invocation to "double check" if the action should be invoked by executing the guard immediately before hand. This is disabled by default. If multiple actions are attached to the same element, you may want to enable this so that each individaul action checks its guard regardless of how the UI state appears. Causes the action to throw if it cannot locate the target or the method at invocation time. True by default. Represents the method name of an action message. Represents the parameters of an action message. Creates an instance of . Gets or sets the name of the method to be invoked on the presentation model class. The name of the method. Gets the parameters to pass as part of the method invocation. The parameters. Occurs before the message detaches from the associated object. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Forces an update of the UI's Enabled/Disabled state based on the the preconditions associated with the method. Returns a that represents the current . A that represents the current . Invokes the action using the specified Applies an availability effect, such as IsEnabled, to an element. Returns a value indicating whether or not the action is available. Finds the method on the target matching the specified message. The target. The message. The matching method, if available. Sets the target, method and view on the context. Uses a bubbling strategy by default. Prepares the action execution context for use. Try to find a candidate for guard function, having: - a name matching any of - no generic parameters - a bool return type - no parameters or a set of parameters corresponding to the action method The execution context Method names to look for. A MethodInfo, if found; null otherwise Returns the list of possible names of guard methods / properties for the given method. Hosts dependency properties for binding. Allows binding on an existing view. Use this on root UserControls, Pages and Windows; not in a DataTemplate. Allows binding on an existing view without setting the data context. Use this from within a DataTemplate. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Allows application of conventions at design-time. Gets whether or not conventions are being applied at design-time. The ui to apply conventions to. Whether or not conventions are applied. Sets whether or not do bind conventions at design-time. The ui to apply conventions to. Whether or not to apply conventions. Provides methods for searching a given scope for named elements. Searches through the list of named elements looking for a case-insensitive match. The named elements to search through. The name to search for. The named element or null if not found. Adds a child resolver. The type filter. The resolver. Adds a child resolver. The type filter. The resolver. Removes a child resolver. The resolver to remove. true, when the resolver was (found and) removed. Gets all the instances with names in the scope. Named instances in the provided scope. Pass in a and receive a list of named instances in the same scope. Gets the parent of the given object in the Visual Tree. The parent of the given object in the Visual Tree Finds a set of named instances in each hop in a . Searches all the elements in the parameter as well as the visual children of each of these elements, the , the HeaderedContentControl.Header, the , or the HeaderedItemsControl.Header, if any are found. Finds a path of dependency objects which traces through visual anscestry until a root which is , a , a Page with a dependency object Page.ContentProperty value, a dependency object with set to . and are included in the resulting in order to track which item in an items control we are scoped to. Maintains a connection in the visual tree of dependency objects in order to record a route through it. Gets or sets the starting point of the route. Adds a segment to the route. The source dependency object. The target dependency object. Tries to get a target dependency object given a source. The possible beginning of a route segment (hop). The target of a route segment (hop). if had a target recorded; otherwise. Inherit from this class in order to customize the configuration of the framework. The application. Creates an instance of the bootstrapper. Set this to false when hosting Caliburn.Micro inside and Office or WinForms application. The default is true. Initialize the framework. Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. Provides an opportunity to hook into the application object. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. Override this to add custom behavior to execute after the application starts. The sender. The args. Override this to add custom behavior on exit. The sender. The event args. Override this to add custom behavior for unhandled exceptions. The sender. The event args. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. The optional window settings. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. The optional window settings. Represents a resolver that takes a control and returns it's children Creates the ChildResolver using the given anonymous methods. The filter The resolver Can this resolve appy to the given type. The visual tree type. Returns true if this resolver applies. The element from the visual tree for the children to resolve. Generic strongly typed child resolver The type to filter on Creates a Used to configure the conventions used by the framework to apply bindings and create actions. Converters to/from . Indicates whether or not static properties should be included during convention name matching. False by default. Indicates whether or not the Content of ContentControls should be overwritten by conventional bindings. False by default. The default DataTemplate used for ItemsControls when required. The default DataTemplate used for Headered controls when required. Changes the provided word from a plural form to a singular form. Derives the SelectedItem property name. Creates a binding and sets it on the element, applying the appropriate conventions. Applies the appropriate binding mode to the binding. Determines whether or not and what type of validation to enable on the binding. Determines whether a value converter is is needed and applies one to the binding. Determines whether a custom string format is needed and applies it to the binding. Determines whether a custom update source trigger should be applied to the binding. Adds an element convention. The type of element. The default property for binding conventions. The default property for action parameters. The default event to trigger actions. Adds an element convention. Gets an element convention for the provided element type. The type of element to locate the convention for. The convention if found, null otherwise. Searches the class hierarchy for conventions. Determines whether a particular dependency property already has a binding on the provided element. Creates a binding and sets it on the element, guarding against pre-existing bindings. Creates a binding and set it on the element, guarding against pre-existing bindings and pre-existing values. Attempts to apply the default item template to the items control. The items control. The collection property. Configures the selected item convention. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. Configures the SelectedItem binding for matched selection path. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. The binding to configure. A bool indicating whether to apply binding Applies a header template based on Gets a property by name, ignoring case and searching all interfaces. The type to inspect. The property to search for. The property or null if not found. Class that abstracts the differences in creating a DepedencyProperty / BindableProperty on the different platforms. Register an attached dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred attached dependecy property Register a dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred dependecy property Represents the conventions for a particular element type. The type of element to which the conventions apply. Gets the default property to be used in binding conventions. The default trigger to be used when wiring actions on this element. The default property to be used for parameters of this type in actions. Applies custom conventions for elements of this type. Pass the view model type, property path, property instance, framework element and its convention. Indicates that a message is parameterized. Represents the parameters of a message. Host's attached properties related to routed UI messaging. Places a message handler on this element. The element. The message handler. Gets the message handler for this element. The element. The message handler. A property definition representing attached triggers and messages. Sets the attached triggers and messages. The element to attach to. The parsable attachment text. Gets the attached triggers and messages. The element that was attached to. The parsable attachment text. A service that is capable of properly binding values to a method's parameters and creating instances of . The special parameter values recognized by the message binder along with their resolvers. Parameter names are case insensitive so the specified names are unique and can be used with different case variations Custom converters used by the framework registered by destination type for which they will be selected. The converter is passed the existing value to convert and a "context" object. Determines the parameters that a method should be invoked with. The action execution context. The parameters required to complete the invocation. The actual parameter values. Transforms the textual parameter into the actual parameter. Coerces the provided value to the destination type. The destination type. The provided value. An optional context value which can be used during conversion. The coerced value. Gets the default value for a type. The type. The default value. A collection that can exist as part of a behavior. The type of item in the attached collection. Creates an instance of Attached the collection. The dependency object to attach the collection to. Detaches the collection. Called when an item is added from the collection. The item that was added. Called when an item is removed from the collection. The item that was removed. Implemented by services that provide based navigation. Navigates to the view represented by the given view model. The view model to navigate to. Extra data to populate the view model with. Navigates to the view represented by the given view model. The view model to navigate to. Extra data to populate the view model with. Indicates whether the navigator can navigate back. Indicates whether the navigator can navigate forward. The current content. Stops the loading process. Navigates back. Navigates forward. Removes the most recent entry from the back stack. The entry that was removed. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Raised when a fragment navigation occurs. A basic implementation of designed to adapt the control. Creates an instance of The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. Occurs before navigation The event sender. The event args. Called to check whether or not to close current instance on navigating. The event sender from OnNavigating event. The event args from OnNavigating event. Occurs after navigation The event sender. The event args. Attempts to inject query string parameters from the view into the view model. The view model. The parameter. The source. Indicates whether the navigator can navigate back. Indicates whether the navigator can navigate forward. The current source. The current content. Stops the loading process. Navigates back. Navigates forward. Removes the most recent entry from the back stack. The entry that was removed. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Raised when a fragment navigation occurs. Extension methods related to navigation. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Builds a Uri in a strongly typed fashion, based on a ViewModel. Adds a query string parameter to the Uri. The type of the value. The property. The property value. Itself Attaches a navigation servies to this builder. The navigation service. Itself Navigates to the Uri represented by this builder. Represents a parameter of an . A dependency property representing the parameter's value. Gets or sets the value of the parameter. The value. Gets or sets the owner. When implemented in a derived class, creates a new instance of the derived class. The new instance. Makes the parameter aware of the that it's attached to. The action message. A service that manages windows. Shows a modal dialog for the specified model. The root model. The context. The optional dialog settings. The dialog result. Shows a non-modal window for the specified model. The root model. The context. The optional window settings. Shows a popup at the current mouse position. The root model. The view context. The optional popup settings. A service that manages windows. Shows a modal dialog for the specified model. The root model. The context. The dialog popup settings. The dialog result. Shows a window for the specified model. The root model. The context. The optional window settings. Shows a popup at the current mouse position. The root model. The view context. The optional popup settings. Creates a popup for hosting a popup window. The model. The optional popup settings. The popup. Creates a window. The view model. Whethor or not the window is being shown as a dialog. The view context. The optional popup settings. The window. Makes sure the view is a window is is wrapped by one. The view model. The view. Whethor or not the window is being shown as a dialog. The window. Infers the owner of the window. The window to whose owner needs to be determined. The owner. Creates the page. The root model. The context. The optional popup settings. The page. Ensures the view is a page or provides one. The model. The view. The page. Parses text into a fully functional set of instances with . Parses the specified message text. The target. The message text. The triggers parsed from the text. The function used to generate a trigger. The parameters passed to the method are the the target of the trigger and string representing the trigger. Creates an instance of by parsing out the textual dsl. The target of the message. The textual message dsl. The created message. Function used to parse a string identified as a message. Function used to parse a string identified as a message parameter. Creates a binding on a . The target to which the message is applied. The parameter object. The name of the element to bind to. The path of the element to bind to. The binding mode to use. Hosts attached properties related to view models. A dependency property which allows the framework to track whether a certain element has already been loaded in certain scenarios. A dependency property which marks an element as a name scope root. A dependency property which allows the override of convention application behavior. A dependency property for assigning a context to a particular portion of the UI. A dependency property for attaching a model to the UI. Used by the framework to indicate that this element was generated. Executes the handler immediately if the element is loaded, otherwise wires it to the Loaded event. The element. The handler. true if the handler was executed immediately; false otherwise Executes the handler when the element is unloaded. The element. The handler. Executes the handler the next time the elements's LayoutUpdated event fires. The element. The handler. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Gets the convention application behavior. The element the property is attached to. Whether or not to apply conventions. Sets the convention application behavior. The element to attach the property to. Whether or not to apply conventions. Sets the model. The element to attach the model to. The model. Gets the model. The element the model is attached to. The model. Gets the context. The element the context is attached to. The context. Sets the context. The element to attach the context to. The context. Gets a value that indicates whether the process is running in design mode. A strategy for determining which view to use for a given model. Used to transform names. Separator used when resolving View names for context instances. Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) This method registers a View suffix or synonym so that View Context resolution works properly. It is automatically called internally when calling AddNamespaceMapping(), AddDefaultTypeMapping(), or AddTypeMapping(). It should not need to be called explicitly unless a rule that handles synonyms is added directly through the NameTransformer. Suffix for type name. Should be "View" or synonym of "View". Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Retrieves the view from the IoC container or tries to create it if not found. Pass the type of view as a parameter and recieve an instance of the view. Modifies the name of the type to be used at design time. Transforms a ViewModel type name into all of its possible View type names. Optionally accepts an instance of context object Enumeration of transformed names Arguments: typeName = The name of the ViewModel type being resolved to its companion View. context = An instance of the context or null. Locates the view type based on the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view type. Locates the view for the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view instance. Locates the view for the specified model instance. The view. Pass the model instance, display location (or null) and the context (or null) as parameters and receive a view instance. Transforms a view type into a pack uri. When a view does not contain a code-behind file, we need to automatically call InitializeCompoent. The element to initialize Binds a view to a view model. Gets or sets a value indicating whether to apply conventions by default. true if conventions should be applied by default; otherwise, false. Indicates whether or not the conventions have already been applied to the view. Determines whether a view should have conventions applied to it. The view to check. Whether or not conventions should be applied to the view. Creates data bindings on the view's controls based on the provided properties. Parameters include named Elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Attaches instances of to the view's controls based on the provided methods. Parameters include the named elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Allows the developer to add custom handling of named elements which were not matched by any default conventions. Binds the specified viewModel to the view. Passes the the view model, view and creation context (or null for default) to use in applying binding. A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. A implementation for the XAML platfrom. Initializes a new instance of the class. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/sl5/Caliburn.Micro.Platform.xml ================================================ Caliburn.Micro.Platform A host for action related attached properties. A property definition representing the target of an . The DataContext of the element will be set to this instance. A property definition representing the target of an . The DataContext of the element is not set to this instance. Sets the target of the . The element to attach the target to. The target for instances of . Gets the target for instances of . The element to which the target is attached. The target for instances of Sets the target of the . The element to attach the target to. The target for instances of . The DataContext will not be set. Gets the target for instances of . The element to which the target is attached. The target for instances of Checks if the -Target was set. DependencyObject to check True if Target or TargetWithoutContext was set on Uses the action pipeline to invoke the method. The object instance to invoke the method on. The name of the method to invoke. The view. The source of the invocation. The event args. The method parameters. The context used during the execution of an Action or its guard. Determines whether the action can execute. Returns true if the action can execute, false otherwise. Any event arguments associated with the action's invocation. The actual method info to be invoked. The message being executed. The source from which the message originates. The instance on which the action is invoked. The view associated with the target. Gets or sets additional data needed to invoke the action. The data key. Custom data associated with the context. Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Called when the execution context is disposed Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked. Causes the action invocation to "double check" if the action should be invoked by executing the guard immediately before hand. This is disabled by default. If multiple actions are attached to the same element, you may want to enable this so that each individaul action checks its guard regardless of how the UI state appears. Causes the action to throw if it cannot locate the target or the method at invocation time. True by default. Represents the method name of an action message. Represents the parameters of an action message. Creates an instance of . Gets or sets the name of the method to be invoked on the presentation model class. The name of the method. Gets the parameters to pass as part of the method invocation. The parameters. Occurs before the message detaches from the associated object. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Forces an update of the UI's Enabled/Disabled state based on the the preconditions associated with the method. Returns a that represents the current . A that represents the current . Invokes the action using the specified Applies an availability effect, such as IsEnabled, to an element. Returns a value indicating whether or not the action is available. Finds the method on the target matching the specified message. The target. The message. The matching method, if available. Sets the target, method and view on the context. Uses a bubbling strategy by default. Prepares the action execution context for use. Try to find a candidate for guard function, having: - a name matching any of - no generic parameters - a bool return type - no parameters or a set of parameters corresponding to the action method The execution context Method names to look for. A MethodInfo, if found; null otherwise Returns the list of possible names of guard methods / properties for the given method. A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Hosts dependency properties for binding. Allows binding on an existing view. Use this on root UserControls, Pages and Windows; not in a DataTemplate. Allows binding on an existing view without setting the data context. Use this from within a DataTemplate. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Allows application of conventions at design-time. Gets whether or not conventions are being applied at design-time. The ui to apply conventions to. Whether or not conventions are applied. Sets whether or not do bind conventions at design-time. The ui to apply conventions to. Whether or not to apply conventions. Provides methods for searching a given scope for named elements. Searches through the list of named elements looking for a case-insensitive match. The named elements to search through. The name to search for. The named element or null if not found. Adds a child resolver. The type filter. The resolver. Adds a child resolver. The type filter. The resolver. Removes a child resolver. The resolver to remove. true, when the resolver was (found and) removed. Gets all the instances with names in the scope. Named instances in the provided scope. Pass in a and receive a list of named instances in the same scope. Gets the parent of the given object in the Visual Tree. The parent of the given object in the Visual Tree Finds a set of named instances in each hop in a . Searches all the elements in the parameter as well as the visual children of each of these elements, the , the HeaderedContentControl.Header, the , or the HeaderedItemsControl.Header, if any are found. Finds a path of dependency objects which traces through visual anscestry until a root which is , a , a Page with a dependency object Page.ContentProperty value, a dependency object with set to . and are included in the resulting in order to track which item in an items control we are scoped to. Maintains a connection in the visual tree of dependency objects in order to record a route through it. Gets or sets the starting point of the route. Adds a segment to the route. The source dependency object. The target dependency object. Tries to get a target dependency object given a source. The possible beginning of a route segment (hop). The target of a route segment (hop). if had a target recorded; otherwise. An which converts to . Converts a boolean value to a value. The value produced by the binding source. The type of the binding target property. The converter parameter to use. The culture to use in the converter. A converted value. If the method returns null, the valid null value is used. Converts a value value to a boolean value. The value that is produced by the binding target. The type to convert to. The converter parameter to use. The culture to use in the converter. A converted value. If the method returns null, the valid null value is used. Inherit from this class in order to customize the configuration of the framework. The application. Creates an instance of the bootstrapper. Set this to false when hosting Caliburn.Micro inside and Office or WinForms application. The default is true. Initialize the framework. Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. Provides an opportunity to hook into the application object. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. Override this to add custom behavior to execute after the application starts. The sender. The args. Override this to add custom behavior on exit. The sender. The event args. Override this to add custom behavior for unhandled exceptions. The sender. The event args. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. Represents a resolver that takes a control and returns it's children Creates the ChildResolver using the given anonymous methods. The filter The resolver Can this resolve appy to the given type. The visual tree type. Returns true if this resolver applies. The element from the visual tree for the children to resolve. Generic strongly typed child resolver The type to filter on Creates a Used to configure the conventions used by the framework to apply bindings and create actions. Converters to/from . Indicates whether or not static properties should be included during convention name matching. False by default. Indicates whether or not the Content of ContentControls should be overwritten by conventional bindings. False by default. The default DataTemplate used for ItemsControls when required. The default DataTemplate used for Headered controls when required. Changes the provided word from a plural form to a singular form. Derives the SelectedItem property name. Creates a binding and sets it on the element, applying the appropriate conventions. Applies the appropriate binding mode to the binding. Determines whether or not and what type of validation to enable on the binding. Determines whether a value converter is is needed and applies one to the binding. Determines whether a custom string format is needed and applies it to the binding. Determines whether a custom update source trigger should be applied to the binding. Adds an element convention. The type of element. The default property for binding conventions. The default property for action parameters. The default event to trigger actions. Adds an element convention. Gets an element convention for the provided element type. The type of element to locate the convention for. The convention if found, null otherwise. Searches the class hierarchy for conventions. Determines whether a particular dependency property already has a binding on the provided element. Creates a binding and sets it on the element, guarding against pre-existing bindings. Creates a binding and set it on the element, guarding against pre-existing bindings and pre-existing values. Attempts to apply the default item template to the items control. The items control. The collection property. Configures the selected item convention. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. Configures the SelectedItem binding for matched selection path. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. The binding to configure. A bool indicating whether to apply binding Applies a header template based on Gets a property by name, ignoring case and searching all interfaces. The type to inspect. The property to search for. The property or null if not found. Class that abstracts the differences in creating a DepedencyProperty / BindableProperty on the different platforms. Register an attached dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred attached dependecy property Register a dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred dependecy property Represents the conventions for a particular element type. The type of element to which the conventions apply. Gets the default property to be used in binding conventions. The default trigger to be used when wiring actions on this element. The default property to be used for parameters of this type in actions. Applies custom conventions for elements of this type. Pass the view model type, property path, property instance, framework element and its convention. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Indicates that a message is parameterized. Represents the parameters of a message. Host's attached properties related to routed UI messaging. Places a message handler on this element. The element. The message handler. Gets the message handler for this element. The element. The message handler. A property definition representing attached triggers and messages. Sets the attached triggers and messages. The element to attach to. The parsable attachment text. Gets the attached triggers and messages. The element that was attached to. The parsable attachment text. A service that is capable of properly binding values to a method's parameters and creating instances of . The special parameter values recognized by the message binder along with their resolvers. Parameter names are case insensitive so the specified names are unique and can be used with different case variations Custom converters used by the framework registered by destination type for which they will be selected. The converter is passed the existing value to convert and a "context" object. Determines the parameters that a method should be invoked with. The action execution context. The parameters required to complete the invocation. The actual parameter values. Transforms the textual parameter into the actual parameter. Coerces the provided value to the destination type. The destination type. The provided value. An optional context value which can be used during conversion. The coerced value. Gets the default value for a type. The type. The default value. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text Parses text into a fully functional set of instances with . Parses the specified message text. The target. The message text. The triggers parsed from the text. The function used to generate a trigger. The parameters passed to the method are the the target of the trigger and string representing the trigger. Creates an instance of by parsing out the textual dsl. The target of the message. The textual message dsl. The created message. Function used to parse a string identified as a message. Function used to parse a string identified as a message parameter. Creates a binding on a . The target to which the message is applied. The parameter object. The name of the element to bind to. The path of the element to bind to. The binding mode to use. Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name A collection that can exist as part of a behavior. The type of item in the attached collection. Creates an instance of Attached the collection. The dependency object to attach the collection to. Detaches the collection. Called when an item is added from the collection. The item that was added. Called when an item is removed from the collection. The item that was removed. Implemented by services that provide based navigation. The source. Indicates whether the navigator can navigate back. Indicates whether the navigator can navigate forward. The current source. The current content. Stops the loading process. Navigates back. Navigates forward. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Raised when a fragment navigation occurs. A basic implementation of designed to adapt the control. Creates an instance of The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. Occurs before navigation The event sender. The event args. Called to check whether or not to close current instance on navigating. The event sender from OnNavigating event. The event args from OnNavigating event. Occurs after navigation The event sender. The event args. Attempts to inject query string parameters from the view into the view model. The view model. The page. The source. Indicates whether the navigator can navigate back. Indicates whether the navigator can navigate forward. The current source. The current content. Stops the loading process. Navigates back. Navigates forward. Navigates to the specified . The to navigate to. Whether or not navigation succeeded. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Raised when a fragment navigation occurs. A mouse helper utility. The current position of the mouse. Initializes the mouse helper with the UIElement to use in mouse tracking. The UIElement to use for mouse tracking. Extension methods related to navigation. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Builds a Uri in a strongly typed fashion, based on a ViewModel. Adds a query string parameter to the Uri. The type of the value. The property. The property value. Itself Attaches a navigation servies to this builder. The navigation service. Itself Navigates to the Uri represented by this builder. Builds the URI. A uri constructed with the current configuration information. Represents a parameter of an . A dependency property representing the parameter's value. Gets or sets the value of the parameter. The value. Gets or sets the owner. Makes the parameter aware of the that it's attached to. The action message. A service that manages windows. Shows a modal dialog for the specified model. The root model. The optional dialog settings. The context. Shows a toast notification for the specified model. The root model. How long the notification should appear for. The optional notification settings. The context. Shows a popup at the current mouse position. The root model. The view context. The optional popup settings. A service that manages windows. Shows a modal dialog for the specified model. The root model. The context. The optional dialog settings. Shows a toast notification for the specified model. The root model. How long the notification should appear for. The context. The optional notification settings. Shows a popup at the current mouse position. The root model. The view context. The optional popup settings. Creates a popup for hosting a popup window. The model. The optional popup settings. The popup. Ensures that the view is a or is wrapped by one. The view model. The view. The window. Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Provides information about the characteristics for a component, such as its attributes, properties, and events. This class cannot be inherited. Returns a type converter for the specified type. The System.Type of the target component. A System.ComponentModel.TypeConverter for the specified type. Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". Hosts attached properties related to view models. A dependency property which allows the framework to track whether a certain element has already been loaded in certain scenarios. A dependency property which marks an element as a name scope root. A dependency property which allows the override of convention application behavior. A dependency property for assigning a context to a particular portion of the UI. A dependency property for attaching a model to the UI. Used by the framework to indicate that this element was generated. Executes the handler immediately if the element is loaded, otherwise wires it to the Loaded event. The element. The handler. true if the handler was executed immediately; false otherwise Executes the handler when the element is unloaded. The element. The handler. Executes the handler the next time the elements's LayoutUpdated event fires. The element. The handler. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Gets the convention application behavior. The element the property is attached to. Whether or not to apply conventions. Sets the convention application behavior. The element to attach the property to. Whether or not to apply conventions. Sets the model. The element to attach the model to. The model. Gets the model. The element the model is attached to. The model. Gets the context. The element the context is attached to. The context. Sets the context. The element to attach the context to. The context. Gets a value that indicates whether the process is running in design mode. A strategy for determining which view to use for a given model. Used to transform names. Separator used when resolving View names for context instances. Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) This method registers a View suffix or synonym so that View Context resolution works properly. It is automatically called internally when calling AddNamespaceMapping(), AddDefaultTypeMapping(), or AddTypeMapping(). It should not need to be called explicitly unless a rule that handles synonyms is added directly through the NameTransformer. Suffix for type name. Should be "View" or synonym of "View". Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Retrieves the view from the IoC container or tries to create it if not found. Pass the type of view as a parameter and recieve an instance of the view. Modifies the name of the type to be used at design time. Transforms a ViewModel type name into all of its possible View type names. Optionally accepts an instance of context object Enumeration of transformed names Arguments: typeName = The name of the ViewModel type being resolved to its companion View. context = An instance of the context or null. Locates the view type based on the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view type. Locates the view for the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view instance. Locates the view for the specified model instance. The view. Pass the model instance, display location (or null) and the context (or null) as parameters and receive a view instance. Transforms a view type into a pack uri. When a view does not contain a code-behind file, we need to automatically call InitializeCompoent. The element to initialize Binds a view to a view model. Gets or sets a value indicating whether to apply conventions by default. true if conventions should be applied by default; otherwise, false. Indicates whether or not the conventions have already been applied to the view. Determines whether a view should have conventions applied to it. The view to check. Whether or not conventions should be applied to the view. Creates data bindings on the view's controls based on the provided properties. Parameters include named Elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Attaches instances of to the view's controls based on the provided methods. Parameters include the named elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Allows the developer to add custom handling of named elements which were not matched by any default conventions. Binds the specified viewModel to the view. Passes the the view model, view and creation context (or null for default) to use in applying binding. A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. A implementation for the XAML platfrom. Initializes a new instance of the class. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/uap10.0/Caliburn.Micro.Platform.Core.xml ================================================ Caliburn.Micro.Platform.Core A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets a collection of the public types defined in this assembly that are visible outside the assembly. The assembly. A collection of the public types defined in this assembly that are visible outside the assembly. Returns a value that indicates whether the specified type can be assigned to the current type. The target type The type to check. true if the specified type can be assigned to this type; otherwise, false. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/uap10.0/Caliburn.Micro.Platform.UWP/Properties/Caliburn.Micro.Platform.UWP.rd.xml ================================================ ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/uap10.0/Caliburn.Micro.Platform.UWP.XML ================================================ Caliburn.Micro.Platform.UWP A host for action related attached properties. A property definition representing the target of an . The DataContext of the element will be set to this instance. A property definition representing the target of an . The DataContext of the element is not set to this instance. Sets the target of the . The element to attach the target to. The target for instances of . Gets the target for instances of . The element to which the target is attached. The target for instances of Sets the target of the . The element to attach the target to. The target for instances of . The DataContext will not be set. Gets the target for instances of . The element to which the target is attached. The target for instances of Checks if the -Target was set. DependencyObject to check True if Target or TargetWithoutContext was set on Uses the action pipeline to invoke the method. The object instance to invoke the method on. The name of the method to invoke. The view. The source of the invocation. The event args. The method parameters. The context used during the execution of an Action or its guard. Determines whether the action can execute. Returns true if the action can execute, false otherwise. Any event arguments associated with the action's invocation. The actual method info to be invoked. The message being executed. The source from which the message originates. The instance on which the action is invoked. The view associated with the target. Gets or sets additional data needed to invoke the action. The data key. Custom data associated with the context. Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Called when the execution context is disposed Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked. Causes the action invocation to "double check" if the action should be invoked by executing the guard immediately before hand. This is disabled by default. If multiple actions are attached to the same element, you may want to enable this so that each individaul action checks its guard regardless of how the UI state appears. Causes the action to throw if it cannot locate the target or the method at invocation time. True by default. Represents the method name of an action message. Represents the parameters of an action message. Creates an instance of . Gets or sets the name of the method to be invoked on the presentation model class. The name of the method. Gets the parameters to pass as part of the method invocation. The parameters. Occurs before the message detaches from the associated object. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Forces an update of the UI's Enabled/Disabled state based on the the preconditions associated with the method. Returns a that represents the current . A that represents the current . Invokes the action using the specified Applies an availability effect, such as IsEnabled, to an element. Returns a value indicating whether or not the action is available. Finds the method on the target matching the specified message. The target. The message. The matching method, if available. Sets the target, method and view on the context. Uses a bubbling strategy by default. Prepares the action execution context for use. Try to find a candidate for guard function, having: - a name matching any of - no generic parameters - a bool return type - no parameters or a set of parameters corresponding to the action method The execution context Method names to look for. A MethodInfo, if found; null otherwise Returns the list of possible names of guard methods / properties for the given method. Hosts dependency properties for binding. Allows binding on an existing view. Use this on root UserControls, Pages and Windows; not in a DataTemplate. Allows binding on an existing view without setting the data context. Use this from within a DataTemplate. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Allows application of conventions at design-time. Gets whether or not conventions are being applied at design-time. The ui to apply conventions to. Whether or not conventions are applied. Sets whether or not do bind conventions at design-time. The ui to apply conventions to. Whether or not to apply conventions. Provides methods for searching a given scope for named elements. Searches through the list of named elements looking for a case-insensitive match. The named elements to search through. The name to search for. The named element or null if not found. Adds a child resolver. The type filter. The resolver. Adds a child resolver. The type filter. The resolver. Removes a child resolver. The resolver to remove. true, when the resolver was (found and) removed. Gets all the instances with names in the scope. Named instances in the provided scope. Pass in a and receive a list of named instances in the same scope. Gets the parent of the given object in the Visual Tree. The parent of the given object in the Visual Tree Finds a set of named instances in each hop in a . Searches all the elements in the parameter as well as the visual children of each of these elements, the , the HeaderedContentControl.Header, the , or the HeaderedItemsControl.Header, if any are found. Finds a path of dependency objects which traces through visual anscestry until a root which is , a , a Page with a dependency object Page.ContentProperty value, a dependency object with set to . and are included in the resulting in order to track which item in an items control we are scoped to. Maintains a connection in the visual tree of dependency objects in order to record a route through it. Gets or sets the starting point of the route. Adds a segment to the route. The source dependency object. The target dependency object. Tries to get a target dependency object given a source. The possible beginning of a route segment (hop). The target of a route segment (hop). if had a target recorded; otherwise. An which converts to . Converts a boolean value to a value. The value produced by the binding source. The type of the binding target property. The converter parameter to use. The language to use in the converter. A converted value. If the method returns null, the valid null value is used. Converts a value value to a boolean value. The value that is produced by the binding target. The type to convert to. The converter parameter to use. The language to use in the converter. A converted value. If the method returns null, the valid null value is used. Represents a resolver that takes a control and returns it's children Creates the ChildResolver using the given anonymous methods. The filter The resolver Can this resolve appy to the given type. The visual tree type. Returns true if this resolver applies. The element from the visual tree for the children to resolve. Generic strongly typed child resolver The type to filter on Creates a Used to configure the conventions used by the framework to apply bindings and create actions. Converters to/from . Indicates whether or not static properties should be included during convention name matching. False by default. Indicates whether or not the Content of ContentControls should be overwritten by conventional bindings. False by default. The default DataTemplate used for ItemsControls when required. The default DataTemplate used for Headered controls when required. Changes the provided word from a plural form to a singular form. Derives the SelectedItem property name. Creates a binding and sets it on the element, applying the appropriate conventions. Applies the appropriate binding mode to the binding. Determines whether or not and what type of validation to enable on the binding. Determines whether a value converter is is needed and applies one to the binding. Determines whether a custom string format is needed and applies it to the binding. Determines whether a custom update source trigger should be applied to the binding. Adds an element convention. The type of element. The default property for binding conventions. The default property for action parameters. The default event to trigger actions. Adds an element convention. Gets an element convention for the provided element type. The type of element to locate the convention for. The convention if found, null otherwise. Searches the class hierarchy for conventions. Determines whether a particular dependency property already has a binding on the provided element. Creates a binding and sets it on the element, guarding against pre-existing bindings. Creates a binding and set it on the element, guarding against pre-existing bindings and pre-existing values. Attempts to apply the default item template to the items control. The items control. The collection property. Configures the selected item convention. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. Configures the SelectedItem binding for matched selection path. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. The binding to configure. A bool indicating whether to apply binding Applies a header template based on Gets a property by name, ignoring case and searching all interfaces. The type to inspect. The property to search for. The property or null if not found. Class that abstracts the differences in creating a DepedencyProperty / BindableProperty on the different platforms. Register an attached dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred attached dependecy property Register a dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred dependecy property Represents the conventions for a particular element type. The type of element to which the conventions apply. Gets the default property to be used in binding conventions. The default trigger to be used when wiring actions on this element. The default property to be used for parameters of this type in actions. Applies custom conventions for elements of this type. Pass the view model type, property path, property instance, framework element and its convention. Indicates that a message is parameterized. Represents the parameters of a message. Host's attached properties related to routed UI messaging. Places a message handler on this element. The element. The message handler. Gets the message handler for this element. The element. The message handler. A property definition representing attached triggers and messages. Sets the attached triggers and messages. The element to attach to. The parsable attachment text. Gets the attached triggers and messages. The element that was attached to. The parsable attachment text. A service that is capable of properly binding values to a method's parameters and creating instances of . The special parameter values recognized by the message binder along with their resolvers. Parameter names are case insensitive so the specified names are unique and can be used with different case variations Custom converters used by the framework registered by destination type for which they will be selected. The converter is passed the existing value to convert and a "context" object. Determines the parameters that a method should be invoked with. The action execution context. The parameters required to complete the invocation. The actual parameter values. Transforms the textual parameter into the actual parameter. Coerces the provided value to the destination type. The destination type. The provided value. An optional context value which can be used during conversion. The coerced value. Gets the default value for a type. The type. The default value. Parses text into a fully functional set of instances with . Parses the specified message text. The target. The message text. The triggers parsed from the text. The function used to generate a trigger. The parameters passed to the method are the the target of the trigger and string representing the trigger. Creates an instance of by parsing out the textual dsl. The target of the message. The textual message dsl. The created message. Function used to parse a string identified as a message. Function used to parse a string identified as a message parameter. Creates a binding on a . The target to which the message is applied. The parameter object. The name of the element to bind to. The path of the element to bind to. The binding mode to use. Hosts attached properties related to view models. A dependency property which allows the framework to track whether a certain element has already been loaded in certain scenarios. A dependency property which marks an element as a name scope root. A dependency property which allows the override of convention application behavior. A dependency property for assigning a context to a particular portion of the UI. A dependency property for attaching a model to the UI. Used by the framework to indicate that this element was generated. Executes the handler immediately if the element is loaded, otherwise wires it to the Loaded event. The element. The handler. true if the handler was executed immediately; false otherwise Executes the handler when the element is unloaded. The element. The handler. Determines whether the specified is loaded. The element. true if the element is loaded; otherwise, false. Executes the handler the next time the elements's LayoutUpdated event fires. The element. The handler. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Gets the convention application behavior. The element the property is attached to. Whether or not to apply conventions. Sets the convention application behavior. The element to attach the property to. Whether or not to apply conventions. Sets the model. The element to attach the model to. The model. Gets the model. The element the model is attached to. The model. Gets the context. The element the context is attached to. The context. Sets the context. The element to attach the context to. The context. Gets a value that indicates whether the process is running in design mode. A strategy for determining which view to use for a given model. Used to transform names. Separator used when resolving View names for context instances. Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) This method registers a View suffix or synonym so that View Context resolution works properly. It is automatically called internally when calling AddNamespaceMapping(), AddDefaultTypeMapping(), or AddTypeMapping(). It should not need to be called explicitly unless a rule that handles synonyms is added directly through the NameTransformer. Suffix for type name. Should be "View" or synonym of "View". Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Retrieves the view from the IoC container or tries to create it if not found. Pass the type of view as a parameter and recieve an instance of the view. Modifies the name of the type to be used at design time. Transforms a ViewModel type name into all of its possible View type names. Optionally accepts an instance of context object Enumeration of transformed names Arguments: typeName = The name of the ViewModel type being resolved to its companion View. context = An instance of the context or null. Locates the view type based on the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view type. Locates the view for the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view instance. Locates the view for the specified model instance. The view. Pass the model instance, display location (or null) and the context (or null) as parameters and receive a view instance. Transforms a view type into a pack uri. When a view does not contain a code-behind file, we need to automatically call InitializeCompoent. The element to initialize Binds a view to a view model. Gets or sets a value indicating whether to apply conventions by default. true if conventions should be applied by default; otherwise, false. Indicates whether or not the conventions have already been applied to the view. Determines whether a view should have conventions applied to it. The view to check. Whether or not conventions should be applied to the view. Creates data bindings on the view's controls based on the provided properties. Parameters include named Elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Attaches instances of to the view's controls based on the provided methods. Parameters include the named elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Allows the developer to add custom handling of named elements which were not matched by any default conventions. Binds the specified viewModel to the view. Passes the the view model, view and creation context (or null for default) to use in applying binding. A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. A collection that can exist as part of a behavior. The type of item in the attached collection. Creates an instance of Attaches the collection. The dependency object to attach the collection to. Detaches the collection. The currently attached object. Called when an item is added from the collection. The item that was added. Called when an item is removed from the collection. The item that was removed. A basic implementation of designed to adapt the control. Creates an instance of . The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. Occurs before navigation The event sender. The event args. Occurs after navigation The event sender. The event args. Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. Encapsulates the app and its available services. The root frame of the application. Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. Start the framework. Invoked when the application creates a window. Event data for the event. Provides an opportunity to hook into the application object. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. Override this to add custom behavior when the application transitions from Suspended state to Running state. The sender. The event args. Override this to add custom behavior when the application transitions to Suspended state from some other state. The sender. The event args. Override this to add custom behavior for unhandled exceptions. The sender. The event args. Creates the root frame used by the application. The frame. Allows you to trigger the creation of the RootFrame from Configure if necessary. Override this to register a navigation service. The root frame of the application. Creates the root frame and navigates to the specified view. The view type to navigate to. The object parameter to pass to the target. Creates the root frame and navigates to the specified view. The view type to navigate to. The object parameter to pass to the target. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. Interaface usually from the Interactivity SDK's included here for completeness. Attached the specified dependency object Detach from the previously attached object. The currently attached object. Implemented by services that provide ( based) navigation. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Gets or sets the data type of the current content, or the content that should be navigated to. Gets the data type of the content that is currently displayed. Indicates whether the navigator can navigate forward. Indicates whether the navigator can navigate back. Navigates to the specified content. The to navigate to. Whether or not navigation succeeded. Navigates to the specified content. The to navigate to. The object parameter to pass to the target. Whether or not navigation succeeded. Navigates forward. Navigates back. Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. Occurs when the user requests a back navigation via hardware back button or gesture or voice. Stores the frame navigation state in local settings if it can. Whether the suspension was sucessful Tries to restore the frame navigation state from local settings. Whether the restoration of successful. A basic implementation of designed to adapt the control. Creates an instance of . The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. The parameter to the current view Occurs before navigation The event sender. The event args. Occurs after navigation The event sender. The event args. Binds the view model. The view. The view model. Attempts to inject query string parameters from the view into the view model. The view model. The parameter. Called to check whether or not to close current instance on navigating. The event sender from OnNavigating event. The event args from OnNavigating event. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Gets or sets the data type of the current content, or the content that should be navigated to. Gets the data type of the content that is currently displayed. Navigates to the specified content. The to navigate to. Whether or not navigation succeeded. Navigates to the specified content. The to navigate to. The object parameter to pass to the target. Whether or not navigation succeeded. Navigates forward. Navigates back. Indicates whether the navigator can navigate forward. Indicates whether the navigator can navigate back. Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. Stores the frame navigation state in local settings if it can. Whether the suspension was sucessful Tries to restore the frame navigation state from local settings. Whether the restoration of successful. Occurs when the user presses the hardware Back button. Occurs when the user presses the hardware Back button. Allows the handlers to cancel the default behavior. The event arguments Service that handles sharing data with the Share Charm. Programmatically initiates the user interface for sharing content with another app. Denotes a class which is aware of sharing data with the Share charm. Called when a share operation starts. The data request. Builds a Uri in a strongly typed fashion, based on a ViewModel. Adds a query string parameter to the Uri. The type of the value. The property. The property value. Itself Attaches a navigation servies to this builder. The navigation service. Itself Navigates to the Uri represented by this builder. Builds the URI. A uri constructed with the current configuration information. Extension methods for Navigates to the specified content. The navigation service. The object parameter to pass to the target. The to navigate to. Whether or not navigation succeeded. Navigate to the specified model type. The navigation service. The model type to navigate to. The object parameter to pass to the target. Whether or not navigation succeeded. Navigate to the specified model type. The navigation service. The object parameter to pass to the target. The model type to navigate to. Whether or not navigation succeeded. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Represents a parameter of an . A dependency property representing the parameter's value. Gets or sets the value of the parameter. The value. Gets or sets the owner. Makes the parameter aware of the that it's attached to. The action message. Service that handles the event. Initializes a new instance of the class. Programmatically initiates the user interface for sharing content with another app. Accepts the share request and forwards it to the view model. The sender. The instance containing the event data. Determines the current view, checks for view first with frame and then view mode first with a shell view. The current view Represents an attachable object that encapsulates a unit of functionality. The associated object property. Gets or sets the object to which this is attached. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Executes the action. The that is passed to the action by the behavior. Generally this is or a target object. The value of this parameter is determined by the caller. Returns the result of the action. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. A custom IoC container which integrates with WinRT and properly registers all Caliburn.Micro services. Registers the Caliburn.Micro WinRT services with the container. Registers the Caliburn.Micro navigation service with the container. The application root frame. if set to true [treat view as loaded]. if set to true then navigation service cache view models for resuse. Registers the Caliburn.Micro sharing service with the container. Implements XAML schema context concepts that support XAML parsing. Implements XAML schema context access to underlying type mapping, based on providing a helper value that describes a type. The type as represented by the relevant type system or interop support type. The schema context's implementation of the concept. Implements XAML schema context access to underlying type mapping, based on specifying a full type name. The name of the class for which to return a XAML type mapping. The schema context's implementation of the IXamlType concept. Gets the set of XMLNS (XAML namespace) definitions that apply to the context. The set of XMLNS (XAML namespace) definitions. A implementation for the XAML platfrom. Initializes a new instance of the class. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/win81/Caliburn.Micro.Platform.Core.xml ================================================ Caliburn.Micro.Platform.Core A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets a collection of the public types defined in this assembly that are visible outside the assembly. The assembly. A collection of the public types defined in this assembly that are visible outside the assembly. Returns a value that indicates whether the specified type can be assigned to the current type. The target type The type to check. true if the specified type can be assigned to this type; otherwise, false. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/win81/Caliburn.Micro.Platform.XML ================================================ Caliburn.Micro.Platform A host for action related attached properties. A property definition representing the target of an . The DataContext of the element will be set to this instance. A property definition representing the target of an . The DataContext of the element is not set to this instance. Sets the target of the . The element to attach the target to. The target for instances of . Gets the target for instances of . The element to which the target is attached. The target for instances of Sets the target of the . The element to attach the target to. The target for instances of . The DataContext will not be set. Gets the target for instances of . The element to which the target is attached. The target for instances of Checks if the -Target was set. DependencyObject to check True if Target or TargetWithoutContext was set on Uses the action pipeline to invoke the method. The object instance to invoke the method on. The name of the method to invoke. The view. The source of the invocation. The event args. The method parameters. The context used during the execution of an Action or its guard. Determines whether the action can execute. Returns true if the action can execute, false otherwise. Any event arguments associated with the action's invocation. The actual method info to be invoked. The message being executed. The source from which the message originates. The instance on which the action is invoked. The view associated with the target. Gets or sets additional data needed to invoke the action. The data key. Custom data associated with the context. Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Called when the execution context is disposed Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked. Causes the action invocation to "double check" if the action should be invoked by executing the guard immediately before hand. This is disabled by default. If multiple actions are attached to the same element, you may want to enable this so that each individaul action checks its guard regardless of how the UI state appears. Causes the action to throw if it cannot locate the target or the method at invocation time. True by default. Represents the method name of an action message. Represents the parameters of an action message. Creates an instance of . Gets or sets the name of the method to be invoked on the presentation model class. The name of the method. Gets the parameters to pass as part of the method invocation. The parameters. Occurs before the message detaches from the associated object. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Forces an update of the UI's Enabled/Disabled state based on the the preconditions associated with the method. Returns a that represents the current . A that represents the current . Invokes the action using the specified Applies an availability effect, such as IsEnabled, to an element. Returns a value indicating whether or not the action is available. Finds the method on the target matching the specified message. The target. The message. The matching method, if available. Sets the target, method and view on the context. Uses a bubbling strategy by default. Prepares the action execution context for use. Try to find a candidate for guard function, having: - a name matching any of - no generic parameters - a bool return type - no parameters or a set of parameters corresponding to the action method The execution context Method names to look for. A MethodInfo, if found; null otherwise Returns the list of possible names of guard methods / properties for the given method. Hosts dependency properties for binding. Allows binding on an existing view. Use this on root UserControls, Pages and Windows; not in a DataTemplate. Allows binding on an existing view without setting the data context. Use this from within a DataTemplate. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Allows application of conventions at design-time. Gets whether or not conventions are being applied at design-time. The ui to apply conventions to. Whether or not conventions are applied. Sets whether or not do bind conventions at design-time. The ui to apply conventions to. Whether or not to apply conventions. Provides methods for searching a given scope for named elements. Searches through the list of named elements looking for a case-insensitive match. The named elements to search through. The name to search for. The named element or null if not found. Adds a child resolver. The type filter. The resolver. Adds a child resolver. The type filter. The resolver. Removes a child resolver. The resolver to remove. true, when the resolver was (found and) removed. Gets all the instances with names in the scope. Named instances in the provided scope. Pass in a and receive a list of named instances in the same scope. Gets the parent of the given object in the Visual Tree. The parent of the given object in the Visual Tree Finds a set of named instances in each hop in a . Searches all the elements in the parameter as well as the visual children of each of these elements, the , the HeaderedContentControl.Header, the , or the HeaderedItemsControl.Header, if any are found. Finds a path of dependency objects which traces through visual anscestry until a root which is , a , a Page with a dependency object Page.ContentProperty value, a dependency object with set to . and are included in the resulting in order to track which item in an items control we are scoped to. Maintains a connection in the visual tree of dependency objects in order to record a route through it. Gets or sets the starting point of the route. Adds a segment to the route. The source dependency object. The target dependency object. Tries to get a target dependency object given a source. The possible beginning of a route segment (hop). The target of a route segment (hop). if had a target recorded; otherwise. An which converts to . Converts a boolean value to a value. The value produced by the binding source. The type of the binding target property. The converter parameter to use. The language to use in the converter. A converted value. If the method returns null, the valid null value is used. Converts a value value to a boolean value. The value that is produced by the binding target. The type to convert to. The converter parameter to use. The language to use in the converter. A converted value. If the method returns null, the valid null value is used. Class that abstracts the differences in creating a DepedencyProperty / BindableProperty on the different platforms. Register an attached dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred attached dependecy property Register a dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred dependecy property Represents a resolver that takes a control and returns it's children Creates the ChildResolver using the given anonymous methods. The filter The resolver Can this resolve appy to the given type. The visual tree type. Returns true if this resolver applies. The element from the visual tree for the children to resolve. Generic strongly typed child resolver The type to filter on Creates a A collection that can exist as part of a behavior. The type of item in the attached collection. Creates an instance of Attaches the collection. The dependency object to attach the collection to. Detaches the collection. The currently attached object. Called when an item is added from the collection. The item that was added. Called when an item is removed from the collection. The item that was removed. Represents a flyout command registered with the . Initializes a new instance of the class. The label to use in the settings charm. The view model to display. Additional settings to pass to the . The view model to display. Additional settings to pass to the . Called when the command was selected in the Settings Charm. A basic implementation of designed to adapt the control. Creates an instance of . The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. Occurs before navigation The event sender. The event args. Occurs after navigation The event sender. The event args. Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. Interaface usually from the Interactivity SDK's included here for completeness. Attached the specified dependency object Detach from the previously attached object. The currently attached object. Service that handles the Settings Charm. Displays the Settings Charm pane to the user. Registers a flyout command with the service. The commands view model. The command label. The optional flyout view settings. Registers a URI command with the service. The label. The URI. Registers a settings command with the service. The command to register. The settings window manager. Shows a settings flyout panel for the specified model. The settings view model. The settings command label. The optional dialog settings. Whether to show the settings flyout as an independent one. Service that handles sharing data with the Share Charm. Programmatically initiates the user interface for sharing content with another app. Denotes a class which is aware of sharing data with the Share charm. Called when a share operation starts. The data request. Builds a Uri in a strongly typed fashion, based on a ViewModel. Adds a query string parameter to the Uri. The type of the value. The property. The property value. Itself Attaches a navigation servies to this builder. The navigation service. Itself Navigates to the Uri represented by this builder. Builds the URI. A uri constructed with the current configuration information. Extension methods for Navigates to the specified content. The navigation service. The object parameter to pass to the target. The to navigate to. Whether or not navigation succeeded. Navigate to the specified model type. The navigation service. The model type to navigate to. The object parameter to pass to the target. Whether or not navigation succeeded. Navigate to the specified model type. The navigation service. The object parameter to pass to the target. The model type to navigate to. Whether or not navigation succeeded. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Represents a command registered with the Initializes a new instance of the class. The label. Gets the label. Called when the command was selected in the Settings Charm. Serivce tha handles the settings charm Initializes a new instance of the class. The window manager used to open the settings views. Displays the Settings Charm pane to the user. Registers a flyout command with the service. The commands view model. The command label. The optional flyout view settings. Registers a URI command with the service. The label. The URI. Registers a settings command with the service. The command to register. Occurs when the user opens the settings pane. The sender. The instance containing the event data. Called when a settings command was selected in the Settings Charm. The settings command. An implementation of the using the default Windows 8.1 controls Shows a settings flyout panel for the specified model. The settings view model. The settings command label. The optional dialog settings. Show settings independent from . Service that handles the event. Initializes a new instance of the class. Programmatically initiates the user interface for sharing content with another app. Accepts the share request and forwards it to the view model. The sender. The instance containing the event data. Determines the current view, checks for view first with frame and then view mode first with a shell view. The current view Represents an attachable object that encapsulates a unit of functionality. The associated object property. Gets or sets the object to which this is attached. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Executes the action. The that is passed to the action by the behavior. Generally this is or a target object. The value of this parameter is determined by the caller. Returns the result of the action. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. Represents a URI command registered with the . Initializes a new instance of the class. The label. The URI. Gets the URI. Called when the command was selected in the Settings Charm. A custom IoC container which integrates with WinRT and properly registers all Caliburn.Micro services. Registers the Caliburn.Micro WinRT services with the container. Registers the Caliburn.Micro navigation service with the container. The application root frame. if set to true [treat view as loaded]. if set to true then navigation service cache view models for resuse. Registers the Caliburn.Micro sharing service with the container. Registers the Caliburn.Micro settings service with the container. A implementation for the XAML platfrom. Initializes a new instance of the class. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. Used to configure the conventions used by the framework to apply bindings and create actions. Converters to/from . Indicates whether or not static properties should be included during convention name matching. False by default. Indicates whether or not the Content of ContentControls should be overwritten by conventional bindings. False by default. The default DataTemplate used for ItemsControls when required. The default DataTemplate used for Headered controls when required. Changes the provided word from a plural form to a singular form. Derives the SelectedItem property name. Creates a binding and sets it on the element, applying the appropriate conventions. Applies the appropriate binding mode to the binding. Determines whether or not and what type of validation to enable on the binding. Determines whether a value converter is is needed and applies one to the binding. Determines whether a custom string format is needed and applies it to the binding. Determines whether a custom update source trigger should be applied to the binding. Adds an element convention. The type of element. The default property for binding conventions. The default property for action parameters. The default event to trigger actions. Adds an element convention. Gets an element convention for the provided element type. The type of element to locate the convention for. The convention if found, null otherwise. Searches the class hierarchy for conventions. Determines whether a particular dependency property already has a binding on the provided element. Creates a binding and sets it on the element, guarding against pre-existing bindings. Creates a binding and set it on the element, guarding against pre-existing bindings and pre-existing values. Attempts to apply the default item template to the items control. The items control. The collection property. Configures the selected item convention. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. Configures the SelectedItem binding for matched selection path. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. The binding to configure. A bool indicating whether to apply binding Applies a header template based on Gets a property by name, ignoring case and searching all interfaces. The type to inspect. The property to search for. The property or null if not found. Represents the conventions for a particular element type. The type of element to which the conventions apply. Gets the default property to be used in binding conventions. The default trigger to be used when wiring actions on this element. The default property to be used for parameters of this type in actions. Applies custom conventions for elements of this type. Pass the view model type, property path, property instance, framework element and its convention. Indicates that a message is parameterized. Represents the parameters of a message. Host's attached properties related to routed UI messaging. Places a message handler on this element. The element. The message handler. Gets the message handler for this element. The element. The message handler. A property definition representing attached triggers and messages. Sets the attached triggers and messages. The element to attach to. The parsable attachment text. Gets the attached triggers and messages. The element that was attached to. The parsable attachment text. A service that is capable of properly binding values to a method's parameters and creating instances of . The special parameter values recognized by the message binder along with their resolvers. Parameter names are case insensitive so the specified names are unique and can be used with different case variations Custom converters used by the framework registered by destination type for which they will be selected. The converter is passed the existing value to convert and a "context" object. Determines the parameters that a method should be invoked with. The action execution context. The parameters required to complete the invocation. The actual parameter values. Transforms the textual parameter into the actual parameter. Coerces the provided value to the destination type. The destination type. The provided value. An optional context value which can be used during conversion. The coerced value. Gets the default value for a type. The type. The default value. Parses text into a fully functional set of instances with . Parses the specified message text. The target. The message text. The triggers parsed from the text. The function used to generate a trigger. The parameters passed to the method are the the target of the trigger and string representing the trigger. Creates an instance of by parsing out the textual dsl. The target of the message. The textual message dsl. The created message. Function used to parse a string identified as a message. Function used to parse a string identified as a message parameter. Creates a binding on a . The target to which the message is applied. The parameter object. The name of the element to bind to. The path of the element to bind to. The binding mode to use. Hosts attached properties related to view models. A dependency property which allows the framework to track whether a certain element has already been loaded in certain scenarios. A dependency property which marks an element as a name scope root. A dependency property which allows the override of convention application behavior. A dependency property for assigning a context to a particular portion of the UI. A dependency property for attaching a model to the UI. Used by the framework to indicate that this element was generated. Executes the handler immediately if the element is loaded, otherwise wires it to the Loaded event. The element. The handler. true if the handler was executed immediately; false otherwise Executes the handler when the element is unloaded. The element. The handler. Determines whether the specified is loaded. The element. true if the element is loaded; otherwise, false. Executes the handler the next time the elements's LayoutUpdated event fires. The element. The handler. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Gets the convention application behavior. The element the property is attached to. Whether or not to apply conventions. Sets the convention application behavior. The element to attach the property to. Whether or not to apply conventions. Sets the model. The element to attach the model to. The model. Gets the model. The element the model is attached to. The model. Gets the context. The element the context is attached to. The context. Sets the context. The element to attach the context to. The context. Gets a value that indicates whether the process is running in design mode. A strategy for determining which view to use for a given model. Used to transform names. Separator used when resolving View names for context instances. Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) This method registers a View suffix or synonym so that View Context resolution works properly. It is automatically called internally when calling AddNamespaceMapping(), AddDefaultTypeMapping(), or AddTypeMapping(). It should not need to be called explicitly unless a rule that handles synonyms is added directly through the NameTransformer. Suffix for type name. Should be "View" or synonym of "View". Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Retrieves the view from the IoC container or tries to create it if not found. Pass the type of view as a parameter and recieve an instance of the view. Modifies the name of the type to be used at design time. Transforms a ViewModel type name into all of its possible View type names. Optionally accepts an instance of context object Enumeration of transformed names Arguments: typeName = The name of the ViewModel type being resolved to its companion View. context = An instance of the context or null. Locates the view type based on the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view type. Locates the view for the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view instance. Locates the view for the specified model instance. The view. Pass the model instance, display location (or null) and the context (or null) as parameters and receive a view instance. Transforms a view type into a pack uri. When a view does not contain a code-behind file, we need to automatically call InitializeCompoent. The element to initialize Binds a view to a view model. Gets or sets a value indicating whether to apply conventions by default. true if conventions should be applied by default; otherwise, false. Indicates whether or not the conventions have already been applied to the view. Determines whether a view should have conventions applied to it. The view to check. Whether or not conventions should be applied to the view. Creates data bindings on the view's controls based on the provided properties. Parameters include named Elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Attaches instances of to the view's controls based on the provided methods. Parameters include the named elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Allows the developer to add custom handling of named elements which were not matched by any default conventions. Binds the specified viewModel to the view. Passes the the view model, view and creation context (or null for default) to use in applying binding. A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. Encapsulates the app and its available services. The root frame of the application. Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. Start the framework. Invoked when the application creates a window. Event data for the event. Provides an opportunity to hook into the application object. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. Override this to add custom behavior when the application transitions from Suspended state to Running state. The sender. The event args. Override this to add custom behavior when the application transitions to Suspended state from some other state. The sender. The event args. Override this to add custom behavior for unhandled exceptions. The sender. The event args. Creates the root frame used by the application. The frame. Allows you to trigger the creation of the RootFrame from Configure if necessary. Override this to register a navigation service. The root frame of the application. Creates the root frame and navigates to the specified view. The view type to navigate to. The object parameter to pass to the target. Creates the root frame and navigates to the specified view. The view type to navigate to. The object parameter to pass to the target. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. Implemented by services that provide ( based) navigation. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Gets or sets the data type of the current content, or the content that should be navigated to. Gets the data type of the content that is currently displayed. Indicates whether the navigator can navigate forward. Indicates whether the navigator can navigate back. Navigates to the specified content. The to navigate to. Whether or not navigation succeeded. Navigates to the specified content. The to navigate to. The object parameter to pass to the target. Whether or not navigation succeeded. Navigates forward. Navigates back. Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. Stores the frame navigation state in local settings if it can. Whether the suspension was sucessful Tries to restore the frame navigation state from local settings. Whether the restoration of successful. A basic implementation of designed to adapt the control. Creates an instance of . The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. The parameter to the current view Occurs before navigation The event sender. The event args. Occurs after navigation The event sender. The event args. Binds the view model. The view. The view model. Attempts to inject query string parameters from the view into the view model. The view model. The parameter. Called to check whether or not to close current instance on navigating. The event sender from OnNavigating event. The event args from OnNavigating event. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Gets or sets the data type of the current content, or the content that should be navigated to. Gets the data type of the content that is currently displayed. Navigates to the specified content. The to navigate to. Whether or not navigation succeeded. Navigates to the specified content. The to navigate to. The object parameter to pass to the target. Whether or not navigation succeeded. Navigates forward. Navigates back. Indicates whether the navigator can navigate forward. Indicates whether the navigator can navigate back. Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. Stores the frame navigation state in local settings if it can. Whether the suspension was sucessful Tries to restore the frame navigation state from local settings. Whether the restoration of successful. Represents a parameter of an . A dependency property representing the parameter's value. Gets or sets the value of the parameter. The value. Gets or sets the owner. Makes the parameter aware of the that it's attached to. The action message. Implements XAML schema context concepts that support XAML parsing. Implements XAML schema context access to underlying type mapping, based on providing a helper value that describes a type. The type as represented by the relevant type system or interop support type. The schema context's implementation of the concept. Implements XAML schema context access to underlying type mapping, based on specifying a full type name. The name of the class for which to return a XAML type mapping. The schema context's implementation of the IXamlType concept. Gets the set of XMLNS (XAML namespace) definitions that apply to the context. The set of XMLNS (XAML namespace) definitions. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/wp8/Caliburn.Micro.Platform.Core.xml ================================================ Caliburn.Micro.Platform.Core A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets a collection of the public types defined in this assembly that are visible outside the assembly. The assembly. A collection of the public types defined in this assembly that are visible outside the assembly. Returns a value that indicates whether the specified type can be assigned to the current type. The target type The type to check. true if the specified type can be assigned to this type; otherwise, false. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/wp8/Caliburn.Micro.Platform.xml ================================================ Caliburn.Micro.Platform A host for action related attached properties. A property definition representing the target of an . The DataContext of the element will be set to this instance. A property definition representing the target of an . The DataContext of the element is not set to this instance. Sets the target of the . The element to attach the target to. The target for instances of . Gets the target for instances of . The element to which the target is attached. The target for instances of Sets the target of the . The element to attach the target to. The target for instances of . The DataContext will not be set. Gets the target for instances of . The element to which the target is attached. The target for instances of Checks if the -Target was set. DependencyObject to check True if Target or TargetWithoutContext was set on Uses the action pipeline to invoke the method. The object instance to invoke the method on. The name of the method to invoke. The view. The source of the invocation. The event args. The method parameters. The context used during the execution of an Action or its guard. Determines whether the action can execute. Returns true if the action can execute, false otherwise. Any event arguments associated with the action's invocation. The actual method info to be invoked. The message being executed. The source from which the message originates. The instance on which the action is invoked. The view associated with the target. Gets or sets additional data needed to invoke the action. The data key. Custom data associated with the context. Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Called when the execution context is disposed Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked. Causes the action invocation to "double check" if the action should be invoked by executing the guard immediately before hand. This is disabled by default. If multiple actions are attached to the same element, you may want to enable this so that each individaul action checks its guard regardless of how the UI state appears. Causes the action to throw if it cannot locate the target or the method at invocation time. True by default. Represents the method name of an action message. Represents the parameters of an action message. Creates an instance of . Gets or sets the name of the method to be invoked on the presentation model class. The name of the method. Gets the parameters to pass as part of the method invocation. The parameters. Occurs before the message detaches from the associated object. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Forces an update of the UI's Enabled/Disabled state based on the the preconditions associated with the method. Returns a that represents the current . A that represents the current . Invokes the action using the specified Applies an availability effect, such as IsEnabled, to an element. Returns a value indicating whether or not the action is available. Finds the method on the target matching the specified message. The target. The message. The matching method, if available. Sets the target, method and view on the context. Uses a bubbling strategy by default. Prepares the action execution context for use. Try to find a candidate for guard function, having: - a name matching any of - no generic parameters - a bool return type - no parameters or a set of parameters corresponding to the action method The execution context Method names to look for. A MethodInfo, if found; null otherwise Returns the list of possible names of guard methods / properties for the given method. Hosts dependency properties for binding. Allows binding on an existing view. Use this on root UserControls, Pages and Windows; not in a DataTemplate. Allows binding on an existing view without setting the data context. Use this from within a DataTemplate. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Allows application of conventions at design-time. Gets whether or not conventions are being applied at design-time. The ui to apply conventions to. Whether or not conventions are applied. Sets whether or not do bind conventions at design-time. The ui to apply conventions to. Whether or not to apply conventions. Provides methods for searching a given scope for named elements. Searches through the list of named elements looking for a case-insensitive match. The named elements to search through. The name to search for. The named element or null if not found. Adds a child resolver. The type filter. The resolver. Adds a child resolver. The type filter. The resolver. Removes a child resolver. The resolver to remove. true, when the resolver was (found and) removed. Gets all the instances with names in the scope. Named instances in the provided scope. Pass in a and receive a list of named instances in the same scope. Gets the parent of the given object in the Visual Tree. The parent of the given object in the Visual Tree Finds a set of named instances in each hop in a . Searches all the elements in the parameter as well as the visual children of each of these elements, the , the HeaderedContentControl.Header, the , or the HeaderedItemsControl.Header, if any are found. Finds a path of dependency objects which traces through visual anscestry until a root which is , a , a Page with a dependency object Page.ContentProperty value, a dependency object with set to . and are included in the resulting in order to track which item in an items control we are scoped to. Maintains a connection in the visual tree of dependency objects in order to record a route through it. Gets or sets the starting point of the route. Adds a segment to the route. The source dependency object. The target dependency object. Tries to get a target dependency object given a source. The possible beginning of a route segment (hop). The target of a route segment (hop). if had a target recorded; otherwise. An which converts to . Converts a boolean value to a value. The value produced by the binding source. The type of the binding target property. The converter parameter to use. The culture to use in the converter. A converted value. If the method returns null, the valid null value is used. Converts a value value to a boolean value. The value that is produced by the binding target. The type to convert to. The converter parameter to use. The culture to use in the converter. A converted value. If the method returns null, the valid null value is used. Inherit from this class in order to customize the configuration of the framework. The application. Creates an instance of the bootstrapper. Set this to false when hosting Caliburn.Micro inside and Office or WinForms application. The default is true. Initialize the framework. Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. Provides an opportunity to hook into the application object. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. Override this to add custom behavior to execute after the application starts. The sender. The args. Override this to add custom behavior on exit. The sender. The event args. Override this to add custom behavior for unhandled exceptions. The sender. The event args. Represents a resolver that takes a control and returns it's children Creates the ChildResolver using the given anonymous methods. The filter The resolver Can this resolve appy to the given type. The visual tree type. Returns true if this resolver applies. The element from the visual tree for the children to resolve. Generic strongly typed child resolver The type to filter on Creates a Used to configure the conventions used by the framework to apply bindings and create actions. Converters to/from . Indicates whether or not static properties should be included during convention name matching. False by default. Indicates whether or not the Content of ContentControls should be overwritten by conventional bindings. False by default. The default DataTemplate used for ItemsControls when required. The default DataTemplate used for Headered controls when required. Changes the provided word from a plural form to a singular form. Derives the SelectedItem property name. Creates a binding and sets it on the element, applying the appropriate conventions. Applies the appropriate binding mode to the binding. Determines whether or not and what type of validation to enable on the binding. Determines whether a value converter is is needed and applies one to the binding. Determines whether a custom string format is needed and applies it to the binding. Determines whether a custom update source trigger should be applied to the binding. Adds an element convention. The type of element. The default property for binding conventions. The default property for action parameters. The default event to trigger actions. Adds an element convention. Gets an element convention for the provided element type. The type of element to locate the convention for. The convention if found, null otherwise. Searches the class hierarchy for conventions. Determines whether a particular dependency property already has a binding on the provided element. Creates a binding and sets it on the element, guarding against pre-existing bindings. Creates a binding and set it on the element, guarding against pre-existing bindings and pre-existing values. Attempts to apply the default item template to the items control. The items control. The collection property. Configures the selected item convention. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. Configures the SelectedItem binding for matched selection path. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. The binding to configure. A bool indicating whether to apply binding Applies a header template based on Gets a property by name, ignoring case and searching all interfaces. The type to inspect. The property to search for. The property or null if not found. Accounts for the lack of UpdateSourceTrigger in silverlight. The element to wire for change events on. The property that is being bound. Gets the the binding expression that needs to be updated. The property being bound to if available. The binding if available. Class that abstracts the differences in creating a DepedencyProperty / BindableProperty on the different platforms. Register an attached dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred attached dependecy property Register a dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred dependecy property Represents the conventions for a particular element type. The type of element to which the conventions apply. Gets the default property to be used in binding conventions. The default trigger to be used when wiring actions on this element. The default property to be used for parameters of this type in actions. Applies custom conventions for elements of this type. Pass the view model type, property path, property instance, framework element and its convention. Indicates that a message is parameterized. Represents the parameters of a message. Host's attached properties related to routed UI messaging. Places a message handler on this element. The element. The message handler. Gets the message handler for this element. The element. The message handler. A property definition representing attached triggers and messages. Sets the attached triggers and messages. The element to attach to. The parsable attachment text. Gets the attached triggers and messages. The element that was attached to. The parsable attachment text. A service that is capable of properly binding values to a method's parameters and creating instances of . The special parameter values recognized by the message binder along with their resolvers. Parameter names are case insensitive so the specified names are unique and can be used with different case variations Custom converters used by the framework registered by destination type for which they will be selected. The converter is passed the existing value to convert and a "context" object. Determines the parameters that a method should be invoked with. The action execution context. The parameters required to complete the invocation. The actual parameter values. Transforms the textual parameter into the actual parameter. Coerces the provided value to the destination type. The destination type. The provided value. An optional context value which can be used during conversion. The coerced value. Gets the default value for a type. The type. The default value. Parses text into a fully functional set of instances with . Parses the specified message text. The target. The message text. The triggers parsed from the text. The function used to generate a trigger. The parameters passed to the method are the the target of the trigger and string representing the trigger. Creates an instance of by parsing out the textual dsl. The target of the message. The textual message dsl. The created message. Function used to parse a string identified as a message. Function used to parse a string identified as a message parameter. Creates a binding on a . The target to which the message is applied. The parameter object. The name of the element to bind to. The path of the element to bind to. The binding mode to use. A collection that can exist as part of a behavior. The type of item in the attached collection. Creates an instance of Attached the collection. The dependency object to attach the collection to. Detaches the collection. Called when an item is added from the collection. The item that was added. Called when an item is removed from the collection. The item that was removed. A mouse helper utility. The current position of the mouse. Initializes the mouse helper with the UIElement to use in mouse tracking. The UIElement to use for mouse tracking. Represents a parameter of an . A dependency property representing the parameter's value. Gets or sets the value of the parameter. The value. Gets or sets the owner. Makes the parameter aware of the that it's attached to. The action message. Stores data in the application settings. Initializes a new instance of the class. The container. Indicates what storage modes this mechanism provides. The storage mode to check. Whether or not it is supported. Begins the storage transaction. Stores the value with the specified key. The key. The data. Ends the storage transaction. Tries to get the data previously stored with the specified key. The key. The value. true if found; false otherwise Deletes the data with the specified key. The key. Clears the data stored in the last storage transaction. Registers service with the storage mechanism as a singleton. The service. The key. The implementation. Defines an interface through which the storage system can communicate with an IoC container. Occurs when a new instance is created. Registers the service as a singleton stored in the phone state. The service. The phone state key. The implementation. Registers the service as a singleton stored in the app settings. The service. The app settings key. The implementation. Handles the storage of an object instance. Gets or sets the coordinator. The coordinator. Overrided by inheritors to configure the handler for use. Indicates whether the specified instance can be stored by this handler. The instance. Saves the specified instance. The instance. The mode. Restores the specified instance. The instance. The mode. Implemented by classes that know how to store data. Indicates what storage modes this mechanism provides. The storage mode to check. Whether or not it is supported. Begins the storage transaction. Stores the value with the specified key. The key. The data. Ends the storage transaction. Tries to get the data previously stored with the specified key. The key. The value. true if found; false otherwise Deletes the data with the specified key. The key. Clears the data stored in the last storage transaction. Registers service with the storage mechanism as a singleton. The service. The key. The implementation. Extension methods related to navigation. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Builds a Uri in a strongly typed fashion, based on a ViewModel. Adds a query string parameter to the Uri. The type of the value. The property. The property value. Itself Attaches a navigation servies to this builder. The navigation service. Itself Navigates to the Uri represented by this builder. Builds the URI. A uri constructed with the current configuration information. A custom IoC container which integrates with the phone and properly registers all Caliburn.Micro services. Registers the service as a singleton stored in the phone state. The service. The phone state key. The implementation. Registers the service as a singleton stored in the app settings. The service. The app settings key. The implementation. Registers the Caliburn.Micro services with the container. The root frame of the application. if set to true [treat view as loaded]. Enable the . Enable the . Stores data in the phone state. Initializes a new instance of the class. The container. The phone service. Indicates what storage modes this mechanism provides. The storage mode to check. Whether or not it is supported. Begins the storage transaction. Stores the value with the specified key. The key. The data. Ends the storage transaction. Tries to get the data previously stored with the specified key. The key. The value. true if found; false otherwise Deletes the data with the specified key. The key. Clears the data stored in the last storage transaction. Registers service with the storage mechanism as a singleton. The service. The key. The implementation. Service allowing to play a .wav sound effect Plays a sound effect The uri of the resource containing the .wav file Default implementation, using Xna Framework. The sound effect is played without interrupting the music playback on the phone (which is required for the app certification in the WP7 Marketplace. Also note that using the Xna Framework in a WP7 Silverlight app is explicitly allowed for this very purpose. Plays a sound effect The uri of the resource containing the .wav file Coordinates the saving and loading of objects based on application lifecycle events. Initializes a new instance of the class. The container. The phone service. The storage mechanisms. The handlers. Starts monitoring application and container events. Stops monitoring application and container events. Gets the storage mechanism. The type of storage mechanism to get. The storage mechanism. Adds the storage mechanism. The storage mechanism. Adds the storage handler. The handler. Itself Gets the storage handler for a paricular instance. The instance. The storage handler. Saves all monitored instances according to the provided mode. The save mode. Restores the specified instance. The instance. The restore mode. Handles the storage of a pariticular class. The type that this class handles. Provides a mechanism for obtaining an instance's unique id. The getter. Gets or sets the coordinator. The coordinator. Overrided by inheritors to configure the handler for use. Instructs the handler to store the entire object graph, rather than individual properties. The type of the service. The optional storage key. The builder. Instructs the handler to store a property. The property. The builder. Instructs the handler to store a child object's properties. The property. The builder. This assumes that the parent instance provides the child instance, but that the child instance's properties are handled by a unique handler. Adds a new storage instruction. The builder. Uses this handler to save a particular instance using instructions that support the provided mode. The instance. The storage mode. Uses this handler to restore a particular instance using instructions that support the provided mode. The instance. The mode. An instruction for saving/loading data. The model type. Gets or sets the owner. The owner. Gets or sets the storage mechanism. The storage mechanism. Gets or sets the persistence key. The key. Gets or sets the save action. The save action. Gets or sets the restore action. The restore action. Used to create a fluent interface for building up a storage instruction. Initializes a new instance of the class. The storage instruction. Configures the instruction with the specified behavior. The configuration callback. Itself Extension methods for configuring storage instructions. Stores the data in the transient phone State. The model type. The builder. The builder. Stores the data in the permanent ApplicationSettings. The model type. The builder. The builder. Restores the data when IActivate.Activated is raised. The model type. The builder. The builder. Restores the data after view's Loaded event is raised. The model type. The builder. The builder. Restores the data after view's LayoutUpdated event is raised. The model type. The builder. The builder. Stores the index of the Conductor's ActiveItem. The model type. The handler. The builder. The mode used to save/restore data. Automatic Determine the Mode Use Temporary storage. Use Permenent storage. Use any storage mechanism available. A message which is published when a task completes. The type of the task event args. Optional state provided by the original sender. The results of the task. Handles messages and ensures that the property handler receives the completion message. Initializes a new instance of the class. The phone service. The event aggregator. Starts monitoring for task requests and controlling completion messages. Stops monitoring for task requests and controlling completion messages. Called when the task is compled. The sender. The instance containing the event data. A message that is published to signify a components request for the execution of a particular task. Optional state to be passed along to the task completion message. The task instance. Extension methods related to phone tasks. Creates a task and publishes it using the . The task to create. The event aggregator. Optional configuration for the task. Optional state to be passed along to the task completion message. Allows applications to start and stop vibration on the device. Starts vibration on the device. A TimeSpan object specifying the amount of time for which the phone vibrates. Stops vibration on the device. The default implementation of , using the system controller. Starts vibration on the device. A TimeSpan object specifying the amount of time for which the phone vibrates. Stops vibration on the device. WindowManager extensions Shows a modal dialog for the specified model, using vibrate and audio feedback The WindowManager instance. The root model. The context. If not null, use the specified .wav as opening sound If true, use a vibration feedback on dialog opening A implementation for the XAML platfrom. Initializes a new instance of the class. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. Provides information about the characteristics for a component, such as its attributes, properties, and events. This class cannot be inherited. Returns a type converter for the specified type. The System.Type of the target component. A System.ComponentModel.TypeConverter for the specified type. Hosts attached properties related to view models. A dependency property which allows the framework to track whether a certain element has already been loaded in certain scenarios. A dependency property which marks an element as a name scope root. A dependency property which allows the override of convention application behavior. A dependency property for assigning a context to a particular portion of the UI. A dependency property for attaching a model to the UI. Used by the framework to indicate that this element was generated. Executes the handler immediately if the element is loaded, otherwise wires it to the Loaded event. The element. The handler. true if the handler was executed immediately; false otherwise Executes the handler when the element is unloaded. The element. The handler. Executes the handler the next time the elements's LayoutUpdated event fires. The element. The handler. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Gets the convention application behavior. The element the property is attached to. Whether or not to apply conventions. Sets the convention application behavior. The element to attach the property to. Whether or not to apply conventions. Sets the model. The element to attach the model to. The model. Gets the model. The element the model is attached to. The model. Gets the context. The element the context is attached to. The context. Sets the context. The element to attach the context to. The context. Gets a value that indicates whether the process is running in design mode. A strategy for determining which view to use for a given model. Used to transform names. Separator used when resolving View names for context instances. Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) This method registers a View suffix or synonym so that View Context resolution works properly. It is automatically called internally when calling AddNamespaceMapping(), AddDefaultTypeMapping(), or AddTypeMapping(). It should not need to be called explicitly unless a rule that handles synonyms is added directly through the NameTransformer. Suffix for type name. Should be "View" or synonym of "View". Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Retrieves the view from the IoC container or tries to create it if not found. Pass the type of view as a parameter and recieve an instance of the view. Modifies the name of the type to be used at design time. Transforms a ViewModel type name into all of its possible View type names. Optionally accepts an instance of context object Enumeration of transformed names Arguments: typeName = The name of the ViewModel type being resolved to its companion View. context = An instance of the context or null. Locates the view type based on the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view type. Locates the view for the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view instance. Locates the view for the specified model instance. The view. Pass the model instance, display location (or null) and the context (or null) as parameters and receive a view instance. Transforms a view type into a pack uri. When a view does not contain a code-behind file, we need to automatically call InitializeCompoent. The element to initialize Binds a view to a view model. Gets or sets a value indicating whether to apply conventions by default. true if conventions should be applied by default; otherwise, false. Indicates whether or not the conventions have already been applied to the view. Determines whether a view should have conventions applied to it. The view to check. Whether or not conventions should be applied to the view. Creates data bindings on the view's controls based on the provided properties. Parameters include named Elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Attaches instances of to the view's controls based on the provided methods. Parameters include the named elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Allows the developer to add custom handling of named elements which were not matched by any default conventions. Binds the specified viewModel to the view. Passes the the view model, view and creation context (or null for default) to use in applying binding. A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. The interface for AppBar items capable of triggering action messages. The action message. An capable of triggering action messages. The action message. An capable of triggering action messages. The action message. Implemented by services that provide based navigation. The source. Indicates whether the navigator can navigate back. Indicates whether the navigator can navigate forward. The current source. The current content. Stops the loading process. Navigates back. Navigates forward. Removes the most recent entry from the back stack. The entry that was removed. Gets an IEnumerable that you use to enumerate the entries in back navigation history. List of entries in the back stack. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Raised when a fragment navigation occurs. A basic implementation of designed to adapt the control. Creates an instance of The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. Occurs before navigation The event sender. The event args. Called to check whether or not to close current instance on navigating. The event sender from OnNavigating event. The event args from OnNavigating event. Occurs after navigation The event sender. The event args. Attempts to inject query string parameters from the view into the view model. The view model. The page. The source. Indicates whether the navigator can navigate back. Indicates whether the navigator can navigate forward. The current source. The current content. Stops the loading process. Navigates back. Navigates forward. Navigates to the specified . The to navigate to. Whether or not navigation succeeded. Removes the most recent entry from the back stack. The entry that was removed. Gets an IEnumerable that you use to enumerate the entries in back navigation history. List of entries in the back stack. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Raised when a fragment navigation occurs. Implemented by services that provide access to the basic phone capabilities. The state that is persisted during the tombstoning process. Gets the mode in which the application was started. Occurs when a fresh instance of the application is launching. Occurs when a previously paused/tombstoned app is resumed/resurrected. Occurs when the application is being paused or tombstoned. Occurs when the application is closing. Occurs when the app is continuing from a temporarily paused state. Occurs after the app has continued from a temporarily paused state. Occurs when the app is "resurrecting" from a tombstoned state. Occurs after the app has "resurrected" from a tombstoned state. Gets or sets whether user idle detection is enabled. Gets or sets whether application idle detection is enabled. Gets if the app is currently resurrecting. An implementation of that adapts . Creates an instance of . Gets if the app is currently resurrecting. The state that is persisted during the tombstoning process. Gets the mode in which the application was started. Occurs when a fresh instance of the application is launching. Occurs when a previously paused/tombstoned application instance is resumed/resurrected. Occurs when the application is being paused or tombstoned. Occurs when the application is closing. Occurs when the app is continuing from a temporarily paused state. Occurs after the app has continued from a temporarily paused state. Occurs when the app is "resurrecting" from a tombstoned state. Occurs after the app has "resurrected" from a tombstoned state. Gets or sets whether user idle detection is enabled. Gets or sets whether application idle detection is enabled. A custom bootstrapper designed to setup phone applications. The phone application service. The root frame used for navigation. Initializes a new instance of the class. Provides an opportunity to hook into the application object. Creates the root frame used by the application. The frame. Occurs when a fresh instance of the application is launching. Occurs when a previously tombstoned or paused application is resurrected/resumed. Occurs when the application is being tombstoned or paused. Occurs when the application is closing. Extension methods for Calls TransformToVisual on the specified element for the specified visual, suppressing the ArgumentException that can occur in some cases. Element on which to call TransformToVisual. Visual to pass to the call to TransformToVisual. Resulting GeneralTransform object. A service that manages windows. Shows a modal dialog for the specified model. The root model. The optional dialog settings. The context. Shows a popup at the current mouse position. The root model. The view context. The optional popup settings. A service that manages windows. Predicate used to determine whether a page being navigated is actually a system dialog, which should cause a temporary dialog disappearance. The default implementation just take into account DatePicker and TimePicker pages from WP7 toolkit. /// The destination page to check Shows a modal dialog for the specified model. The root model. The context. The optional dialog settings. Shows a popup at the current mouse position. The root model. The view context. The optional popup settings. Creates a popup for hosting a popup window. The model. The optional popup settings. The popup. ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/wpa81/Caliburn.Micro.Platform.Core.xml ================================================ Caliburn.Micro.Platform.Core A source of assemblies that are inspectable by the framework. The singleton instance of the AssemblySource used by the framework. Finds a type which matches one of the elements in the sequence of names. A caching subsystem for . Extracts the types from the spezified assembly for storing in the cache. Installs the caching subsystem. Generic extension methods used by the framework. Get's the name of the assembly. The assembly. The assembly's name. Gets all the attributes of a particular type. The type of attributes to get. The member to inspect for attributes. Whether or not to search for inherited attributes. The list of attributes found. Gets a collection of the public types defined in this assembly that are visible outside the assembly. The assembly. A collection of the public types defined in this assembly that are visible outside the assembly. Returns a value that indicates whether the specified type can be assigned to the current type. The target type The type to check. true if the specified type can be assigned to this type; otherwise, false. Gets the value for a key. If the key does not exist, return default(TValue); The type of the keys in the dictionary. The type of the values in the dictionary. The dictionary to call this method on. The key to look up. The key value. default(TValue) if this key is not in the dictionary. Class for managing the list of rules for doing name transformation. Flag to indicate if transformations from all matched rules are returned. Otherwise, transformations from only the first matched rule are returned. Adds a transform using a single replacement value and a global filter pattern. Regular expression pattern for replacing text The replacement value. Regular expression pattern for global filtering Adds a transform using a list of replacement values and a global filter pattern. Regular expression pattern for replacing text The list of replacement values Regular expression pattern for global filtering Gets the list of transformations for a given name. The name to transform into the resolved name list The transformed names. Gets the list of transformations for a given name. The name to transform into the resolved name list A function to do a transform on each item in the ReplaceValueList prior to applying the regular expression transform The transformed names. A rule that describes a name transform. Regular expression pattern for global filtering Regular expression pattern for replacing text The list of replacement values Regular expression for global filtering Regular expression for replacing text Helper class for encoding strings to regular expression patterns Regular expression pattern for valid name Regular expression pattern for subnamespace (including dot) Regular expression pattern for namespace or namespace fragment Creates a named capture group with the specified regular expression Name of capture group to create Regular expression pattern to capture Regular expression capture group with the specified group name Converts a namespace (including wildcards) to a regular expression string Source namespace to convert to regular expression Namespace converted to a regular expression Creates a capture group for a valid name regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Creates a capture group for a namespace regular expression pattern Name of capture group to create Regular expression capture group with the specified group name Helper class when splitting strings Splits a string with a chosen separator. If a substring is contained in [...] it will not be splitted. The message to split The separator to use when splitting Splits a string with , as separator. Does not split within {},[],() The string to split Class to specify settings for configuring type mappings by the ViewLocator or ViewModelLocator The default subnamespace for Views. Used for creating default subnamespace mappings. Defaults to "Views". The default subnamespace for ViewModels. Used for creating default subnamespace mappings. Defaults to "ViewModels". Flag to indicate whether or not the name of the Type should be transformed when adding a type mapping. Defaults to true. The format string used to compose the name of a type from base name and name suffix Flag to indicate if ViewModel names should include View suffixes (i.e. CustomerPageViewModel vs. CustomerViewModel) List of View suffixes for which default type mappings should be created. Applies only when UseNameSuffixesInMappings = true. Default values are "View", "Page" The name suffix for ViewModels. Applies only when UseNameSuffixesInMappings = true. The default is "ViewModel". ================================================ FILE: packages/Caliburn.Micro.3.2.0/lib/wpa81/Caliburn.Micro.Platform.xml ================================================ Caliburn.Micro.Platform A host for action related attached properties. A property definition representing the target of an . The DataContext of the element will be set to this instance. A property definition representing the target of an . The DataContext of the element is not set to this instance. Sets the target of the . The element to attach the target to. The target for instances of . Gets the target for instances of . The element to which the target is attached. The target for instances of Sets the target of the . The element to attach the target to. The target for instances of . The DataContext will not be set. Gets the target for instances of . The element to which the target is attached. The target for instances of Checks if the -Target was set. DependencyObject to check True if Target or TargetWithoutContext was set on Uses the action pipeline to invoke the method. The object instance to invoke the method on. The name of the method to invoke. The view. The source of the invocation. The event args. The method parameters. The context used during the execution of an Action or its guard. Determines whether the action can execute. Returns true if the action can execute, false otherwise. Any event arguments associated with the action's invocation. The actual method info to be invoked. The message being executed. The source from which the message originates. The instance on which the action is invoked. The view associated with the target. Gets or sets additional data needed to invoke the action. The data key. Custom data associated with the context. Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Called when the execution context is disposed Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked. Causes the action invocation to "double check" if the action should be invoked by executing the guard immediately before hand. This is disabled by default. If multiple actions are attached to the same element, you may want to enable this so that each individaul action checks its guard regardless of how the UI state appears. Causes the action to throw if it cannot locate the target or the method at invocation time. True by default. Represents the method name of an action message. Represents the parameters of an action message. Creates an instance of . Gets or sets the name of the method to be invoked on the presentation model class. The name of the method. Gets the parameters to pass as part of the method invocation. The parameters. Occurs before the message detaches from the associated object. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Forces an update of the UI's Enabled/Disabled state based on the the preconditions associated with the method. Returns a that represents the current . A that represents the current . Invokes the action using the specified Applies an availability effect, such as IsEnabled, to an element. Returns a value indicating whether or not the action is available. Finds the method on the target matching the specified message. The target. The message. The matching method, if available. Sets the target, method and view on the context. Uses a bubbling strategy by default. Prepares the action execution context for use. Try to find a candidate for guard function, having: - a name matching any of - no generic parameters - a bool return type - no parameters or a set of parameters corresponding to the action method The execution context Method names to look for. A MethodInfo, if found; null otherwise Returns the list of possible names of guard methods / properties for the given method. Hosts dependency properties for binding. Allows binding on an existing view. Use this on root UserControls, Pages and Windows; not in a DataTemplate. Allows binding on an existing view without setting the data context. Use this from within a DataTemplate. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Gets the model to bind to. The dependency object to bind to. The model. Sets the model to bind to. The dependency object to bind to. The model. Allows application of conventions at design-time. Gets whether or not conventions are being applied at design-time. The ui to apply conventions to. Whether or not conventions are applied. Sets whether or not do bind conventions at design-time. The ui to apply conventions to. Whether or not to apply conventions. Provides methods for searching a given scope for named elements. Searches through the list of named elements looking for a case-insensitive match. The named elements to search through. The name to search for. The named element or null if not found. Adds a child resolver. The type filter. The resolver. Adds a child resolver. The type filter. The resolver. Removes a child resolver. The resolver to remove. true, when the resolver was (found and) removed. Gets all the instances with names in the scope. Named instances in the provided scope. Pass in a and receive a list of named instances in the same scope. Gets the parent of the given object in the Visual Tree. The parent of the given object in the Visual Tree Finds a set of named instances in each hop in a . Searches all the elements in the parameter as well as the visual children of each of these elements, the , the HeaderedContentControl.Header, the , or the HeaderedItemsControl.Header, if any are found. Finds a path of dependency objects which traces through visual anscestry until a root which is , a , a Page with a dependency object Page.ContentProperty value, a dependency object with set to . and are included in the resulting in order to track which item in an items control we are scoped to. Maintains a connection in the visual tree of dependency objects in order to record a route through it. Gets or sets the starting point of the route. Adds a segment to the route. The source dependency object. The target dependency object. Tries to get a target dependency object given a source. The possible beginning of a route segment (hop). The target of a route segment (hop). if had a target recorded; otherwise. An which converts to . Converts a boolean value to a value. The value produced by the binding source. The type of the binding target property. The converter parameter to use. The language to use in the converter. A converted value. If the method returns null, the valid null value is used. Converts a value value to a boolean value. The value that is produced by the binding target. The type to convert to. The converter parameter to use. The language to use in the converter. A converted value. If the method returns null, the valid null value is used. Represents a resolver that takes a control and returns it's children Creates the ChildResolver using the given anonymous methods. The filter The resolver Can this resolve appy to the given type. The visual tree type. Returns true if this resolver applies. The element from the visual tree for the children to resolve. Generic strongly typed child resolver The type to filter on Creates a Used to configure the conventions used by the framework to apply bindings and create actions. Converters to/from . Indicates whether or not static properties should be included during convention name matching. False by default. Indicates whether or not the Content of ContentControls should be overwritten by conventional bindings. False by default. The default DataTemplate used for ItemsControls when required. The default DataTemplate used for Headered controls when required. Changes the provided word from a plural form to a singular form. Derives the SelectedItem property name. Creates a binding and sets it on the element, applying the appropriate conventions. Applies the appropriate binding mode to the binding. Determines whether or not and what type of validation to enable on the binding. Determines whether a value converter is is needed and applies one to the binding. Determines whether a custom string format is needed and applies it to the binding. Determines whether a custom update source trigger should be applied to the binding. Adds an element convention. The type of element. The default property for binding conventions. The default property for action parameters. The default event to trigger actions. Adds an element convention. Gets an element convention for the provided element type. The type of element to locate the convention for. The convention if found, null otherwise. Searches the class hierarchy for conventions. Determines whether a particular dependency property already has a binding on the provided element. Creates a binding and sets it on the element, guarding against pre-existing bindings. Creates a binding and set it on the element, guarding against pre-existing bindings and pre-existing values. Attempts to apply the default item template to the items control. The items control. The collection property. Configures the selected item convention. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. Configures the SelectedItem binding for matched selection path. The element that has a SelectedItem property. The SelectedItem property. The view model type. The property path. The binding to configure. A bool indicating whether to apply binding Applies a header template based on Gets a property by name, ignoring case and searching all interfaces. The type to inspect. The property to search for. The property or null if not found. Class that abstracts the differences in creating a DepedencyProperty / BindableProperty on the different platforms. Register an attached dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred attached dependecy property Register a dependency / bindable property The property name The property type The owner type The default value Callback to executed on property changed The registred dependecy property Represents the conventions for a particular element type. The type of element to which the conventions apply. Gets the default property to be used in binding conventions. The default trigger to be used when wiring actions on this element. The default property to be used for parameters of this type in actions. Applies custom conventions for elements of this type. Pass the view model type, property path, property instance, framework element and its convention. Indicates that a message is parameterized. Represents the parameters of a message. Host's attached properties related to routed UI messaging. Places a message handler on this element. The element. The message handler. Gets the message handler for this element. The element. The message handler. A property definition representing attached triggers and messages. Sets the attached triggers and messages. The element to attach to. The parsable attachment text. Gets the attached triggers and messages. The element that was attached to. The parsable attachment text. A service that is capable of properly binding values to a method's parameters and creating instances of . The special parameter values recognized by the message binder along with their resolvers. Parameter names are case insensitive so the specified names are unique and can be used with different case variations Custom converters used by the framework registered by destination type for which they will be selected. The converter is passed the existing value to convert and a "context" object. Determines the parameters that a method should be invoked with. The action execution context. The parameters required to complete the invocation. The actual parameter values. Transforms the textual parameter into the actual parameter. Coerces the provided value to the destination type. The destination type. The provided value. An optional context value which can be used during conversion. The coerced value. Gets the default value for a type. The type. The default value. Parses text into a fully functional set of instances with . Parses the specified message text. The target. The message text. The triggers parsed from the text. The function used to generate a trigger. The parameters passed to the method are the the target of the trigger and string representing the trigger. Creates an instance of by parsing out the textual dsl. The target of the message. The textual message dsl. The created message. Function used to parse a string identified as a message. Function used to parse a string identified as a message parameter. Creates a binding on a . The target to which the message is applied. The parameter object. The name of the element to bind to. The path of the element to bind to. The binding mode to use. Hosts attached properties related to view models. A dependency property which allows the framework to track whether a certain element has already been loaded in certain scenarios. A dependency property which marks an element as a name scope root. A dependency property which allows the override of convention application behavior. A dependency property for assigning a context to a particular portion of the UI. A dependency property for attaching a model to the UI. Used by the framework to indicate that this element was generated. Executes the handler immediately if the element is loaded, otherwise wires it to the Loaded event. The element. The handler. true if the handler was executed immediately; false otherwise Executes the handler when the element is unloaded. The element. The handler. Determines whether the specified is loaded. The element. true if the element is loaded; otherwise, false. Executes the handler the next time the elements's LayoutUpdated event fires. The element. The handler. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Gets the convention application behavior. The element the property is attached to. Whether or not to apply conventions. Sets the convention application behavior. The element to attach the property to. Whether or not to apply conventions. Sets the model. The element to attach the model to. The model. Gets the model. The element the model is attached to. The model. Gets the context. The element the context is attached to. The context. Sets the context. The element to attach the context to. The context. Gets a value that indicates whether the process is running in design mode. A strategy for determining which view to use for a given model. Used to transform names. Separator used when resolving View names for context instances. Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) This method registers a View suffix or synonym so that View Context resolution works properly. It is automatically called internally when calling AddNamespaceMapping(), AddDefaultTypeMapping(), or AddTypeMapping(). It should not need to be called explicitly unless a rule that handles synonyms is added directly through the NameTransformer. Suffix for type name. Should be "View" or synonym of "View". Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Retrieves the view from the IoC container or tries to create it if not found. Pass the type of view as a parameter and recieve an instance of the view. Modifies the name of the type to be used at design time. Transforms a ViewModel type name into all of its possible View type names. Optionally accepts an instance of context object Enumeration of transformed names Arguments: typeName = The name of the ViewModel type being resolved to its companion View. context = An instance of the context or null. Locates the view type based on the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view type. Locates the view for the specified model type. The view. Pass the model type, display location (or null) and the context instance (or null) as parameters and receive a view instance. Locates the view for the specified model instance. The view. Pass the model instance, display location (or null) and the context (or null) as parameters and receive a view instance. Transforms a view type into a pack uri. When a view does not contain a code-behind file, we need to automatically call InitializeCompoent. The element to initialize Binds a view to a view model. Gets or sets a value indicating whether to apply conventions by default. true if conventions should be applied by default; otherwise, false. Indicates whether or not the conventions have already been applied to the view. Determines whether a view should have conventions applied to it. The view to check. Whether or not conventions should be applied to the view. Creates data bindings on the view's controls based on the provided properties. Parameters include named Elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Attaches instances of to the view's controls based on the provided methods. Parameters include the named elements to search through and the type of view model to determine conventions for. Returns unmatched elements. Allows the developer to add custom handling of named elements which were not matched by any default conventions. Binds the specified viewModel to the view. Passes the the view model, view and creation context (or null for default) to use in applying binding. A strategy for determining which view model to use for a given view. Used to transform names. The name of the capture group used as a marker for rules that return interface types Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration. An instance of TypeMappingConfiguration that provides the settings for configuration Adds a default type mapping using the standard namespace mapping convention Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace Array of RegEx replace values for target namespaces Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on namespace RegEx replace and filter patterns RegEx replace pattern for source namespace RegEx filter pattern for source namespace RegEx replace value for target namespace Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping based on simple namespace mapping Namespace of source type Namespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespaces of target type as an array Suffix for type name. Should be "View" or synonym of "View". (Optional) Adds a standard type mapping by substituting one subnamespace for another Subnamespace of source type Subnamespace of target type Suffix for type name. Should be "View" or synonym of "View". (Optional) Makes a type name into an interface name. The part. Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types. Enumeration of transformed names Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included Determines the view model type based on the specified view type. The view model type. Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces. Locates the view model for the specified view type. The view model. Pass the view type as a parameter and receive a view model instance. Locates the view model for the specified view instance. The view model. Pass the view instance as a parameters and receive a view model instance. A collection that can exist as part of a behavior. The type of item in the attached collection. Creates an instance of Attaches the collection. The dependency object to attach the collection to. Detaches the collection. The currently attached object. Called when an item is added from the collection. The item that was added. Called when an item is removed from the collection. The item that was removed. A basic implementation of designed to adapt the control. Creates an instance of . The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. Occurs before navigation The event sender. The event args. Occurs after navigation The event sender. The event args. Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. Encapsulates the app and its available services. The root frame of the application. Called by the bootstrapper's constructor at design time to start the framework. Called by the bootstrapper's constructor at runtime to start the framework. Start the framework. Invoked when the application creates a window. Event data for the event. Provides an opportunity to hook into the application object. Override to configure the framework and setup your IoC container. Override to tell the framework where to find assemblies to inspect for views, etc. A list of assemblies to inspect. Override this to provide an IoC specific implementation. The service to locate. The key to locate. The located service. Override this to provide an IoC specific implementation The service to locate. The located services. Override this to provide an IoC specific implementation. The instance to perform injection on. Override this to add custom behavior when the application transitions from Suspended state to Running state. The sender. The event args. Override this to add custom behavior when the application transitions to Suspended state from some other state. The sender. The event args. Override this to add custom behavior for unhandled exceptions. The sender. The event args. Creates the root frame used by the application. The frame. Allows you to trigger the creation of the RootFrame from Configure if necessary. Override this to register a navigation service. The root frame of the application. Creates the root frame and navigates to the specified view. The view type to navigate to. The object parameter to pass to the target. Creates the root frame and navigates to the specified view. The view type to navigate to. The object parameter to pass to the target. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. Locates the view model, locates the associate view, binds them and shows it as the root view. The view model type. Interaface usually from the Interactivity SDK's included here for completeness. Attached the specified dependency object Detach from the previously attached object. The currently attached object. Implemented by services that provide ( based) navigation. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Gets or sets the data type of the current content, or the content that should be navigated to. Gets the data type of the content that is currently displayed. Indicates whether the navigator can navigate forward. Indicates whether the navigator can navigate back. Navigates to the specified content. The to navigate to. Whether or not navigation succeeded. Navigates to the specified content. The to navigate to. The object parameter to pass to the target. Whether or not navigation succeeded. Navigates forward. Navigates back. Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. Occurs when the user presses the hardware Back button. Stores the frame navigation state in local settings if it can. Whether the suspension was sucessful Tries to restore the frame navigation state from local settings. Whether the restoration of successful. A basic implementation of designed to adapt the control. Creates an instance of . The frame to represent as a . Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. The parameter to the current view Occurs before navigation The event sender. The event args. Occurs after navigation The event sender. The event args. Binds the view model. The view. The view model. Attempts to inject query string parameters from the view into the view model. The view model. The parameter. Called to check whether or not to close current instance on navigating. The event sender from OnNavigating event. The event args from OnNavigating event. Raised after navigation. Raised prior to navigation. Raised when navigation fails. Raised when navigation is stopped. Gets or sets the data type of the current content, or the content that should be navigated to. Gets the data type of the content that is currently displayed. Navigates to the specified content. The to navigate to. Whether or not navigation succeeded. Navigates to the specified content. The to navigate to. The object parameter to pass to the target. Whether or not navigation succeeded. Navigates forward. Navigates back. Indicates whether the navigator can navigate forward. Indicates whether the navigator can navigate back. Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. Stores the frame navigation state in local settings if it can. Whether the suspension was sucessful Tries to restore the frame navigation state from local settings. Whether the restoration of successful. Occurs when the user presses the hardware Back button. Occurs when the user presses the hardware Back button. Allows the handlers to cancel the default behavior. The event arguments Service that handles sharing data with the Share Charm. Programmatically initiates the user interface for sharing content with another app. Denotes a class which is aware of sharing data with the Share charm. Called when a share operation starts. The data request. Builds a Uri in a strongly typed fashion, based on a ViewModel. Adds a query string parameter to the Uri. The type of the value. The property. The property value. Itself Attaches a navigation servies to this builder. The navigation service. Itself Navigates to the Uri represented by this builder. Builds the URI. A uri constructed with the current configuration information. Extension methods for Navigates to the specified content. The navigation service. The object parameter to pass to the target. The to navigate to. Whether or not navigation succeeded. Navigate to the specified model type. The navigation service. The model type to navigate to. The object parameter to pass to the target. Whether or not navigation succeeded. Navigate to the specified model type. The navigation service. The object parameter to pass to the target. The model type to navigate to. Whether or not navigation succeeded. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Creates a Uri builder based on a view model type. The type of the view model. The navigation service. The builder. Represents a parameter of an . A dependency property representing the parameter's value. Gets or sets the value of the parameter. The value. Gets or sets the owner. Makes the parameter aware of the that it's attached to. The action message. Service that handles the event. Initializes a new instance of the class. Programmatically initiates the user interface for sharing content with another app. Accepts the share request and forwards it to the view model. The sender. The instance containing the event data. Determines the current view, checks for view first with frame and then view mode first with a shell view. The current view Represents an attachable object that encapsulates a unit of functionality. The associated object property. Gets or sets the object to which this is attached. Invokes the action. The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. Executes the action. The that is passed to the action by the behavior. Generally this is or a target object. The value of this parameter is determined by the caller. Returns the result of the action. Called after the action is attached to an AssociatedObject. Called when the action is being detached from its AssociatedObject, but before it has actually occurred. A custom IoC container which integrates with WinRT and properly registers all Caliburn.Micro services. Registers the Caliburn.Micro WinRT services with the container. Registers the Caliburn.Micro navigation service with the container. The application root frame. if set to true [treat view as loaded]. if set to true then navigation service cache view models for resuse. Registers the Caliburn.Micro sharing service with the container. Implements XAML schema context concepts that support XAML parsing. Implements XAML schema context access to underlying type mapping, based on providing a helper value that describes a type. The type as represented by the relevant type system or interop support type. The schema context's implementation of the concept. Implements XAML schema context access to underlying type mapping, based on specifying a full type name. The name of the class for which to return a XAML type mapping. The schema context's implementation of the IXamlType concept. Gets the set of XMLNS (XAML namespace) definitions that apply to the context. The set of XMLNS (XAML namespace) definitions. A implementation for the XAML platfrom. Initializes a new instance of the class. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. ================================================ FILE: packages/Caliburn.Micro.Core.3.2.0/lib/net40/Caliburn.Micro.XML ================================================ Caliburn.Micro EventArgs sent during activation. Indicates whether the sender was initialized in addition to being activated. Contains details about the success or failure of an item's activation through an . The item whose activation was processed. Gets or sets a value indicating whether the activation was a success. true if success; otherwise, false. A base collection class that supports automatic UI thread marshalling. The type of elements contained in the collection. Initializes a new instance of the class. Initializes a new instance of the class. The collection from which the elements are copied. Enables/Disables property change notification. Notifies subscribers of the property change. Name of the property. Raises a change notification indicating that all bindings should be refreshed. Inserts the item to the specified position. The index to insert at. The item to be inserted. Exposes the base implementation of the function. The index. The item. Used to avoid compiler warning regarding unverifiable code. Sets the item at the specified position. The index to set the item at. The item to set. Exposes the base implementation of the function. The index. The item. Used to avoid compiler warning regarding unverifiable code. Removes the item at the specified position. The position used to identify the item to remove. Exposes the base implementation of the function. The index. Used to avoid compiler warning regarding unverifiable code. Clears the items contained by the collection. Exposes the base implementation of the function. Used to avoid compiler warning regarding unverifiable code. Raises the event with the provided arguments. Arguments of the event being raised. Raises the PropertyChanged event with the provided arguments. The event data to report in the event. Adds the range. The items. Removes the range. The items. Executes the given action on the UI thread An extension point for subclasses to customise how property change notifications are handled. An implementation of that holds on to and activates only one item at a time. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Gets the children. The collection of children. An implementation of that holds on many items. An implementation of that holds on many items. An implementation of that holds on to many items which are all activated. Initializes a new instance of the class. if set to true opens public items that are properties of this class. Initializes a new instance of the class. Gets the items that are currently being conducted. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when initializing. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Gets the children. The collection of children. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. An implementation of that holds on many items but only activates one at a time. Initializes a new instance of the class. Gets the items that are currently being conducted. Gets the children. The collection of children. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Determines the next item to activate based on the last active index. The list of possible active items. The index of the last active item. The next item to activate. Called after an active item is closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. A base class for various implementations of . The type that is being conducted. Gets or sets the close strategy. The close strategy. Occurs when an activation request is processed. Gets the children. The collection of children. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Called by a subclass when an activation needs processing. The item on which activation was attempted. if set to true activation was successful. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. A base class for various implementations of that maintain an active item. The type that is being conducted. The currently active item. The currently active item. Changes the active item. The new item to activate. Indicates whether or not to close the previous active item. Extension methods for the . Registers a singleton. The type of the implementation. The container. The key. The container. Registers a singleton. The type of the service. The type of the implementation. The container. The key. The container. Registers an service to be created on each request. The type of the implementation. The container. The key. The container. Registers an service to be created on each request. The type of the service. The type of the implementation. The container. The key. The container. Registers an instance with the container. The type of the service. The container. The instance. The container. Registers a custom service handler with the container. The type of the service. The container. The handler. The container. Registers all specified types in an assembly as singleton in the container. The type of the service. The container. The assembly. The type filter. The container. Requests an instance. The type of the service. The container. The key. The instance. Gets all instances of a particular type. The type to resolve. The container. The resolved instances. Determines if a handler for the service/key has previously been registered. The service type. The container. The key. True if a handler is registere; false otherwise. Unregisters any handlers for the service/key that have previously been registered. The service type. The container. The key. A result decorator which executes a coroutine when the wrapped result was cancelled. Initializes a new instance of the class. The result to decorate. The coroutine to execute when was canceled. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Manages coroutine execution. Creates the parent enumerator. Executes a coroutine. The coroutine to execute. The context to execute the coroutine within. /// The completion callback for the coroutine. Executes a coroutine asynchronous. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Called upon completion of a coroutine. The context used during the execution of a Coroutine. The source from which the message originates. The view associated with the target. The instance on which the action is invoked. EventArgs sent during deactivation. Indicates whether the sender was closed in addition to being deactivated. A simple logger thats logs everything to the debugger. Initializes a new instance of the class. The type. Logs the message as info. A formatted message. Parameters to be injected into the formatted message. Logs the message as a warning. A formatted message. Parameters to be injected into the formatted message. Logs the exception. The exception. Used to gather the results from multiple child elements which may or may not prevent closing. The type of child element. Creates an instance of the class. Indicates that even if all conducted items are not closable, those that are should be closed. The default is FALSE. Executes the strategy. Items that are requesting close. The action to call when all enumeration is complete and the close results are aggregated. The bool indicates whether close can occur. The enumerable indicates which children should close if the parent cannot. Default implementation for that does no platform enlightenment. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. true if the handler was executed immediately; false otherwise Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. A result that executes an . Initializes a new instance of the class. The action. Executes the result using the specified context. The context. Occurs when execution has completed. A result that executes a The type of the result. Initializes a new instance of the class. The action. Executes the result using the specified context. The context. Gets the result. Occurs when execution has completed. Extension methods for Applies the action to each element in the list. The enumerable item's type. The elements to enumerate. The action to apply to each item in the list. Enables loosely-coupled publication of and subscription to events. Processing of handler results on publication thread. Searches the subscribed handlers to check if we have a handler for the message type supplied. The message type to check with True if any handler is found, false if not. Subscribes an instance to all events declared through implementations of The instance to subscribe for event publication. Unsubscribes the instance from all events. The instance to unsubscribe. Publishes a message. The message instance. Allows the publisher to provide a custom thread marshaller for the message publication. Extensions for . Publishes a message on the current thread (synchrone). The event aggregator. The message instance. Publishes a message on a background thread (async). The event aggregator. The message instance. Publishes a message on the UI thread. The event aggregator. The message instance. Publishes a message on the UI thread asynchrone. The event aggregator. The message instance. Publishes a message on the UI thread asynchrone. The event aggregator. The message instance. Enables easy marshalling of code to the UI thread. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Extension for . Converts an expression into a . The expression to convert. The member info. Denotes an instance which requires activation. Indicates whether or not this instance is active. Activates this instance. Raised after activation occurs. Denotes a node within a parent/child hierarchy. Gets or Sets the Parent Denotes a node within a parent/child hierarchy. The type of parent. Gets or Sets the Parent Denotes an object that can be closed. Tries to close this instance. Also provides an opportunity to pass a dialog result to it's corresponding view. The dialog result. Used to gather the results from multiple child elements which may or may not prevent closing. The type of child element. Executes the strategy. Items that are requesting close. The action to call when all enumeration is complete and the close results are aggregated. The bool indicates whether close can occur. The enumerable indicates which children should close if the parent cannot. Denotes an instance which conducts other objects by managing an ActiveItem and maintaining a strict lifecycle. Conducted instances can optin to the lifecycle by impelenting any of the follosing , , . Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Occurs when an activation request is processed. An that also implements . Denotes an instance which requires deactivation. Raised before deactivation. Deactivates this instance. Indicates whether or not this instance is being closed. Raised after deactivation. Enables loosely-coupled publication of and subscription to events. Searches the subscribed handlers to check if we have a handler for the message type supplied. The message type to check with True if any handler is found, false if not. Subscribes an instance to all events declared through implementations of The instance to subscribe for event publication. Unsubscribes the instance from all events. The instance to unsubscribe. Publishes a message. The message instance. Allows the publisher to provide a custom thread marshaller for the message publication. Denotes an instance which may prevent closing. Called to check whether or not this instance can close. The implementer calls this action with the result of the close check. A marker interface for classes that subscribe to messages. Denotes a class which can handle a particular type of message. The type of message to handle. Handles the message. The message. Denotes a class which can handle a particular type of message and uses a Coroutine to do so. Handle the message with a Coroutine. The message. The coroutine to execute. Denotes a class which can handle a particular type of message and uses a Task to do so. Handle the message with a Task. The message. The Task that represents the operation. Denotes an instance which maintains an active item. The currently active item. Denotes an instance which has a display name. Gets or Sets the Display Name A logger. Logs the message as info. A formatted message. Parameters to be injected into the formatted message. Logs the message as a warning. A formatted message. Parameters to be injected into the formatted message. Logs the exception. The exception. Extends such that the change event can be raised by external parties. Enables/Disables property change notification. Notifies subscribers of the property change. Name of the property. Raises a change notification indicating that all bindings should be refreshed. Represents a collection that is observable. The type of elements contained in the collection. Adds the range. The items. Removes the range. The items. Used by the framework to pull instances from an IoC container and to inject dependencies into certain existing classes. Gets an instance by type and key. Gets all instances of a particular type. Passes an existing instance to the IoC container to enable dependencies to be injected. Gets an instance from the container. The type to resolve. The key to look up. The resolved instance. Gets all instances of a particular type. The type to resolve. The resolved instances. Interface used to define an object associated to a collection of children. Gets the children. The collection of children. Interface used to define a specialized parent. The type of children. Gets the children. The collection of children. Interface for platform specific operations that need enlightenment. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. Allows custom code to execute after the return of a action. Executes the result using the specified context. The context. Occurs when execution has completed. Allows custom code to execute after the return of a action. The type of the result. Gets the result of the asynchronous operation. Denotes an instance which implements , , , and Denotes a class which is aware of its view(s). Attaches a view to this instance. The view. The context in which the view appears. Gets a view previously attached to this instance. The context denoting which view to retrieve. The view. Raised when a view is attached. Used to manage logging. Creates an for the provided type. A collection of extension methods to help with differing reflection between the portable library and SL5 A result decorator that overrides of the decorated instance. Initializes a new instance of the class. The result to decorate. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Access the current . Gets or sets the current . A base class that implements the infrastructure for property change notification and automatically performs UI thread marshalling. Creates an instance of . Occurs when a property value changes. Enables/Disables property change notification. Virtualized in order to help with document oriented view models. Raises a change notification indicating that all bindings should be refreshed. Notifies subscribers of the property change. Name of the property. Notifies subscribers of the property change. The type of the property. The property expression. Raises the event directly. The instance containing the event data. Executes the given action on the UI thread An extension point for subclasses to customise how property change notifications are handled. A result decorator which rescues errors from the decorated result by executing a rescue coroutine. The type of the exception we want to perform the rescue on Initializes a new instance of the class. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. The event args for the Completed event of an . Gets or sets the error if one occurred. The error. Gets or sets a value indicating whether the result was cancelled. true if cancelled; otherwise, false. Base class for all decorators. Initializes a new instance of the class. The result to decorate. Executes the result using the specified context. The context. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Occurs when execution has completed. Raises the event. The instance containing the event data. Extension methods for instances. Adds behavior to the result which is executed when the was cancelled. The result to decorate. The coroutine to execute when was canceled. Overrides of the decorated instance. The result to decorate. Rescues from the decorated by executing a coroutine. The type of the exception we want to perform the rescue on. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. Rescues any exception from the decorated by executing a coroutine. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. A base implementation of . Creates an instance of the screen. Gets or Sets the Parent Gets or Sets the Display Name Indicates whether or not this instance is currently active. Virtualized in order to help with document oriented view models. Indicates whether or not this instance is currently initialized. Virtualized in order to help with document oriented view models. Raised after activation occurs. Raised before deactivation. Raised after deactivation. Called when initializing. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Tries to close this instance by asking its Parent to initiate shutdown or by asking its corresponding view to close. Also provides an opportunity to pass a dialog result to it's corresponding view. The dialog result. Hosts extension methods for classes. Activates the item if it implements , otherwise does nothing. The potential activatable. Deactivates the item if it implements , otherwise does nothing. The potential deactivatable. Indicates whether or not to close the item after deactivating it. Closes the specified item. The conductor. The item to close. Closes the specified item. The conductor. The item to close. Activates a child whenever the specified parent is activated. The child to activate. The parent whose activation triggers the child's activation. Deactivates a child whenever the specified parent is deactivated. The child to deactivate. The parent whose deactivation triggers the child's deactivation. Activates and Deactivates a child whenever the specified parent is Activated or Deactivated. The child to activate/deactivate. The parent whose activation/deactivation triggers the child's activation/deactivation. An implementation of that enables sequential execution of multiple results. Initializes a new instance of the class. The enumerator. Occurs when execution has completed. Executes the result using the specified context. The context. A simple IoC container. Initializes a new instance of the class. Registers the instance. The service. The key. The implementation. Registers the class so that a new instance is created on every request. The service. The key. The implementation. Registers the class so that it is created once, on first request, and the same instance is returned to all requestors thereafter. The service. The key. The implementation. Registers a custom handler for serving requests from the container. The service. The key. The handler. Unregisters any handlers for the service/key that have previously been registered. The service. The key. Requests an instance. The service. The key. The instance, or null if a handler is not found. Determines if a handler for the service/key has previously been registered. The service. The key. True if a handler is registere; false otherwise. Requests all instances of a given type. The service. All the instances or an empty enumerable if none are found. Pushes dependencies into an existing instance based on interface properties with setters. The instance. Creates a child container. A new container. Actually does the work of creating the instance and satisfying it's constructor dependencies. The type. Creates an instance of the type with the specified constructor arguments. The type. The constructor args. The created instance. Occurs when a new instance is created. A simple result. A result that is always succeeded. A result that is always canceled. The result. A result that is always failed. Executes the result using the specified context. The context. Occurs when execution has completed. Extension methods to bring and together. Executes an asynchronous. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Executes an asynchronous. The type of the result. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Encapsulates a task inside a couroutine. The task. The coroutine that encapsulates the task. Encapsulates a task inside a couroutine. The type of the result. The task. The coroutine that encapsulates the task. A couroutine that encapsulates an . Initializes a new instance of the class. The task. Executes the result using the specified context. The context. Called when the asynchronous task has completed. The completed task. Occurs when execution has completed. A couroutine that encapsulates an . The type of the result. Initializes a new instance of the class. The task. Gets the result of the asynchronous operation. Called when the asynchronous task has completed. The completed task. The event args for the event. The view. The context. A base implementation of which is capable of caching views by context. The default view context. The view chache for this instance. Creates an instance of . Raised when a view is attached. Called when a view is attached. The view. The context in which the view appears. Called when an attached view's Loaded event fires. Called the first time the page's LayoutUpdated event fires after it is navigated to. Gets a view previously attached to this instance. The context denoting which view to retrieve. The view. A dictionary in which the values are weak references. The type of keys in the dictionary. The type of values in the dictionary. Initializes a new instance of the class that is empty, has the default initial capacity, and uses the default equality comparer for the key type. Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. The whose elements are copied to the new . Initializes a new instance of the class that contains elements copied from the specified and uses the specified . The whose elements are copied to the new . The implementation to use when comparing keys, or null to use the default for the type of the key. Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified . The implementation to use when comparing keys, or null to use the default for the type of the key. Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type. The initial number of elements that the can contain. Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the specified . The initial number of elements that the can contain. The implementation to use when comparing keys, or null to use the default for the type of the key. Returns an enumerator that iterates through the . The enumerator. Removes all keys and values from the . Gets the number of key/value pairs contained in the . Since the items in the dictionary are held by weak reference, the count value cannot be relied upon to guarantee the number of objects that would be discovered via enumeration. Treat the Count as an estimate only. Adds the specified key and value to the dictionary. The key of the element to add. The value of the element to add. The value can be null for reference types. Determines whether the contains the specified key. The key to locate in the . Removes the value with the specified key from the . The key of the element to remove. true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found in the . Gets the value associated with the specified key. The key of the value to get. When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. true if the contains an element with the specified key; otherwise, false. Gets or sets the value associated with the specified key. The key of the value to get or set. The value associated with the specified key. If the specified key is not found, a get operation throws a , and a set operation creates a new element with the specified key. Gets a collection containing the keys in the . Gets a collection containing the values in the . Allows you to obtain the method or property name of the caller. ================================================ FILE: packages/Caliburn.Micro.Core.3.2.0/lib/net45/Caliburn.Micro.xml ================================================ Caliburn.Micro EventArgs sent during activation. Indicates whether the sender was initialized in addition to being activated. Contains details about the success or failure of an item's activation through an . The item whose activation was processed. Gets or sets a value indicating whether the activation was a success. true if success; otherwise, false. A base collection class that supports automatic UI thread marshalling. The type of elements contained in the collection. Initializes a new instance of the class. Initializes a new instance of the class. The collection from which the elements are copied. Enables/Disables property change notification. Notifies subscribers of the property change. Name of the property. Raises a change notification indicating that all bindings should be refreshed. Inserts the item to the specified position. The index to insert at. The item to be inserted. Exposes the base implementation of the function. The index. The item. Used to avoid compiler warning regarding unverifiable code. Sets the item at the specified position. The index to set the item at. The item to set. Exposes the base implementation of the function. The index. The item. Used to avoid compiler warning regarding unverifiable code. Removes the item at the specified position. The position used to identify the item to remove. Exposes the base implementation of the function. The index. Used to avoid compiler warning regarding unverifiable code. Clears the items contained by the collection. Exposes the base implementation of the function. Used to avoid compiler warning regarding unverifiable code. Raises the event with the provided arguments. Arguments of the event being raised. Raises the PropertyChanged event with the provided arguments. The event data to report in the event. Adds the range. The items. Removes the range. The items. Executes the given action on the UI thread An extension point for subclasses to customise how property change notifications are handled. An implementation of that holds on to and activates only one item at a time. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Gets the children. The collection of children. An implementation of that holds on many items. An implementation of that holds on many items. An implementation of that holds on to many items which are all activated. Initializes a new instance of the class. if set to true opens public items that are properties of this class. Initializes a new instance of the class. Gets the items that are currently being conducted. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when initializing. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Gets the children. The collection of children. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. An implementation of that holds on many items but only activates one at a time. Initializes a new instance of the class. Gets the items that are currently being conducted. Gets the children. The collection of children. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Determines the next item to activate based on the last active index. The list of possible active items. The index of the last active item. The next item to activate. Called after an active item is closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. A base class for various implementations of . The type that is being conducted. Gets or sets the close strategy. The close strategy. Occurs when an activation request is processed. Gets the children. The collection of children. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Called by a subclass when an activation needs processing. The item on which activation was attempted. if set to true activation was successful. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. A base class for various implementations of that maintain an active item. The type that is being conducted. The currently active item. The currently active item. Changes the active item. The new item to activate. Indicates whether or not to close the previous active item. Extension methods for the . Registers a singleton. The type of the implementation. The container. The key. The container. Registers a singleton. The type of the service. The type of the implementation. The container. The key. The container. Registers an service to be created on each request. The type of the implementation. The container. The key. The container. Registers an service to be created on each request. The type of the service. The type of the implementation. The container. The key. The container. Registers an instance with the container. The type of the service. The container. The instance. The container. Registers a custom service handler with the container. The type of the service. The container. The handler. The container. Registers all specified types in an assembly as singleton in the container. The type of the service. The container. The assembly. The type filter. The container. Requests an instance. The type of the service. The container. The key. The instance. Gets all instances of a particular type. The type to resolve. The container. The resolved instances. Determines if a handler for the service/key has previously been registered. The service type. The container. The key. True if a handler is registere; false otherwise. Unregisters any handlers for the service/key that have previously been registered. The service type. The container. The key. A result decorator which executes a coroutine when the wrapped result was cancelled. Initializes a new instance of the class. The result to decorate. The coroutine to execute when was canceled. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Manages coroutine execution. Creates the parent enumerator. Executes a coroutine. The coroutine to execute. The context to execute the coroutine within. /// The completion callback for the coroutine. Executes a coroutine asynchronous. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Called upon completion of a coroutine. The context used during the execution of a Coroutine. The source from which the message originates. The view associated with the target. The instance on which the action is invoked. EventArgs sent during deactivation. Indicates whether the sender was closed in addition to being deactivated. A simple logger thats logs everything to the debugger. Initializes a new instance of the class. The type. Logs the message as info. A formatted message. Parameters to be injected into the formatted message. Logs the message as a warning. A formatted message. Parameters to be injected into the formatted message. Logs the exception. The exception. Used to gather the results from multiple child elements which may or may not prevent closing. The type of child element. Creates an instance of the class. Indicates that even if all conducted items are not closable, those that are should be closed. The default is FALSE. Executes the strategy. Items that are requesting close. The action to call when all enumeration is complete and the close results are aggregated. The bool indicates whether close can occur. The enumerable indicates which children should close if the parent cannot. Default implementation for that does no platform enlightenment. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. true if the handler was executed immediately; false otherwise Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. A result that executes an . Initializes a new instance of the class. The action. Executes the result using the specified context. The context. Occurs when execution has completed. A result that executes a The type of the result. Initializes a new instance of the class. The action. Executes the result using the specified context. The context. Gets the result. Occurs when execution has completed. Extension methods for Applies the action to each element in the list. The enumerable item's type. The elements to enumerate. The action to apply to each item in the list. Enables loosely-coupled publication of and subscription to events. Processing of handler results on publication thread. Searches the subscribed handlers to check if we have a handler for the message type supplied. The message type to check with True if any handler is found, false if not. Subscribes an instance to all events declared through implementations of The instance to subscribe for event publication. Unsubscribes the instance from all events. The instance to unsubscribe. Publishes a message. The message instance. Allows the publisher to provide a custom thread marshaller for the message publication. Extensions for . Publishes a message on the current thread (synchrone). The event aggregator. The message instance. Publishes a message on a background thread (async). The event aggregator. The message instance. Publishes a message on the UI thread. The event aggregator. The message instance. Publishes a message on the UI thread asynchrone. The event aggregator. The message instance. Publishes a message on the UI thread asynchrone. The event aggregator. The message instance. Enables easy marshalling of code to the UI thread. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Extension for . Converts an expression into a . The expression to convert. The member info. Denotes an instance which requires activation. Indicates whether or not this instance is active. Activates this instance. Raised after activation occurs. Denotes a node within a parent/child hierarchy. Gets or Sets the Parent Denotes a node within a parent/child hierarchy. The type of parent. Gets or Sets the Parent Denotes an object that can be closed. Tries to close this instance. Also provides an opportunity to pass a dialog result to it's corresponding view. The dialog result. Used to gather the results from multiple child elements which may or may not prevent closing. The type of child element. Executes the strategy. Items that are requesting close. The action to call when all enumeration is complete and the close results are aggregated. The bool indicates whether close can occur. The enumerable indicates which children should close if the parent cannot. Denotes an instance which conducts other objects by managing an ActiveItem and maintaining a strict lifecycle. Conducted instances can optin to the lifecycle by impelenting any of the follosing , , . Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Occurs when an activation request is processed. An that also implements . Denotes an instance which requires deactivation. Raised before deactivation. Deactivates this instance. Indicates whether or not this instance is being closed. Raised after deactivation. Enables loosely-coupled publication of and subscription to events. Searches the subscribed handlers to check if we have a handler for the message type supplied. The message type to check with True if any handler is found, false if not. Subscribes an instance to all events declared through implementations of The instance to subscribe for event publication. Unsubscribes the instance from all events. The instance to unsubscribe. Publishes a message. The message instance. Allows the publisher to provide a custom thread marshaller for the message publication. Denotes an instance which may prevent closing. Called to check whether or not this instance can close. The implementer calls this action with the result of the close check. A marker interface for classes that subscribe to messages. Denotes a class which can handle a particular type of message. The type of message to handle. Handles the message. The message. Denotes a class which can handle a particular type of message and uses a Coroutine to do so. Handle the message with a Coroutine. The message. The coroutine to execute. Denotes a class which can handle a particular type of message and uses a Task to do so. Handle the message with a Task. The message. The Task that represents the operation. Denotes an instance which maintains an active item. The currently active item. Denotes an instance which has a display name. Gets or Sets the Display Name A logger. Logs the message as info. A formatted message. Parameters to be injected into the formatted message. Logs the message as a warning. A formatted message. Parameters to be injected into the formatted message. Logs the exception. The exception. Extends such that the change event can be raised by external parties. Enables/Disables property change notification. Notifies subscribers of the property change. Name of the property. Raises a change notification indicating that all bindings should be refreshed. Represents a collection that is observable. The type of elements contained in the collection. Adds the range. The items. Removes the range. The items. Used by the framework to pull instances from an IoC container and to inject dependencies into certain existing classes. Gets an instance by type and key. Gets all instances of a particular type. Passes an existing instance to the IoC container to enable dependencies to be injected. Gets an instance from the container. The type to resolve. The key to look up. The resolved instance. Gets all instances of a particular type. The type to resolve. The resolved instances. Interface used to define an object associated to a collection of children. Gets the children. The collection of children. Interface used to define a specialized parent. The type of children. Gets the children. The collection of children. Interface for platform specific operations that need enlightenment. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. Allows custom code to execute after the return of a action. Executes the result using the specified context. The context. Occurs when execution has completed. Allows custom code to execute after the return of a action. The type of the result. Gets the result of the asynchronous operation. Denotes an instance which implements , , , and Denotes a class which is aware of its view(s). Attaches a view to this instance. The view. The context in which the view appears. Gets a view previously attached to this instance. The context denoting which view to retrieve. The view. Raised when a view is attached. Used to manage logging. Creates an for the provided type. A result decorator that overrides of the decorated instance. Initializes a new instance of the class. The result to decorate. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Access the current . Gets or sets the current . A base class that implements the infrastructure for property change notification and automatically performs UI thread marshalling. Creates an instance of . Occurs when a property value changes. Enables/Disables property change notification. Virtualized in order to help with document oriented view models. Raises a change notification indicating that all bindings should be refreshed. Notifies subscribers of the property change. Name of the property. Notifies subscribers of the property change. The type of the property. The property expression. Raises the event directly. The instance containing the event data. Executes the given action on the UI thread An extension point for subclasses to customise how property change notifications are handled. A collection of extension methods to help with differing reflection between the portable library and SL5 A result decorator which rescues errors from the decorated result by executing a rescue coroutine. The type of the exception we want to perform the rescue on Initializes a new instance of the class. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. A simple result. A result that is always succeeded. A result that is always canceled. The result. A result that is always failed. Executes the result using the specified context. The context. Occurs when execution has completed. The event args for the Completed event of an . Gets or sets the error if one occurred. The error. Gets or sets a value indicating whether the result was cancelled. true if cancelled; otherwise, false. Base class for all decorators. Initializes a new instance of the class. The result to decorate. Executes the result using the specified context. The context. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Occurs when execution has completed. Raises the event. The instance containing the event data. Extension methods for instances. Adds behavior to the result which is executed when the was cancelled. The result to decorate. The coroutine to execute when was canceled. Overrides of the decorated instance. The result to decorate. Rescues from the decorated by executing a coroutine. The type of the exception we want to perform the rescue on. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. Rescues any exception from the decorated by executing a coroutine. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. A base implementation of . Creates an instance of the screen. Gets or Sets the Parent Gets or Sets the Display Name Indicates whether or not this instance is currently active. Virtualized in order to help with document oriented view models. Indicates whether or not this instance is currently initialized. Virtualized in order to help with document oriented view models. Raised after activation occurs. Raised before deactivation. Raised after deactivation. Called when initializing. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Tries to close this instance by asking its Parent to initiate shutdown or by asking its corresponding view to close. Also provides an opportunity to pass a dialog result to it's corresponding view. The dialog result. Hosts extension methods for classes. Activates the item if it implements , otherwise does nothing. The potential activatable. Deactivates the item if it implements , otherwise does nothing. The potential deactivatable. Indicates whether or not to close the item after deactivating it. Closes the specified item. The conductor. The item to close. Closes the specified item. The conductor. The item to close. Activates a child whenever the specified parent is activated. The child to activate. The parent whose activation triggers the child's activation. Deactivates a child whenever the specified parent is deactivated. The child to deactivate. The parent whose deactivation triggers the child's deactivation. Activates and Deactivates a child whenever the specified parent is Activated or Deactivated. The child to activate/deactivate. The parent whose activation/deactivation triggers the child's activation/deactivation. An implementation of that enables sequential execution of multiple results. Initializes a new instance of the class. The enumerator. Occurs when execution has completed. Executes the result using the specified context. The context. A simple IoC container. Initializes a new instance of the class. Registers the instance. The service. The key. The implementation. Registers the class so that a new instance is created on every request. The service. The key. The implementation. Registers the class so that it is created once, on first request, and the same instance is returned to all requestors thereafter. The service. The key. The implementation. Registers a custom handler for serving requests from the container. The service. The key. The handler. Unregisters any handlers for the service/key that have previously been registered. The service. The key. Requests an instance. The service. The key. The instance, or null if a handler is not found. Determines if a handler for the service/key has previously been registered. The service. The key. True if a handler is registere; false otherwise. Requests all instances of a given type. The service. All the instances or an empty enumerable if none are found. Pushes dependencies into an existing instance based on interface properties with setters. The instance. Creates a child container. A new container. Actually does the work of creating the instance and satisfying it's constructor dependencies. The type. Creates an instance of the type with the specified constructor arguments. The type. The constructor args. The created instance. Occurs when a new instance is created. Extension methods to bring and together. Executes an asynchronous. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Executes an asynchronous. The type of the result. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Encapsulates a task inside a couroutine. The task. The coroutine that encapsulates the task. Encapsulates a task inside a couroutine. The type of the result. The task. The coroutine that encapsulates the task. A couroutine that encapsulates an . Initializes a new instance of the class. The task. Executes the result using the specified context. The context. Called when the asynchronous task has completed. The completed task. Occurs when execution has completed. A couroutine that encapsulates an . The type of the result. Initializes a new instance of the class. The task. Gets the result of the asynchronous operation. Called when the asynchronous task has completed. The completed task. The event args for the event. The view. The context. A base implementation of which is capable of caching views by context. The default view context. The view chache for this instance. Creates an instance of . Raised when a view is attached. Called when a view is attached. The view. The context in which the view appears. Called when an attached view's Loaded event fires. Called the first time the page's LayoutUpdated event fires after it is navigated to. Gets a view previously attached to this instance. The context denoting which view to retrieve. The view. A dictionary in which the values are weak references. The type of keys in the dictionary. The type of values in the dictionary. Initializes a new instance of the class that is empty, has the default initial capacity, and uses the default equality comparer for the key type. Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. The whose elements are copied to the new . Initializes a new instance of the class that contains elements copied from the specified and uses the specified . The whose elements are copied to the new . The implementation to use when comparing keys, or null to use the default for the type of the key. Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified . The implementation to use when comparing keys, or null to use the default for the type of the key. Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type. The initial number of elements that the can contain. Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the specified . The initial number of elements that the can contain. The implementation to use when comparing keys, or null to use the default for the type of the key. Returns an enumerator that iterates through the . The enumerator. Removes all keys and values from the . Gets the number of key/value pairs contained in the . Since the items in the dictionary are held by weak reference, the count value cannot be relied upon to guarantee the number of objects that would be discovered via enumeration. Treat the Count as an estimate only. Adds the specified key and value to the dictionary. The key of the element to add. The value of the element to add. The value can be null for reference types. Determines whether the contains the specified key. The key to locate in the . Removes the value with the specified key from the . The key of the element to remove. true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found in the . Gets the value associated with the specified key. The key of the value to get. When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. true if the contains an element with the specified key; otherwise, false. Gets or sets the value associated with the specified key. The key of the value to get or set. The value associated with the specified key. If the specified key is not found, a get operation throws a , and a set operation creates a new element with the specified key. Gets a collection containing the keys in the . Gets a collection containing the values in the . ================================================ FILE: packages/Caliburn.Micro.Core.3.2.0/lib/portable-net45+win8+wp8+wpa81+MonoAndroid10+Xamarin.iOS10+MonoTouch10+uap10.0/Caliburn.Micro.XML ================================================ Caliburn.Micro EventArgs sent during activation. Indicates whether the sender was initialized in addition to being activated. Contains details about the success or failure of an item's activation through an . The item whose activation was processed. Gets or sets a value indicating whether the activation was a success. true if success; otherwise, false. A base collection class that supports automatic UI thread marshalling. The type of elements contained in the collection. Initializes a new instance of the class. Initializes a new instance of the class. The collection from which the elements are copied. Enables/Disables property change notification. Notifies subscribers of the property change. Name of the property. Raises a change notification indicating that all bindings should be refreshed. Inserts the item to the specified position. The index to insert at. The item to be inserted. Exposes the base implementation of the function. The index. The item. Used to avoid compiler warning regarding unverifiable code. Sets the item at the specified position. The index to set the item at. The item to set. Exposes the base implementation of the function. The index. The item. Used to avoid compiler warning regarding unverifiable code. Removes the item at the specified position. The position used to identify the item to remove. Exposes the base implementation of the function. The index. Used to avoid compiler warning regarding unverifiable code. Clears the items contained by the collection. Exposes the base implementation of the function. Used to avoid compiler warning regarding unverifiable code. Raises the event with the provided arguments. Arguments of the event being raised. Raises the PropertyChanged event with the provided arguments. The event data to report in the event. Adds the range. The items. Removes the range. The items. Executes the given action on the UI thread An extension point for subclasses to customise how property change notifications are handled. An implementation of that holds on to and activates only one item at a time. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Gets the children. The collection of children. An implementation of that holds on many items. An implementation of that holds on many items. An implementation of that holds on to many items which are all activated. Initializes a new instance of the class. if set to true opens public items that are properties of this class. Initializes a new instance of the class. Gets the items that are currently being conducted. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when initializing. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Gets the children. The collection of children. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. An implementation of that holds on many items but only activates one at a time. Initializes a new instance of the class. Gets the items that are currently being conducted. Gets the children. The collection of children. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Determines the next item to activate based on the last active index. The list of possible active items. The index of the last active item. The next item to activate. Called after an active item is closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. A base class for various implementations of . The type that is being conducted. Gets or sets the close strategy. The close strategy. Occurs when an activation request is processed. Gets the children. The collection of children. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Called by a subclass when an activation needs processing. The item on which activation was attempted. if set to true activation was successful. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. A base class for various implementations of that maintain an active item. The type that is being conducted. The currently active item. The currently active item. Changes the active item. The new item to activate. Indicates whether or not to close the previous active item. Extension methods for the . Registers a singleton. The type of the implementation. The container. The key. The container. Registers a singleton. The type of the service. The type of the implementation. The container. The key. The container. Registers an service to be created on each request. The type of the implementation. The container. The key. The container. Registers an service to be created on each request. The type of the service. The type of the implementation. The container. The key. The container. Registers an instance with the container. The type of the service. The container. The instance. The container. Registers a custom service handler with the container. The type of the service. The container. The handler. The container. Registers all specified types in an assembly as singleton in the container. The type of the service. The container. The assembly. The type filter. The container. Requests an instance. The type of the service. The container. The key. The instance. Gets all instances of a particular type. The type to resolve. The container. The resolved instances. Determines if a handler for the service/key has previously been registered. The service type. The container. The key. True if a handler is registere; false otherwise. Unregisters any handlers for the service/key that have previously been registered. The service type. The container. The key. A result decorator which executes a coroutine when the wrapped result was cancelled. Initializes a new instance of the class. The result to decorate. The coroutine to execute when was canceled. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Manages coroutine execution. Creates the parent enumerator. Executes a coroutine. The coroutine to execute. The context to execute the coroutine within. /// The completion callback for the coroutine. Executes a coroutine asynchronous. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Called upon completion of a coroutine. The context used during the execution of a Coroutine. The source from which the message originates. The view associated with the target. The instance on which the action is invoked. EventArgs sent during deactivation. Indicates whether the sender was closed in addition to being deactivated. A simple logger thats logs everything to the debugger. Initializes a new instance of the class. The type. Logs the message as info. A formatted message. Parameters to be injected into the formatted message. Logs the message as a warning. A formatted message. Parameters to be injected into the formatted message. Logs the exception. The exception. Used to gather the results from multiple child elements which may or may not prevent closing. The type of child element. Creates an instance of the class. Indicates that even if all conducted items are not closable, those that are should be closed. The default is FALSE. Executes the strategy. Items that are requesting close. The action to call when all enumeration is complete and the close results are aggregated. The bool indicates whether close can occur. The enumerable indicates which children should close if the parent cannot. Default implementation for that does no platform enlightenment. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. true if the handler was executed immediately; false otherwise Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. A result that executes an . Initializes a new instance of the class. The action. Executes the result using the specified context. The context. Occurs when execution has completed. A result that executes a The type of the result. Initializes a new instance of the class. The action. Executes the result using the specified context. The context. Gets the result. Occurs when execution has completed. Extension methods for Applies the action to each element in the list. The enumerable item's type. The elements to enumerate. The action to apply to each item in the list. Enables loosely-coupled publication of and subscription to events. Processing of handler results on publication thread. Searches the subscribed handlers to check if we have a handler for the message type supplied. The message type to check with True if any handler is found, false if not. Subscribes an instance to all events declared through implementations of The instance to subscribe for event publication. Unsubscribes the instance from all events. The instance to unsubscribe. Publishes a message. The message instance. Allows the publisher to provide a custom thread marshaller for the message publication. Extensions for . Publishes a message on the current thread (synchrone). The event aggregator. The message instance. Publishes a message on a background thread (async). The event aggregator. The message instance. Publishes a message on the UI thread. The event aggregator. The message instance. Publishes a message on the UI thread asynchrone. The event aggregator. The message instance. Publishes a message on the UI thread asynchrone. The event aggregator. The message instance. Enables easy marshalling of code to the UI thread. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Extension for . Converts an expression into a . The expression to convert. The member info. Denotes an instance which requires activation. Indicates whether or not this instance is active. Activates this instance. Raised after activation occurs. Denotes a node within a parent/child hierarchy. Gets or Sets the Parent Denotes a node within a parent/child hierarchy. The type of parent. Gets or Sets the Parent Denotes an object that can be closed. Tries to close this instance. Also provides an opportunity to pass a dialog result to it's corresponding view. The dialog result. Used to gather the results from multiple child elements which may or may not prevent closing. The type of child element. Executes the strategy. Items that are requesting close. The action to call when all enumeration is complete and the close results are aggregated. The bool indicates whether close can occur. The enumerable indicates which children should close if the parent cannot. Denotes an instance which conducts other objects by managing an ActiveItem and maintaining a strict lifecycle. Conducted instances can optin to the lifecycle by impelenting any of the follosing , , . Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Occurs when an activation request is processed. An that also implements . Denotes an instance which requires deactivation. Raised before deactivation. Deactivates this instance. Indicates whether or not this instance is being closed. Raised after deactivation. Enables loosely-coupled publication of and subscription to events. Searches the subscribed handlers to check if we have a handler for the message type supplied. The message type to check with True if any handler is found, false if not. Subscribes an instance to all events declared through implementations of The instance to subscribe for event publication. Unsubscribes the instance from all events. The instance to unsubscribe. Publishes a message. The message instance. Allows the publisher to provide a custom thread marshaller for the message publication. Denotes an instance which may prevent closing. Called to check whether or not this instance can close. The implementer calls this action with the result of the close check. A marker interface for classes that subscribe to messages. Denotes a class which can handle a particular type of message. The type of message to handle. Handles the message. The message. Denotes a class which can handle a particular type of message and uses a Coroutine to do so. Handle the message with a Coroutine. The message. The coroutine to execute. Denotes a class which can handle a particular type of message and uses a Task to do so. Handle the message with a Task. The message. The Task that represents the operation. Denotes an instance which maintains an active item. The currently active item. Denotes an instance which has a display name. Gets or Sets the Display Name A logger. Logs the message as info. A formatted message. Parameters to be injected into the formatted message. Logs the message as a warning. A formatted message. Parameters to be injected into the formatted message. Logs the exception. The exception. Extends such that the change event can be raised by external parties. Enables/Disables property change notification. Notifies subscribers of the property change. Name of the property. Raises a change notification indicating that all bindings should be refreshed. Represents a collection that is observable. The type of elements contained in the collection. Adds the range. The items. Removes the range. The items. Used by the framework to pull instances from an IoC container and to inject dependencies into certain existing classes. Gets an instance by type and key. Gets all instances of a particular type. Passes an existing instance to the IoC container to enable dependencies to be injected. Gets an instance from the container. The type to resolve. The key to look up. The resolved instance. Gets all instances of a particular type. The type to resolve. The resolved instances. Interface used to define an object associated to a collection of children. Gets the children. The collection of children. Interface used to define a specialized parent. The type of children. Gets the children. The collection of children. Interface for platform specific operations that need enlightenment. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. Allows custom code to execute after the return of a action. Executes the result using the specified context. The context. Occurs when execution has completed. Allows custom code to execute after the return of a action. The type of the result. Gets the result of the asynchronous operation. Denotes an instance which implements , , , and Denotes a class which is aware of its view(s). Attaches a view to this instance. The view. The context in which the view appears. Gets a view previously attached to this instance. The context denoting which view to retrieve. The view. Raised when a view is attached. Used to manage logging. Creates an for the provided type. A result decorator that overrides of the decorated instance. Initializes a new instance of the class. The result to decorate. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Access the current . Gets or sets the current . A base class that implements the infrastructure for property change notification and automatically performs UI thread marshalling. Creates an instance of . Occurs when a property value changes. Enables/Disables property change notification. Virtualized in order to help with document oriented view models. Raises a change notification indicating that all bindings should be refreshed. Notifies subscribers of the property change. Name of the property. Notifies subscribers of the property change. The type of the property. The property expression. Raises the event directly. The instance containing the event data. Executes the given action on the UI thread An extension point for subclasses to customise how property change notifications are handled. A collection of extension methods to help with differing reflection between the portable library and SL5 A result decorator which rescues errors from the decorated result by executing a rescue coroutine. The type of the exception we want to perform the rescue on Initializes a new instance of the class. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. A simple result. A result that is always succeeded. A result that is always canceled. The result. A result that is always failed. Executes the result using the specified context. The context. Occurs when execution has completed. The event args for the Completed event of an . Gets or sets the error if one occurred. The error. Gets or sets a value indicating whether the result was cancelled. true if cancelled; otherwise, false. Base class for all decorators. Initializes a new instance of the class. The result to decorate. Executes the result using the specified context. The context. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Occurs when execution has completed. Raises the event. The instance containing the event data. Extension methods for instances. Adds behavior to the result which is executed when the was cancelled. The result to decorate. The coroutine to execute when was canceled. Overrides of the decorated instance. The result to decorate. Rescues from the decorated by executing a coroutine. The type of the exception we want to perform the rescue on. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. Rescues any exception from the decorated by executing a coroutine. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. A base implementation of . Creates an instance of the screen. Gets or Sets the Parent Gets or Sets the Display Name Indicates whether or not this instance is currently active. Virtualized in order to help with document oriented view models. Indicates whether or not this instance is currently initialized. Virtualized in order to help with document oriented view models. Raised after activation occurs. Raised before deactivation. Raised after deactivation. Called when initializing. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Tries to close this instance by asking its Parent to initiate shutdown or by asking its corresponding view to close. Also provides an opportunity to pass a dialog result to it's corresponding view. The dialog result. Hosts extension methods for classes. Activates the item if it implements , otherwise does nothing. The potential activatable. Deactivates the item if it implements , otherwise does nothing. The potential deactivatable. Indicates whether or not to close the item after deactivating it. Closes the specified item. The conductor. The item to close. Closes the specified item. The conductor. The item to close. Activates a child whenever the specified parent is activated. The child to activate. The parent whose activation triggers the child's activation. Deactivates a child whenever the specified parent is deactivated. The child to deactivate. The parent whose deactivation triggers the child's deactivation. Activates and Deactivates a child whenever the specified parent is Activated or Deactivated. The child to activate/deactivate. The parent whose activation/deactivation triggers the child's activation/deactivation. An implementation of that enables sequential execution of multiple results. Initializes a new instance of the class. The enumerator. Occurs when execution has completed. Executes the result using the specified context. The context. A simple IoC container. Initializes a new instance of the class. Registers the instance. The service. The key. The implementation. Registers the class so that a new instance is created on every request. The service. The key. The implementation. Registers the class so that it is created once, on first request, and the same instance is returned to all requestors thereafter. The service. The key. The implementation. Registers a custom handler for serving requests from the container. The service. The key. The handler. Unregisters any handlers for the service/key that have previously been registered. The service. The key. Requests an instance. The service. The key. The instance, or null if a handler is not found. Determines if a handler for the service/key has previously been registered. The service. The key. True if a handler is registere; false otherwise. Requests all instances of a given type. The service. All the instances or an empty enumerable if none are found. Pushes dependencies into an existing instance based on interface properties with setters. The instance. Creates a child container. A new container. Actually does the work of creating the instance and satisfying it's constructor dependencies. The type. Creates an instance of the type with the specified constructor arguments. The type. The constructor args. The created instance. Occurs when a new instance is created. Extension methods to bring and together. Executes an asynchronous. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Executes an asynchronous. The type of the result. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Encapsulates a task inside a couroutine. The task. The coroutine that encapsulates the task. Encapsulates a task inside a couroutine. The type of the result. The task. The coroutine that encapsulates the task. A couroutine that encapsulates an . Initializes a new instance of the class. The task. Executes the result using the specified context. The context. Called when the asynchronous task has completed. The completed task. Occurs when execution has completed. A couroutine that encapsulates an . The type of the result. Initializes a new instance of the class. The task. Gets the result of the asynchronous operation. Called when the asynchronous task has completed. The completed task. The event args for the event. The view. The context. A base implementation of which is capable of caching views by context. The default view context. The view chache for this instance. Creates an instance of . Raised when a view is attached. Called when a view is attached. The view. The context in which the view appears. Called when an attached view's Loaded event fires. Called the first time the page's LayoutUpdated event fires after it is navigated to. Gets a view previously attached to this instance. The context denoting which view to retrieve. The view. A dictionary in which the values are weak references. The type of keys in the dictionary. The type of values in the dictionary. Initializes a new instance of the class that is empty, has the default initial capacity, and uses the default equality comparer for the key type. Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. The whose elements are copied to the new . Initializes a new instance of the class that contains elements copied from the specified and uses the specified . The whose elements are copied to the new . The implementation to use when comparing keys, or null to use the default for the type of the key. Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified . The implementation to use when comparing keys, or null to use the default for the type of the key. Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type. The initial number of elements that the can contain. Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the specified . The initial number of elements that the can contain. The implementation to use when comparing keys, or null to use the default for the type of the key. Returns an enumerator that iterates through the . The enumerator. Removes all keys and values from the . Gets the number of key/value pairs contained in the . Since the items in the dictionary are held by weak reference, the count value cannot be relied upon to guarantee the number of objects that would be discovered via enumeration. Treat the Count as an estimate only. Adds the specified key and value to the dictionary. The key of the element to add. The value of the element to add. The value can be null for reference types. Determines whether the contains the specified key. The key to locate in the . Removes the value with the specified key from the . The key of the element to remove. true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found in the . Gets the value associated with the specified key. The key of the value to get. When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. true if the contains an element with the specified key; otherwise, false. Gets or sets the value associated with the specified key. The key of the value to get or set. The value associated with the specified key. If the specified key is not found, a get operation throws a , and a set operation creates a new element with the specified key. Gets a collection containing the keys in the . Gets a collection containing the values in the . ================================================ FILE: packages/Caliburn.Micro.Core.3.2.0/lib/sl5/Caliburn.Micro.XML ================================================ Caliburn.Micro EventArgs sent during activation. Indicates whether the sender was initialized in addition to being activated. Contains details about the success or failure of an item's activation through an . The item whose activation was processed. Gets or sets a value indicating whether the activation was a success. true if success; otherwise, false. A base collection class that supports automatic UI thread marshalling. The type of elements contained in the collection. Initializes a new instance of the class. Initializes a new instance of the class. The collection from which the elements are copied. Enables/Disables property change notification. Notifies subscribers of the property change. Name of the property. Raises a change notification indicating that all bindings should be refreshed. Inserts the item to the specified position. The index to insert at. The item to be inserted. Exposes the base implementation of the function. The index. The item. Used to avoid compiler warning regarding unverifiable code. Sets the item at the specified position. The index to set the item at. The item to set. Exposes the base implementation of the function. The index. The item. Used to avoid compiler warning regarding unverifiable code. Removes the item at the specified position. The position used to identify the item to remove. Exposes the base implementation of the function. The index. Used to avoid compiler warning regarding unverifiable code. Clears the items contained by the collection. Exposes the base implementation of the function. Used to avoid compiler warning regarding unverifiable code. Raises the event with the provided arguments. Arguments of the event being raised. Raises the PropertyChanged event with the provided arguments. The event data to report in the event. Adds the range. The items. Removes the range. The items. Executes the given action on the UI thread An extension point for subclasses to customise how property change notifications are handled. An implementation of that holds on to and activates only one item at a time. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Gets the children. The collection of children. An implementation of that holds on many items. An implementation of that holds on many items. An implementation of that holds on to many items which are all activated. Initializes a new instance of the class. if set to true opens public items that are properties of this class. Initializes a new instance of the class. Gets the items that are currently being conducted. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when initializing. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Gets the children. The collection of children. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. An implementation of that holds on many items but only activates one at a time. Initializes a new instance of the class. Gets the items that are currently being conducted. Gets the children. The collection of children. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Determines the next item to activate based on the last active index. The list of possible active items. The index of the last active item. The next item to activate. Called after an active item is closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. A base class for various implementations of . The type that is being conducted. Gets or sets the close strategy. The close strategy. Occurs when an activation request is processed. Gets the children. The collection of children. Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Called by a subclass when an activation needs processing. The item on which activation was attempted. if set to true activation was successful. Ensures that an item is ready to be activated. The item that is about to be activated. The item to be activated. A base class for various implementations of that maintain an active item. The type that is being conducted. The currently active item. The currently active item. Changes the active item. The new item to activate. Indicates whether or not to close the previous active item. Extension methods for the . Registers a singleton. The type of the implementation. The container. The key. The container. Registers a singleton. The type of the service. The type of the implementation. The container. The key. The container. Registers an service to be created on each request. The type of the implementation. The container. The key. The container. Registers an service to be created on each request. The type of the service. The type of the implementation. The container. The key. The container. Registers an instance with the container. The type of the service. The container. The instance. The container. Registers a custom service handler with the container. The type of the service. The container. The handler. The container. Registers all specified types in an assembly as singleton in the container. The type of the service. The container. The assembly. The type filter. The container. Requests an instance. The type of the service. The container. The key. The instance. Gets all instances of a particular type. The type to resolve. The container. The resolved instances. Determines if a handler for the service/key has previously been registered. The service type. The container. The key. True if a handler is registere; false otherwise. Unregisters any handlers for the service/key that have previously been registered. The service type. The container. The key. A result decorator which executes a coroutine when the wrapped result was cancelled. Initializes a new instance of the class. The result to decorate. The coroutine to execute when was canceled. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Manages coroutine execution. Creates the parent enumerator. Executes a coroutine. The coroutine to execute. The context to execute the coroutine within. /// The completion callback for the coroutine. Executes a coroutine asynchronous. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Called upon completion of a coroutine. The context used during the execution of a Coroutine. The source from which the message originates. The view associated with the target. The instance on which the action is invoked. EventArgs sent during deactivation. Indicates whether the sender was closed in addition to being deactivated. A simple logger thats logs everything to the debugger. Initializes a new instance of the class. The type. Logs the message as info. A formatted message. Parameters to be injected into the formatted message. Logs the message as a warning. A formatted message. Parameters to be injected into the formatted message. Logs the exception. The exception. Used to gather the results from multiple child elements which may or may not prevent closing. The type of child element. Creates an instance of the class. Indicates that even if all conducted items are not closable, those that are should be closed. The default is FALSE. Executes the strategy. Items that are requesting close. The action to call when all enumeration is complete and the close results are aggregated. The bool indicates whether close can occur. The enumerable indicates which children should close if the parent cannot. Default implementation for that does no platform enlightenment. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. true if the handler was executed immediately; false otherwise Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. A result that executes an . Initializes a new instance of the class. The action. Executes the result using the specified context. The context. Occurs when execution has completed. A result that executes a The type of the result. Initializes a new instance of the class. The action. Executes the result using the specified context. The context. Gets the result. Occurs when execution has completed. Extension methods for Applies the action to each element in the list. The enumerable item's type. The elements to enumerate. The action to apply to each item in the list. Enables loosely-coupled publication of and subscription to events. Processing of handler results on publication thread. Searches the subscribed handlers to check if we have a handler for the message type supplied. The message type to check with True if any handler is found, false if not. Subscribes an instance to all events declared through implementations of The instance to subscribe for event publication. Unsubscribes the instance from all events. The instance to unsubscribe. Publishes a message. The message instance. Allows the publisher to provide a custom thread marshaller for the message publication. Extensions for . Publishes a message on the current thread (synchrone). The event aggregator. The message instance. Publishes a message on a background thread (async). The event aggregator. The message instance. Publishes a message on the UI thread. The event aggregator. The message instance. Publishes a message on the UI thread asynchrone. The event aggregator. The message instance. Publishes a message on the UI thread asynchrone. The event aggregator. The message instance. Enables easy marshalling of code to the UI thread. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Extension for . Converts an expression into a . The expression to convert. The member info. Denotes an instance which requires activation. Indicates whether or not this instance is active. Activates this instance. Raised after activation occurs. Denotes a node within a parent/child hierarchy. Gets or Sets the Parent Denotes a node within a parent/child hierarchy. The type of parent. Gets or Sets the Parent Denotes an object that can be closed. Tries to close this instance. Also provides an opportunity to pass a dialog result to it's corresponding view. The dialog result. Used to gather the results from multiple child elements which may or may not prevent closing. The type of child element. Executes the strategy. Items that are requesting close. The action to call when all enumeration is complete and the close results are aggregated. The bool indicates whether close can occur. The enumerable indicates which children should close if the parent cannot. Denotes an instance which conducts other objects by managing an ActiveItem and maintaining a strict lifecycle. Conducted instances can optin to the lifecycle by impelenting any of the follosing , , . Activates the specified item. The item to activate. Deactivates the specified item. The item to close. Indicates whether or not to close the item after deactivating it. Occurs when an activation request is processed. An that also implements . Denotes an instance which requires deactivation. Raised before deactivation. Deactivates this instance. Indicates whether or not this instance is being closed. Raised after deactivation. Enables loosely-coupled publication of and subscription to events. Searches the subscribed handlers to check if we have a handler for the message type supplied. The message type to check with True if any handler is found, false if not. Subscribes an instance to all events declared through implementations of The instance to subscribe for event publication. Unsubscribes the instance from all events. The instance to unsubscribe. Publishes a message. The message instance. Allows the publisher to provide a custom thread marshaller for the message publication. Denotes an instance which may prevent closing. Called to check whether or not this instance can close. The implementer calls this action with the result of the close check. A marker interface for classes that subscribe to messages. Denotes a class which can handle a particular type of message. The type of message to handle. Handles the message. The message. Denotes a class which can handle a particular type of message and uses a Coroutine to do so. Handle the message with a Coroutine. The message. The coroutine to execute. Denotes a class which can handle a particular type of message and uses a Task to do so. Handle the message with a Task. The message. The Task that represents the operation. Denotes an instance which maintains an active item. The currently active item. Denotes an instance which has a display name. Gets or Sets the Display Name A logger. Logs the message as info. A formatted message. Parameters to be injected into the formatted message. Logs the message as a warning. A formatted message. Parameters to be injected into the formatted message. Logs the exception. The exception. Extends such that the change event can be raised by external parties. Enables/Disables property change notification. Notifies subscribers of the property change. Name of the property. Raises a change notification indicating that all bindings should be refreshed. Represents a collection that is observable. The type of elements contained in the collection. Adds the range. The items. Removes the range. The items. Used by the framework to pull instances from an IoC container and to inject dependencies into certain existing classes. Gets an instance by type and key. Gets all instances of a particular type. Passes an existing instance to the IoC container to enable dependencies to be injected. Gets an instance from the container. The type to resolve. The key to look up. The resolved instance. Gets all instances of a particular type. The type to resolve. The resolved instances. Interface used to define an object associated to a collection of children. Gets the children. The collection of children. Interface used to define a specialized parent. The type of children. Gets the children. The collection of children. Interface for platform specific operations that need enlightenment. Indicates whether or not the framework is in design-time mode. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread asynchronously. The action to execute. Executes the action on the UI thread. The action to execute. Used to retrieve the root, non-framework-created view. The view to search. The root element that was not created by the framework. In certain instances the services create UI elements. For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. Executes the handler the fist time the view is loaded. The view. The handler. Executes the handler the next time the view's LayoutUpdated event fires. The view. The handler. Get the close action for the specified view model. The view model to close. The associated views. The dialog result. An to close the view model. Allows custom code to execute after the return of a action. Executes the result using the specified context. The context. Occurs when execution has completed. Allows custom code to execute after the return of a action. The type of the result. Gets the result of the asynchronous operation. Denotes an instance which implements , , , and Denotes a class which is aware of its view(s). Attaches a view to this instance. The view. The context in which the view appears. Gets a view previously attached to this instance. The context denoting which view to retrieve. The view. Raised when a view is attached. Used to manage logging. Creates an for the provided type. A result decorator that overrides of the decorated instance. Initializes a new instance of the class. The result to decorate. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Access the current . Gets or sets the current . A base class that implements the infrastructure for property change notification and automatically performs UI thread marshalling. Creates an instance of . Occurs when a property value changes. Enables/Disables property change notification. Virtualized in order to help with document oriented view models. Raises a change notification indicating that all bindings should be refreshed. Notifies subscribers of the property change. Name of the property. Notifies subscribers of the property change. The type of the property. The property expression. Raises the event directly. The instance containing the event data. Executes the given action on the UI thread An extension point for subclasses to customise how property change notifications are handled. A result decorator which rescues errors from the decorated result by executing a rescue coroutine. The type of the exception we want to perform the rescue on Initializes a new instance of the class. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. The event args for the Completed event of an . Gets or sets the error if one occurred. The error. Gets or sets a value indicating whether the result was cancelled. true if cancelled; otherwise, false. Base class for all decorators. Initializes a new instance of the class. The result to decorate. Executes the result using the specified context. The context. Called when the execution of the decorated result has completed. The context. The decorated result. The instance containing the event data. Occurs when execution has completed. Raises the event. The instance containing the event data. Extension methods for instances. Adds behavior to the result which is executed when the was cancelled. The result to decorate. The coroutine to execute when was canceled. Overrides of the decorated instance. The result to decorate. Rescues from the decorated by executing a coroutine. The type of the exception we want to perform the rescue on. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. Rescues any exception from the decorated by executing a coroutine. The result to decorate. The rescue coroutine. Set to true to cancel the result after executing rescue. A base implementation of . Creates an instance of the screen. Gets or Sets the Parent Gets or Sets the Display Name Indicates whether or not this instance is currently active. Virtualized in order to help with document oriented view models. Indicates whether or not this instance is currently initialized. Virtualized in order to help with document oriented view models. Raised after activation occurs. Raised before deactivation. Raised after deactivation. Called when initializing. Called when activating. Called when deactivating. Inidicates whether this instance will be closed. Called to check whether or not this instance can close. The implementor calls this action with the result of the close check. Tries to close this instance by asking its Parent to initiate shutdown or by asking its corresponding view to close. Also provides an opportunity to pass a dialog result to it's corresponding view. The dialog result. Hosts extension methods for classes. Activates the item if it implements , otherwise does nothing. The potential activatable. Deactivates the item if it implements , otherwise does nothing. The potential deactivatable. Indicates whether or not to close the item after deactivating it. Closes the specified item. The conductor. The item to close. Closes the specified item. The conductor. The item to close. Activates a child whenever the specified parent is activated. The child to activate. The parent whose activation triggers the child's activation. Deactivates a child whenever the specified parent is deactivated. The child to deactivate. The parent whose deactivation triggers the child's deactivation. Activates and Deactivates a child whenever the specified parent is Activated or Deactivated. The child to activate/deactivate. The parent whose activation/deactivation triggers the child's activation/deactivation. An implementation of that enables sequential execution of multiple results. Initializes a new instance of the class. The enumerator. Occurs when execution has completed. Executes the result using the specified context. The context. A simple IoC container. Initializes a new instance of the class. Registers the instance. The service. The key. The implementation. Registers the class so that a new instance is created on every request. The service. The key. The implementation. Registers the class so that it is created once, on first request, and the same instance is returned to all requestors thereafter. The service. The key. The implementation. Registers a custom handler for serving requests from the container. The service. The key. The handler. Unregisters any handlers for the service/key that have previously been registered. The service. The key. Requests an instance. The service. The key. The instance, or null if a handler is not found. Determines if a handler for the service/key has previously been registered. The service. The key. True if a handler is registere; false otherwise. Requests all instances of a given type. The service. All the instances or an empty enumerable if none are found. Pushes dependencies into an existing instance based on interface properties with setters. The instance. Creates a child container. A new container. Actually does the work of creating the instance and satisfying it's constructor dependencies. The type. Creates an instance of the type with the specified constructor arguments. The type. The constructor args. The created instance. Occurs when a new instance is created. A simple result. A result that is always succeeded. A result that is always canceled. The result. A result that is always failed. Executes the result using the specified context. The context. Occurs when execution has completed. A collection of extension methods to help with differing reflection between the portable library and SL5 Extension methods to bring and together. Executes an asynchronous. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Executes an asynchronous. The type of the result. The coroutine to execute. The context to execute the coroutine within. A task that represents the asynchronous coroutine. Encapsulates a task inside a couroutine. The task. The coroutine that encapsulates the task. Encapsulates a task inside a couroutine. The type of the result. The task. The coroutine that encapsulates the task. A couroutine that encapsulates an . Initializes a new instance of the class. The task. Executes the result using the specified context. The context. Called when the asynchronous task has completed. The completed task. Occurs when execution has completed. A couroutine that encapsulates an . The type of the result. Initializes a new instance of the class. The task. Gets the result of the asynchronous operation. Called when the asynchronous task has completed. The completed task. The event args for the event. The view. The context. A base implementation of which is capable of caching views by context. The default view context. The view chache for this instance. Creates an instance of . Raised when a view is attached. Called when a view is attached. The view. The context in which the view appears. Called when an attached view's Loaded event fires. Called the first time the page's LayoutUpdated event fires after it is navigated to. Gets a view previously attached to this instance. The context denoting which view to retrieve. The view. A dictionary in which the values are weak references. The type of keys in the dictionary. The type of values in the dictionary. Initializes a new instance of the class that is empty, has the default initial capacity, and uses the default equality comparer for the key type. Initializes a new instance of the class that contains elements copied from the specified and uses the default equality comparer for the key type. The whose elements are copied to the new . Initializes a new instance of the class that contains elements copied from the specified and uses the specified . The whose elements are copied to the new . The implementation to use when comparing keys, or null to use the default for the type of the key. Initializes a new instance of the class that is empty, has the default initial capacity, and uses the specified . The implementation to use when comparing keys, or null to use the default for the type of the key. Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type. The initial number of elements that the can contain. Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the specified . The initial number of elements that the can contain. The implementation to use when comparing keys, or null to use the default for the type of the key. Returns an enumerator that iterates through the . The enumerator. Removes all keys and values from the . Gets the number of key/value pairs contained in the . Since the items in the dictionary are held by weak reference, the count value cannot be relied upon to guarantee the number of objects that would be discovered via enumeration. Treat the Count as an estimate only. Adds the specified key and value to the dictionary. The key of the element to add. The value of the element to add. The value can be null for reference types. Determines whether the contains the specified key. The key to locate in the . Removes the value with the specified key from the . The key of the element to remove. true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found in the . Gets the value associated with the specified key. The key of the value to get. When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. true if the contains an element with the specified key; otherwise, false. Gets or sets the value associated with the specified key. The key of the value to get or set. The value associated with the specified key. If the specified key is not found, a get operation throws a , and a set operation creates a new element with the specified key. Gets a collection containing the keys in the . Gets a collection containing the values in the . Allows you to obtain the method or property name of the caller.