<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>yycoding-记录编程点滴</title><description>.NET Developer,前微软最有价值专家(2012-2016)</description><link>https://www.yycoding.xyz/</link><pubDate>Mon, 27 Apr 2026 16:24:22 GMT</pubDate><copyright> ©2011-2026 yycoding.xyz</copyright><generator>Moonglade v12.9.1</generator><language>en-US</language><item><title>在WPF中使用ttf字体图标</title><link>https://www.yycoding.xyz/post/2022/5/5/using-ttf-font-icons-in-wpf</link><description>在Winform时代图标，图标都是在资源文件下创建JPG或者PNG来作为图片实现，但是随着TTF字体图标的普及，图标类型的图片越来越多的被放入到TTF中。 比如fontawesome 、iconfont 等，本文以iconfont为例聊一聊在WPF下如何使用TTF字体作为图标。 …</description><author>xjdx2008@126.com</author><category>DotNet Framework</category><category>WPF</category><guid isPermaLink="false">3156B091-4775-4D04-A5C8-2BF76DA182DE</guid><pubDate>Wed, 04 May 2022 18:08:49 GMT</pubDate></item><item><title>解决WPF中ContextMenu绑定RoutedCommand时第一次无法执行的问题</title><link>https://www.yycoding.xyz/post/2022/4/15/solve-execution-problems-of-contextmenu-binding-routedcommands-in-wpf</link><description>WPF中RoutedCommand是一个非常常用的功能，他能够将某一命令绑定到多个控件上，比如同一个命令可以绑定到Button，Menu，ContextMenu上，这样避免了重复的代码。     但初次使用RoutedCommand时我就遇到了一个很奇怪的Bug，就是将右键弹出菜单ContextMenu的某一个菜单和窗体上的某个Button同时绑定到了某一个命令上。在程序初次运行时，ContextMenu里面的绑定了命令的菜单是灰色的，不可用，即使设置IsEnable=true，也不行。而Button却是正常的，但在点击Button执行一次命令后，ContextMenu里面的菜单就变得可用了。      在一顿搜索之后发现了这篇文章How to Solve Execution Problems of RoutedCommands in a WPF ContextMenu，完美的解决了这一问 …</description><author>xjdx2008@126.com</author><category>DotNet Framework</category><category>WPF</category><guid isPermaLink="false">4DC88327-4AF1-4659-8AD9-6F52370DE8CA</guid><pubDate>Thu, 14 Apr 2022 18:50:34 GMT</pubDate></item><item><title>WPF单例应用程序的两种实现</title><link>https://www.yycoding.xyz/post/2022/4/14/two-method-of-implement-wpf-single-instance-application</link><description>在某些场景下，我们需要应用程序只开启一个实例，本文介绍了WPF中单例应用程序的两种实现，一种是删除App.xaml，手写Main函数来进行启动调度，他的优点是性能相对较好，只需要定义一个Mutex即可，缺点是他放弃了WPF程序中App.xaml的一些默认功能，比如可以存放全局资源样式，没有App.xaml使得在某些情况下，其他的窗体除非手动引用资源或样式，否则得不到设计时支持，这两个缺点都可以通过代码或者设计时标签来回避。另外一种方法是保留App.xaml文件，注册Startup方法，在该方法里启动一个后台线程来监测多次打开的行为，当检测到试图打开多次时，将上次的应用打开，它的缺点是额外多增加了一个工作线程。相比第一种方法来说开销较大，但对于当今的CPU来说，多一个线程处理似乎可以忽略，并且这个线程里面使用的是WaitHandle，实际并不占用太多资源。 …</description><author>xjdx2008@126.com</author><category>DotNet Framework</category><category>WPF</category><guid isPermaLink="false">8AB63123-ADA8-444B-85A6-6E212F94A64E</guid><pubDate>Thu, 14 Apr 2022 00:11:38 GMT</pubDate></item><item><title>在WPF的ViewModel中更新UI界面</title><link>https://www.yycoding.xyz/post/2022/4/6/update-ui-from-viewmodel-class-at-mvvm-pattern-in-wpf</link><description>凡是做UI界面，不管是Winform也好还是WPF，都只有一个UI线程，我们不能在UI线程中执行耗时的操作，因为这样会阻塞UI线程，是的界面变得卡顿，十分影响用户体验。本文以Prism的MVVM模式为例，通过两个场景: 耗时操作通过异步回调返回值和耗时操作直接返回值两种场景，介绍了如何在ViewModel中执行耗时操作，并更新UI界面。 …</description><author>xjdx2008@126.com</author><category>DotNet Framework</category><category>WPF</category><guid isPermaLink="false">913781DC-0D7D-49E5-97A5-6B94DAA95B62</guid><pubDate>Tue, 05 Apr 2022 19:06:22 GMT</pubDate></item></channel></rss>