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