摘要: 如果按照正确设置了.gitignore文件,但仍然存在问题,可能是由于以下原因: 文件已经被Git跟踪:如果在设置.gitignore之前,文件已经被Git跟踪并提交过一次,那么.gitignore对这个文件将不起作用。需要先使用以下命令将文件从Git仓库中移除: git rm --cached < 阅读全文
posted @ 2023-10-08 21:53 lxiamul 阅读(373) 评论(0) 推荐(0) 编辑
摘要: C# List合并相同元素,把相同的元素的某个值累加 原数据 合并后 public class Student { public string? Name { get; set; } public string? Sex { get; set; } public int Score { get; s 阅读全文
posted @ 2022-11-30 18:55 lxiamul 阅读(388) 评论(0) 推荐(0) 编辑
摘要: Json写入(序列化) using System.IO; using System.Text; /// <summary> /// 对象转换为json字符串 /// </summary> /// <param name="obj">需要转换的对象</param> /// <returns></ret 阅读全文
posted @ 2022-11-24 16:25 lxiamul 阅读(856) 评论(0) 推荐(0) 编辑
摘要: <Window x:Class="WpfAppDemo.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/ 阅读全文
posted @ 2022-11-02 08:42 lxiamul 阅读(283) 评论(0) 推荐(0) 编辑
摘要: UI界面: <Window x:Class="Test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/ 阅读全文
posted @ 2022-06-28 18:47 lxiamul 阅读(1345) 评论(0) 推荐(0) 编辑
摘要: ControlTemplate 定义的控件一般情况外部是无法访问的 ,由 ControlTemplate 或 DataTemplate 生成的控件都是“ 由 Template 生成的控件 ”。 ControlTemplate 和 DataTemplate 两个类均派生自 FrameworkTempl 阅读全文
posted @ 2022-05-17 11:03 lxiamul 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 错误信息如图: 解决方案: 找到项目目录下的.vs文件夹删除,重新打开程序即可 阅读全文
posted @ 2022-02-28 10:59 lxiamul 阅读(441) 评论(0) 推荐(0) 编辑
摘要: String.Trim() 去掉字符串 前后 的空格 string a = " 要去除空格的字符串 "; Console.WriteLine(a.Trim()); String.Replace()函数可以去掉字符串中 所有 的空格: string a = " 要 去 除 空 格 的 字 符 串 "; 阅读全文
posted @ 2022-01-25 17:49 lxiamul 阅读(2629) 评论(0) 推荐(0) 编辑
摘要: (一)返回当前屏幕选择的分辨率(以像素为单位),当我们修改系统分辨率时,WPF控件的宽,高会跟着系统分辨率放大,或缩小,设置以下代码, 控件的宽=SystemParameters.PrimaryScreenWidth; 控件的高=SystemParameters.PrimaryScreenHeigh 阅读全文
posted @ 2021-10-03 22:46 lxiamul 阅读(535) 评论(0) 推荐(0) 编辑
摘要: 首先在XAML界面随便放一个Text Box(文本框控件), 然后在窗口添加一个MouseDown事件(鼠标按下事件) 代码如下: <Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/ 阅读全文
posted @ 2021-09-09 15:37 lxiamul 阅读(2563) 评论(0) 推荐(0) 编辑