Found 12 packages
EonaCat Commands GiveCommand (Relay) AsyncCommand ManualResetCommand CancelAsyncCommand Bindable object
WPF ToolKit contains useful services, converters to work with WPF. It targets MVVM pattern.
The BindingListView .NET library provides a type-safe, sortable, filterable, data-bindable view of one or more lists of objects. It is the business objects equivalent of using a DataView on a DataTable in ADO.NET. If you have a list of objects to display on a Windows Forms UI (e.g. in a DataGridView) and want to allow your user to sort and filter, then this is the library to use!
Mvvm framework with BindableObject, DelegateCommand and IoC Container
Bindable Object View Model and supporting artefacts for the Xamarin.Forms ViewModelFactory pattern VROOM implementation of MVVM, with API at www.Xamtastic.com ViewModelFactory Pattern for Xamarin.Forms is a lightweight library that affords the separation of concerns between the creation of Dynamic UI, and the creation and integration of the Services SDK that the UI drives and consumes. It uses hyperbolic rendering to auto-generate complex UI based upon the cascading of a generic Bindable Object View Model.
A MVVM toolbox of a bindable object, and commands that using Reactive Extensions.
Allows to generate code with Source Generators. Support: MvvmLib, Prism (installation detected) Class Level Attributes: - Inpc: to implement INotifyPropertyChanged - BindableObject: allows to add BindableBase Class (and implement IActiveAware for Prism) Field Level Attribute: - BindableProperty: allows to use "Setproperty", specify properties (OnPropertyChanged/RaisePropertyChanged) and commands (RaiseCanExecuteChanged) notified when the value has changed. Method Level Attribute: - Command: for add a DelegateCommand with CanExecute method and Name to specify a custom command name. (Comments supported on fields and methods for generated properties and commands)
WPF 帮助类库,包含: 01、MVVM 基础支持类(BindableBase、RelayCommand 等)。 02、WPF 帮助类(BindingProxy、ResourceBinding、MediaColorHelper 等)。 03、一些附加属性帮助类(WpfXamlPropProxy、ExportPicAttached、WpfTouchScrollHelper 等)。 04、行为类(DragInCanvasBehavior、SelectedItemBehavior)。 05、一些样式(<ResourceDictionary Source="pack://application:,,,/Anh.WPFTemplateLib;component/Styles/StyleDictionary.xaml" />) 06、一些转换器(<ResourceDictionary Source="pack://application:,,,/Anh.WPFTemplateLib;component/WpfConverters/ConverterDictionary.xaml" />) 07、一个配置属性系统。 08、一些控件(Toast、ToastTextBlock、SystemDropShadowChrome)。 09、一些用户控件(UC_InfoRegion、CircleWithTextBox、UC_Wait、UC_ConfirmBox 等)。 10、类型转换器(EnumDescriptionTypeConverter)。 使用方法详见: 1、https://gitee.com/dlgcy/DLGCY_WPFPractice 2、https://gitee.com/dlgcy/WPFTemplate 3、https://gitee.com/DLGCY_Clone/WpfToast 大部分是搬运修改网上的资源,少部分是自己原创,以自用为主,感兴趣的朋友也可以使用,欢迎交流讨论(微信公众号:独立观察员博客)。 版本发布说明: 3.23.0806.1156 添加 AnhWpfHelper.IsInDesignMode 是否为设计器模式 4.23.0806.1506 优化空引用问题和生成警告等 5.23.0806.1531 优化空引用问题和生成警告等 6.23.0810.2036 优化 Toast.Show 由于不是 STA 线程引发的问题。主要是多线程等其它情况调用时引发的。 7.23.0810.2058 优化 Toast.Show 由于不是 STA 线程引发的问题。主要是多线程等其它情况调用时引发的。 8.23.0810.2124 添加 Anh Wpf MessageBox.Show 更稳定 (优化 Toast.Show 由于不是 STA 线程引发的问题。主要是多线程等其它情况调用时引发的) 9.23.0811.2309 右下角任务栏图标 AnhNotifyIconHelp 10.23.0812.1057 右下角任务栏图标 AnhNotifyIconHelp 点击图标显示时激活窗体 11.23.0812.2252 修正字体颜色异常问题 12.23.0822.2311 添加转换器 ObjectToJsonConverter 13.23.0823.1019 优化设计时 报错问题,WpfScreen 类的报错 14.23.08913.2258 优化Toast.Show显示时宽度不正常的BUG 15.23.08913.2346 优化部份情况还会出现“14.23.08913.2258”中的同样BUG的问题。 16.23.0923.2311 添加转换器 ObjectIsNullToVisibleConverter CollectionIsEmptyToVisibleConverter。 17.23.1027.1909 添加类型 [转换器] 绑定集合对象,集合不为空则返回 True。[转换器] 绑定集合对象,集合为空则返回 True。 18.23.1027.2036 添加类型 [转换器] Bool 如果是 False 或 null 则 不显示。[转换器] Bool 如果是 False 或 null 则 显示。[转换器] Bool 如果是 True 则 不显示。[转换器] Bool 如果是 True 则 显示。 19.23.1028.0109 修正BUG:ObjectToJsonConverter 无效问题,Bool IsTrue IsFalse To Visiblility 无效问题。 20.23.1116.2357 Anh.MessageBox.Show 添加 ToastOptions,并升级到 .net8.0 正式版 20.23.1117.0040 Anh.MessageBox.Show 如果不传显示时长,默认为5秒。 21.24.0117.1645 优化 ValueToVisibleConverter 值为空时返回相反值,不报错。 22.24.0118.1804 添加 ImageBitmapExt、CamareBitmapHelper 23.24.0121.1534 整理,添加一些东西 24.24.0121.1546 修复BUG 25.24.10121.1652 修复BUG 26.24.10203.1725 添加转换器 StringLengthToFalseConverter 27.24.10227.2328 Datetime 时间 转换 为指定格式的时间字符串 DatetimeConverter 28.24.10409.1528 ValueToCollapsedConverter、ValueToVisibleConverter 优化
This library provides UI components, such as XAML extensions, helpers, converters and more. It is part of the ModernWpf Community Toolkit. Converters: Commonly used converters that allow the data to be modified as it passes through the binding engine. Extensions: - DependencyObjectExtensions: Provides methods to Register and Unregister PropertyChangedCallback of a DependencyProperty. - FrameworkElementExtensions: Provides attached dependency properties for the FrameworkElement. - LogicalTree: Defines a collection of extensions methods for UI. - MatrixExtensions: Provides a set of extensions to the Matrix struct. - MatrixHelperEx: Static helper methods for Matrix. - NullableBool: Custom MarkupExtension which can provide nullable bool values. - RotateTransformExtensions: Extension methods for RotateTransform. - ScaleTransformExtensions: Extension methods for ScaleTransform. - SkewTransformExtensions: Extension methods for SkewTransform. - TextBoxMask: TextBox mask property allows a user to more easily enter fixed width text in TextBox control. - TextBoxRegex: TextBoxRegex allows text validation using a regular expression. - TranslateTransformExtensions: Extension methods for TranslateTransform. - VisualTree: Defines a collection of extensions methods for UI. Helpers: - BindableValueHolder: Holds the value. Can be used to change several objects' properties at a time. - DependencyPropertyWatcher: Used to Track Changes of a Dependency Property. - GraphicsHelper: Used to get pixel's color from a bitmap source.
更新内容: 1、[增强] [转换器] StringFormatConverter 添加属性 IsEmptyNotApplyFormat,可设置为 true:绑定值为空时不进行格式化处理。 2、[新增] [转换器] BoolToOtherResultConverter:Bool 值转其它类型的结果(以标记扩展方式使用)。 3、[增强] [附加属性] SelectorItemDragState.IsUnderDragCursor、IsBeingDragged 支持继承。 *********************************************** 本库为一款【WPF 帮助类库】,包含但不限于以下内容: 01、MVVM 基础支持类(命令:RelayCommand;绑定:ObservableObject、SimpleBindableBase、NotifyDataErrorObject、ViewModelBase)。 02、WPF 帮助类(BindingProxy、ResourceBinding、MediaColorHelper、FrameworkElementHelper、ConverterHelper 等)。 03、附加属性帮助类(WpfXamlPropProxy、BringIntoViewBehavior、ExportPicAttached、WpfTouchScrollHelper、GridHelper、FocusAttached、DataGridAttached、 TextBoxAttached、LabelAttached、RadioButtonAttached、RotateToTranslateAttachedV2、LocationTargetRenderOriginAttached、TabControlAttached 等)。 04、行为类(DragInCanvasBehavior、SelectedItemBehavior、AttachAdornerBehavior 等)。 05、样式(<ResourceDictionary Source="pack://application:,,,/WPFTemplateLib;component/Styles/StyleDictionary.xaml" />); 默认主题(不引入则不设置默认样式)(<ResourceDictionary Source="pack://application:,,,/WPFTemplateLib;component/Styles/DefaultThemeDictionary.xaml" />); 颜色主题(部分控件有效):[默认]蓝色(*/Light.Blue.xaml)、绿色(<ResourceDictionary Source="pack://application:,,,/WPFTemplateLib;component/Themes/Light.Green.xaml" />)。 06、转换器("<ResourceDictionary Source="pack://application:,,,/WPFTemplateLib;component/WpfConverters/ConverterDictionary.xaml" />) 07、配置属性系统(ConfigManager)。 08、自定义控件(Toast、ToastTextBlock、SystemDropShadowChrome、XUI:Form、PanelWithMessage、CircleWithInOutText、PP:CornerClip、FlipableControl、FlipableContentControl、 Handy:UniformSpacingPanel、PP:DateTimePicker、PP:SimplePanel、Handy:Row/Col、AutoGrid、TitleValueUnit、fruit:Table、fruit:PasswordInput、mah:MetroHeader 等)。 09、用户控件(UC_InfoRegion、CircleWithTextBox、UC_Wait、UC_ConfirmBox 等)。 10、类型转换器(EnumDescriptionTypeConverter)。 11、在行为中使用的事件触发器(RoutedEventTrigger)。 12、增强类(FixedCountObservableCollection、RangeObservableCollection 等)。 13、一个常用值类 CommonValues(目前有两个布尔值:TrueValue、FalseValue)。 14、标记扩展(lib:IntValue、SolidColorBrushValue、BoolValue、VisibilityValue 等)。 基础说明: - Xaml 命名空间:xmlns:lib="https://gitee.com/dlgcy/WPFTemplateLib" 。 - 样式以"LibSty"开头,控件模版以"LibTpl"开头。WPF 系统样式以"SysSty"开头,控件模板以"SysTpl"开头。 - 转换器列表:https://gitee.com/dlgcy/WPFTemplateLib/blob/master/WpfConverters/ConverterDictionary.xaml - 默认主题的内容:https://gitee.com/dlgcy/WPFTemplateLib/blob/master/Styles/DefaultThemeDictionary.xaml - 转换器等地方需要指定值转换模式的,使用以下枚举名或值:Visibility(1)、Bool(2)、String(3)、Int(4)、Float(5)、Double(6)、SolidColorBrush(7)、UInt(8)、Short(9)、UShort(10)、Byte(11)、Long(12)。 或者整体使用[静态类]UsefulConvertParaStr,如:UsefulConvertParaStr.VisibleCollapsed、TrueFalse。 使用方法详见: 1、https://gitee.com/dlgcy/DLGCY_WPFPractice 2、https://gitee.com/dlgcy/WPFTemplate 3、https://dlgcy.com 4、https://gitee.com/dlgcy/WpfAnimationDemo 一部分是搬运修改网上的资源,一部分是自己原创,以自用为主,感兴趣的朋友也可以使用,欢迎交流讨论(微信公众号:独立观察员博客)。 重要更改基本在本人业余时间完成,仅代表个人立场,与本人所在公司无关。 免责声明:本库及维护者不对使用产生的任何问题负责,请自行充分测试。 严正声明:禁止在 996 以及相似类型的公司中使用本库。
Microsoft.AspNetCore.Mvc.NewtonsoftJson services.AddControllers().AddNewtonsoftJson(o => o.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); Dotnet controller [FromQuery] ?sort=asc using var transaction = Context.Database.BeginTransaction(); bike.Id = id; var c = await Context.Bikes.FindAsync(id); Context.Bikes.Remove(c); Context.Bikes.Add(bike); await Context.SaveChangesAsync(); await transaction.CommitAsync(); var startedRental = await Context.Rentals.FirstAsync(); startedRental.End = System.DateTime.Now; startedRental.TotalCosts = CostCalculation.CalculateTotalCost(startedRental); startedRental.Customer = await Context.Customers.FindAsync(rental.CustomerID); startedRental.Bike = await Context.Bikes.FindAsync(rental.BikeID); Context.Rentals.Update(startedRental); await Context.SaveChangesAsync(); var result=await unpaid .Include(c => c.Customer) .Select(item => new { item.CustomerID, item.Customer.LastName, item.Customer.FirstName, item.Id, item.Begin, item.End }) .ToListAsync(); return (await dataContext.Deposits.Include("Membership.Member").ToArrayAsync()) .GroupBy(d => new { d.Membership.Begin.Year, d.Membership.Member }) .Select(i => new DepositStatistics { Year = i.Key.Year, Member = i.Key.Member, TotalAmount = i.Sum(d => d.Amount) }); using var transaction = Database.BeginTransaction(); await Database.ExecuteSqlRawAsync("DELETE FROM Taxis"); await Database.ExecuteSqlRawAsync("DELETE FROM Drivers"); await Database.ExecuteSqlRawAsync("DELETE FROM Rides"); await transaction.CommitAsync(); var result = await Rides.Where(e => e.Start.Year == year and e.Start.Month == month).ToListAsync(); var drivers=result.GroupBy(d => d.Driver); var ret=drivers.Select(b => new DriverStatistics { DriverName = b.Key.Name, TotalCharge = b.Sum(d => d.Charge) ?? 0 }); public async Task T> GetFromServiceAsync T>(string path) { var response = await client.GetStringAsync(BASE_URL + path); return JsonSerializer.Deserialize T>(response, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); } public async Task HttpResponseMessage> PostToServiceAsync T>(string path, T payload ) { var body = new StringContent(JsonSerializer.Serialize T>(payload), Encoding.UTF8, "application/json"); var response = await client.PostAsync(BASE_URL + path,body); return response; } WPF GUI BindableBase Customers customers = new Customers(Customer, client); customers.Show(); MainWindow.Close.Execute(); ComboBox ItemsSource="{Binding Taxis}" DisplayMemberPath="LicensePlate" SelectedItem="{Binding SelectedTaxi}" /> UpdateSourceTrigger=PropertyChanged DataGrid Name="TaskTable" ItemsSource="{Binding Tasks}" RowEditEnding="TaskTable_RowEditEnding" AutoGenerateColumns="False" > DataGrid.Columns> DataGridTextColumn Header="TaskId" Binding="{Binding TaskId, UpdateSourceTrigger=LostFocus}"/> public async void TaskTable_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { var task = e.Row.Item as Task; await GetTasks(); if (task != null and task.Name == String.Empty) { var result = await client.DeleteToServiceAsync("Tasks/" + task.TaskId); MessageBox.Show("DELETE" + result.StatusCode.ToString()); } else if (Tasks.Any(b => b.TaskId == task.TaskId)) { var result = await client.PutToServiceAsync("Tasks/" +task.TaskId, task); MessageBox.Show("EDIT" + result.StatusCode.ToString()); } else { var result = await client.PostToServiceAsync("Tasks" , task); MessageBox.Show("ADD" + result.StatusCode.ToString()); } await GetTasks(); }
Microsoft.AspNetCore.Mvc.NewtonsoftJson services.AddControllers().AddNewtonsoftJson(o => o.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); Dotnet controller [FromQuery] ?sort=asc using var transaction = Context.Database.BeginTransaction(); bike.Id = id; var c = await Context.Bikes.FindAsync(id); Context.Bikes.Remove(c); Context.Bikes.Add(bike); await Context.SaveChangesAsync(); await transaction.CommitAsync(); var startedRental = await Context.Rentals.FirstAsync(); startedRental.End = System.DateTime.Now; startedRental.TotalCosts = CostCalculation.CalculateTotalCost(startedRental); startedRental.Customer = await Context.Customers.FindAsync(rental.CustomerID); startedRental.Bike = await Context.Bikes.FindAsync(rental.BikeID); Context.Rentals.Update(startedRental); await Context.SaveChangesAsync(); var result=await unpaid .Include(c => c.Customer) .Select(item => new { item.CustomerID, item.Customer.LastName, item.Customer.FirstName, item.Id, item.Begin, item.End }) .ToListAsync(); return (await dataContext.Deposits.Include("Membership.Member").ToArrayAsync()) .GroupBy(d => new { d.Membership.Begin.Year, d.Membership.Member }) .Select(i => new DepositStatistics { Year = i.Key.Year, Member = i.Key.Member, TotalAmount = i.Sum(d => d.Amount) }); using var transaction = Database.BeginTransaction(); await Database.ExecuteSqlRawAsync("DELETE FROM Taxis"); await Database.ExecuteSqlRawAsync("DELETE FROM Drivers"); await Database.ExecuteSqlRawAsync("DELETE FROM Rides"); await transaction.CommitAsync(); var result = await Rides.Where(e => e.Start.Year == year and e.Start.Month == month).ToListAsync(); var drivers=result.GroupBy(d => d.Driver); var ret=drivers.Select(b => new DriverStatistics { DriverName = b.Key.Name, TotalCharge = b.Sum(d => d.Charge) ?? 0 }); public async Task T> GetFromServiceAsync T>(string path) { var response = await client.GetStringAsync(BASE_URL + path); return JsonSerializer.Deserialize T>(response, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); } public async Task HttpResponseMessage> PostToServiceAsync T>(string path, T payload ) { var body = new StringContent(JsonSerializer.Serialize T>(payload), Encoding.UTF8, "application/json"); var response = await client.PostAsync(BASE_URL + path,body); return response; } WPF GUI BindableBase Customers customers = new Customers(Customer, client); customers.Show(); MainWindow.Close.Execute(); ComboBox ItemsSource="{Binding Taxis}" DisplayMemberPath="LicensePlate" SelectedItem="{Binding SelectedTaxi}" /> UpdateSourceTrigger=PropertyChanged DataGrid Name="TaskTable" ItemsSource="{Binding Tasks}" RowEditEnding="TaskTable_RowEditEnding" AutoGenerateColumns="False" > DataGrid.Columns> DataGridTextColumn Header="TaskId" Binding="{Binding TaskId, UpdateSourceTrigger=LostFocus}"/> public async void TaskTable_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { var task = e.Row.Item as Task; await GetTasks(); if (task != null and task.Name == String.Empty) { var result = await client.DeleteToServiceAsync("Tasks/" + task.TaskId); MessageBox.Show("DELETE" + result.StatusCode.ToString()); } else if (Tasks.Any(b => b.TaskId == task.TaskId)) { var result = await client.PutToServiceAsync("Tasks/" +task.TaskId, task); MessageBox.Show("EDIT" + result.StatusCode.ToString()); } else { var result = await client.PostToServiceAsync("Tasks" , task); MessageBox.Show("ADD" + result.StatusCode.ToString()); } await GetTasks(); }