2022年10月19日

WPF 创建左侧滑入动画

摘要: var sb = new Storyboard(); // 动画板 var slideAnimation = new ThicknessAnimation() // 由于控制的是Margin,属于Thickness类型,所以创建ThicknessAnimation动画 { Duration = ne 阅读全文

posted @ 2022-10-19 09:59 xzj19870125 阅读(136) 评论(0) 推荐(0) 编辑

2022年10月18日

C# await async异步编程简单理解

摘要: async 异步方法 await 执行异步调用的位置 await Method1(); // 同步执行,先完成Method1,在执行Method2 //Method1(); // 异步执行,Method1、Method2同时执行 Method2(); Console.ReadKey(); stati 阅读全文

posted @ 2022-10-18 17:07 xzj19870125 阅读(25) 评论(0) 推荐(0) 编辑

2022年9月30日

WPF中Trigger、DataTrigger、EventTrigger区别

摘要: Trigger 属性触发器 它监视所有者控件上的特定属性,当该属性具有与指定值匹配的值时,属性可以更改。 <Trigger Property="IsMouseOver" Value="True"> DataTrigger 数据触发器 用于不一定是依赖项属性的属性。它们通过创建与常规属性的绑定来工作, 阅读全文

posted @ 2022-09-30 14:45 xzj19870125 阅读(321) 评论(0) 推荐(0) 编辑

2022年9月13日

WPF中无法绑定PasswordBox的Password问题

摘要: 由于PasswordBox的Password不是依赖属性,所以无法对其进行绑定。 这是需要通过添加附加属性,在附加属性中通过PasswordBox中可以用的依赖属性关联,实现Password绑定。 依赖属性: MonitorPassword:关联PasswordBox中的PasswordChange 阅读全文

posted @ 2022-09-13 11:48 xzj19870125 阅读(312) 评论(0) 推荐(1) 编辑

2022年9月6日

WPF 实现文本框textbox文字提示

摘要: 在Template中添加一个textblock用于提示文本的显示,Visibility="Collapsed" 同时添加一个触发器,当textbox的text没有内容时,textblock的Visibility="Visible",显示出来 <Style x:Key="TextBoxPlaceHol 阅读全文

posted @ 2022-09-06 15:22 xzj19870125 阅读(1790) 评论(0) 推荐(0) 编辑

WPF style和template区别 样式和模板

摘要: 如果只需对控件进行小幅度修饰(调整大小、位置、字体、颜色等)就用style; 如果需要改变控件的外观和行为就用controlTemplate(形状、事件触发如鼠标停留效果等)。 在实际项目中,经常把Template定义在Style中,通过Style 中的Property来设置控件的Template属 阅读全文

posted @ 2022-09-06 13:29 xzj19870125 阅读(195) 评论(0) 推荐(0) 编辑

2022年8月7日

STM32CUBEIDE 报“No such file or directory”错误

摘要: 在项目中新建一个文件夹,并在文件夹中新建了.h文件。编译出现了如下错误。 原因是,没有将新建文件夹包含到编译路径中。 项目右键 --properties C/C++ General Paths and Symbols Includes Add WorkSpaces 选择自己在项目中新建的文件夹 保存 阅读全文

posted @ 2022-08-07 09:30 xzj19870125 阅读(2792) 评论(0) 推荐(1) 编辑

2022年8月1日

WPF 定义了TextBlock样式后,其他控件的样式都改变了

摘要: 如果在app.xmal中定义了TextBlock样式,如: <Application x:Class="ButtonStyle.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:/ 阅读全文

posted @ 2022-08-01 09:54 xzj19870125 阅读(344) 评论(0) 推荐(0) 编辑

2022年7月6日

C# ??代表

摘要: 空兼并运算符(??) 用于定义可空类型和引证类型的默认值。 假如此运算符的左操作数不为null,则此运算符将回来左操作数,否则回来右操作数。 例如: return c ?? = new T(); 就是 if(c == null) c = new T(); return c; 阅读全文

posted @ 2022-07-06 09:56 xzj19870125 阅读(86) 评论(0) 推荐(0) 编辑

2021年8月6日

dataGridView1.DataSource = list; datagridview绑定list无法显示。

摘要: list为结构体泛型时,必须将结构体内的字段转变为属性才能绑定到datagridview.datasource上。 public struct UserInfo { public string ID { get; set; } public string Name { get; set; } pub 阅读全文

posted @ 2021-08-06 10:03 xzj19870125 阅读(424) 评论(0) 推荐(0) 编辑

导航