
.Net应用技术
XBMY
C#爱好者,欢迎交流
展开
-
PsimApp创建时提示错误属性“DataContext”必须位于默认的命名空间或元素命名空间“http://schemas.microsoft.com/winfx/2006/xaml/present
属性“DataContext”必须位于默认的命名空间或元素命名空间“http://schemas.microsoft.com/winfx/2006/xaml/presentation”中。行 7 位置 70.PsimApp创建后,加入xaml 代码。原创 2025-02-17 09:59:50 · 102 阅读 · 0 评论 -
注册证书的代码
注册证书的代码。原创 2023-04-02 09:18:19 · 231 阅读 · 0 评论 -
EPPlus处理Excel常用操作
using OfficeOpenXml;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Text.RegularExpressions;using System.Threading.Tasks;namespace WDPaser{ ...原创 2020-02-12 14:30:59 · 1921 阅读 · 0 评论 -
WPF 加载 html中的highcharts 图表
https://www.highcharts.com.cn/products/highcharts原创 2020-03-26 09:23:36 · 620 阅读 · 0 评论 -
利用SQLiteFunction生成的自定义函数构建SQL语句示例
利用SQLiteFunction生成的自定义函数构建SQL语句SQLite的内置函数非常有限,往往达不到实际需求,不过它提供了SQLiteFunction,可以让用户自定义函数,如下是使用在C#中使用自定义函数的示例函数定义using System;using System.Data.SQLite;using System.Linq;namespace TS.BLL{ /*...原创 2020-03-04 22:57:33 · 1395 阅读 · 0 评论 -
Git 常用命令
Git 常用命令在当前目录新建一个Git代码库新建一个目录,将其初始化为Git代码库下载一个项目和它的整个代码历史显示当前的Git配置编辑Git配置文件设置提交代码时的用户信息添加指定文件到暂存区添加指定目录到暂存区,包括子目录添加当前目录的所有文件到暂存区添加每个变化前,都会要求确认对于同一个文件的多处变化,可以实现分次提交删除工作区文件,并且将这次删除放入暂存区停止追踪指定文件,但该文件会保留在工作区改名文件,并且将这个改名放入暂存区提交暂存区到仓库区提交暂存区的指定文件到仓库区提交工作区自上次comm原创 2021-02-05 12:46:32 · 420 阅读 · 0 评论 -
TimeSpan格式化
TimeSpan格式化TimeSpan t = new TimeSpan(31, 8, 24, 1);string c1= t.ToString(@"d\.hh\:mm\.ss"); //31.08:24.01string c2 = t.ToString("c"); //31.08:24:01string c3 = t.ToString("g"); ...原创 2020-03-05 09:38:44 · 2803 阅读 · 0 评论 -
.Net各版本地址
https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral原创 2020-04-08 16:39:11 · 2761 阅读 · 0 评论 -
WPF 颜色转换
HEX16色转Bursh:Brush brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF"));RGB三原色转Bursh:Brush brush = new SolidColorBrush(Color.FromRgb(255, 255, 255));HEX16色转Bursh:Brus...原创 2020-03-27 19:45:52 · 1191 阅读 · 0 评论 -
WPF常备
WPF常备PropertyChanged.FodyNuget安装添加到FodyWeavers.xmlCostura.FodyBaseViewModelBasePageBaseAttachedPropertyBaseValueConverterBooleanToVisiblityConverterStoryboardAttachedProperty实现逆时针顺时针旋转功能PropertyChanged.FodyNuget安装安装 PropertyChanged.Fody NuGet 软件包并更新Fody原创 2020-05-16 11:41:36 · 392 阅读 · 0 评论 -
vs编辑器中有时需要批量删除无用的空白行
在vs编辑器中有时需要批量删除无用的空白行,为此,可以使用vs编辑器的查找替换功能:Ctrl+H,打开替换功能框。2.选择“使用正则表达式”,“当前文档”。3.在查找框中输入:(?<=\r\n)\r\n4.全部替换...原创 2020-03-25 19:17:34 · 664 阅读 · 1 评论 -
面向 Web 开发者的文档
面向 Web 开发者的文档,介绍的比较详细https://developer.mozilla.org/zh-CN/docs/Web原创 2021-03-27 07:39:42 · 376 阅读 · 0 评论 -
StringExtension
C# StringExtensionusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Text.RegularExpressions;using System.Threading.Tasks;namespace TS.BLL{ pub...原创 2020-03-13 12:16:36 · 482 阅读 · 0 评论 -
WPF DatePicker默认显示当前日期,格式化为年月日
原文:WPF DatePicker默认显示当前日期WPF的日历选择控件默认为当前日期,共有两种方法,一种静态,一种动态。静态的当然写在DatePicker控件的属性里了,动态的写在对应的cs文件里,具体请看下面。1.方法一:myDatePicker.Text = DateTime.Today.ToLongDateString();2.方法二:...转载 2019-06-06 13:15:47 · 5206 阅读 · 1 评论 -
未能加载文件或程序集“System.Windows.Interactivity问题的解决
在WPF项目调试过程中,出现“发现“System.Windows.Interactivity”的不同版本间存在无法解决的冲突。”报错,程序无法运行,我试图卸载和重新安装该控件,但仍无法解决。终查看App.config中,见下图,发现多出红框部分代码,删除后程序正常运行。...原创 2020-04-09 09:14:58 · 4843 阅读 · 2 评论 -
Datagrid布局与样式(居中,单元格颜色,排序)
<Page x:Class="Lx.Pages.Page_bkzj_gn" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://sc...原创 2019-12-31 08:51:04 · 1398 阅读 · 1 评论 -
WPF循序渐进 Sample 001 自定义WindowUI
代码<Window x:Class="CustomUI.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="CustomChromeWindow...原创 2019-07-24 21:15:49 · 503 阅读 · 0 评论 -
利用WPF+XPS完成套打任务
利用WPF+XPS完成套打任务step 1:xps模板建立step 2 建立项目建立 XPSHelper类新建Print窗口编写后台代码Step 3:观察打印效果step 1:xps模板建立为完成套打任务,首先利用Word建立如下文档,并保存为xps模板step 2 建立项目建立 WpfPrintDemo 项目,并将如下代码复制为新建类建立 XPSHelper类using Syste...原创 2020-04-01 09:29:11 · 1936 阅读 · 0 评论 -
WPF ListBox 鼠标左键双击
WPF ListBox 鼠标左键双击XAML<!--鼠标左键双击--> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Text}" ToolTip="鼠标左键双击,采集本年...原创 2019-06-27 15:49:44 · 1728 阅读 · 3 评论 -
WPF Image Stretch属性值解释
None :The content preserves its original size.保持原始尺寸。Supported by Silverlight for Windows PhoneFill: The content is resized to fill the destination dimensions. The aspect ratio is not preserved.缩放...原创 2020-03-08 08:29:42 · 2287 阅读 · 0 评论 -
WPF DataGrid中的DataGridComboBoxColumn 单击显示下拉框
WPF, DataGrid中的DataGridComboBoxColumn,如何单击显示下拉框默认双击才能出现下拉框,现在客户需要单击就显示,如何解决。默认双击才能出现下拉框,现在客户需要单击就显示,如何解决。step 1:private void datagrid1_CurrentCellChanged(object sender, EventArgs e){ datagrid1...转载 2019-05-07 16:14:00 · 3968 阅读 · 0 评论 -
WPF控件事件binding到ViewModel
将ComboBox的Selectchanged事件binding到ViewModel通过Nuget安装 System.Windows.Interactivity.WPF使用System.Windows.Interactivity.dll,添加该dll到项目引用xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=Syst...原创 2020-03-02 13:49:10 · 1332 阅读 · 0 评论 -
WPF MVVM应用:动态加载菜单项
目录 View ViewModel 效果 View <Menu x:Name="MainMenu" ItemsSource="{Binding MenuItems}" ></Menu> ViewModel using Prism.Mvvm;using SqlHelp;using System;using System.Colle...原创 2019-04-24 08:34:13 · 3519 阅读 · 4 评论 -
利用Epplus将数据导出到Excel
/// <summary> /// 导出到Excel /// </summary> /// <param name="obj"></param> /// <summary> /// 导出Excel /// </summar...原创 2019-06-25 07:02:13 · 2401 阅读 · 0 评论 -
Sample 003 托盘图标NotificationIcon
需添加并引用 using System.Windows.Forms;using System.Drawing;using System.Windows;using System.Windows.Forms;namespace Sample3_托盘图标NotificationIcon{ /// <summary> /// MainWindow.xaml 的交互...原创 2019-07-20 15:37:51 · 289 阅读 · 0 评论 -
Sample004 DataBinding_XmlDataSource
XmlDataSource<Window x:Class="XmlDataSource.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ...转载 2019-07-20 17:37:17 · 209 阅读 · 0 评论 -
WPF的Binding等使用小结
WPF数据Binding小结样式1为便于描述,假设当前窗体为Shell.xaml,其DataContent绑定的是ShellViewModel;public partial class Shell : Window{ CollectionView view = null; public Shell() { InitializeComponent();...原创 2020-03-04 23:24:07 · 418 阅读 · 0 评论 -
WPF ListBox颜色交替及以击事件实现
ListBox 中的数据行实现颜色交替 WPF内置的两大专用属性ItemsControl.AlternationCount 属性和ItemsControl.AlternationIndex 附加属性来完成交替条目的样式改变。ItemsControl.AlternationCount :ItemsControl的交替项容器数。ItemsControl.A...原创 2019-06-26 08:00:33 · 1399 阅读 · 0 评论 -
Kino.Toolkit.Wpf使用
Kino.Toolkit.Wpf使用FormItemNomalForm显示隐藏Form使用Expander分组ItemsPanelTemplateDataGridDataPager分页FormItem<UserControl x:Class="仓库进销存.Views.ProductStore" xmlns="http://schemas.microsoft.c...原创 2019-05-17 09:54:17 · 1346 阅读 · 0 评论 -
Sample5 DataBinding With XmlDataSource 行政区划联动
<Window x:Class="Sample5_DataBinding_XmlDataSource.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xa...原创 2019-07-20 19:37:28 · 304 阅读 · 0 评论 -
Sample 001 绘制具有自定义关闭按钮可拖动的控件UI
由于很多控件缺少关闭按钮,所以就需要自行绘制来解决。WPF提供了强大的绘制和动画功能,为绘制任务提供了强大支持。本文记录了具体实现过程:一、开发环境Visual Studio 2017 C#/WPF/Net4.52二、实现方式1.新建一个C# WPF 应用程序项目 Sample 12. MainWindow.xaml中,将下面代码,加入网络元素中。<!--Close button...原创 2019-07-20 13:24:43 · 309 阅读 · 0 评论 -
WPF_Binding MouseBinding/SelectedItem
TextBox<TextBox> <TextBox.InputBindings> <MouseBinding Gesture="RightClick" Command="{Binding MyCommand}" /> </TextBox.InputBindings> </TextBox>Lis...原创 2019-07-13 22:36:10 · 4050 阅读 · 2 评论 -
ObservableCollection安全集合的正确使用
我在Stack Overflow上看到的所有示例都是错误的.从其他线程修改集合时,必须锁定集合.在调度程序(UI)线程上:_itemsLock = new object();//创建ObservableCollectionItems = new ObservableCollection<Item>();//使集合在多个线程中捕获并指定应该使用同步对集合的访问的锁定对...转载 2019-06-26 07:18:45 · 2975 阅读 · 0 评论 -
WPF 鼠标双击命令
ListBox 鼠标双击事件利用MouseBinding实现MVVM模式下的鼠标双击命令利用EventSetter 实现非MVVM模式的鼠标双击事件利用MouseBinding实现MVVM模式下的鼠标双击命令<ListBox x:Name="cList" MinHeight="50" ItemsSource="{Binding CateCombinVM.CategoryCombinL...原创 2020-02-29 18:29:13 · 1492 阅读 · 0 评论 -
WPF MVVM 两个基类(NotificationObject/RelayCommand)
目录NotificationObjectRelayCommandNotificationObjectVM:private int result; public int Result { get { return result; } set { r...原创 2019-04-28 19:40:15 · 1532 阅读 · 0 评论 -
WPF Image绑定Xaml
<Window x:Class="CityMangeLogin.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d=...原创 2019-12-21 13:08:56 · 1512 阅读 · 0 评论 -
Sample 002 非矩形窗口的实现
非矩形窗口的实现一、知识要点二、实现方法1. 设置窗体样式和透明2. 使用 Path 创建非矩形窗口边缘3.为图形右上角添加一个自绘按钮一、知识要点本文主要涉及Path 应用Path:绘制一系列相互连接的直线和曲线。 public sealed class Path : Shape二、实现方法1. 设置窗体样式和透明WindowStyle=“None”AllowsTranspar...原创 2019-07-20 15:05:51 · 342 阅读 · 0 评论 -
WPF 使用System.Windows.Interactivity交互事件
使用System.Windows.Interactivity交互事件Triggers 示例1Behavior 示例2下载System.Windows.Interactivity.dll文件,并引入项目中(在VS项目的引用列表中可以看到)。可在Nuget搜索System.Windows.Interactivity下载安装到项目中。XAML中使用该dll xmlns:i="clr-namespa...转载 2019-07-28 10:21:32 · 11121 阅读 · 0 评论 -
WPF 中Combobox 的选中项单独绑定到一个string类型的正确做法
WPF中 绑定SelectedValue 必须 指定SelectedValuePath,正确做法是,将SelectedValuePath为content(文本内容),可以成功将combobox的选中项单独绑定到一个string类型的属性。原创 2021-03-07 20:59:23 · 1083 阅读 · 0 评论 -
MVVM命令绑定几种写法小结
MVVM命令绑定几种写法小结Interactivity 实现InputBindings 实现常规实现Binding的RelativeSourceInteractivity 实现通过 MVVM 模式,实现控件自身就具有的事件,如 SelectionChanged xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=Syste...原创 2019-09-13 08:23:09 · 795 阅读 · 0 评论