William Basics

Keep learning, never ending.

[WPF] How to avoid calling initial methods in the view model’s constructor

Introduction When developing a WFP application in the MVVM way, we often need to initialize such as loading data, logging, and other kinds of stuff when the view model is created. The no-brain way is to call the “initialization” method directly in the view model’s constructor while hoping the calling method never fails and finishes instantly. public class AwsomeViewModel { public AwsomeViewModel () { LoadDataFromDatabase(); } } However, To call a method that is likely to fail or costs a long time is a bad practice in any way.

[Math] - FFT By Using Math.NET Numberics

引言 快速傅里叶变换是信号处理的常用工具。当我们想要对时间域里的连续信号进行成分分析时,我们就需要通过傅里叶变换来将时间域的连续信号转化为频率

[WPF] - Data Binding

Introduction 在应用了MVVM设计模式的情况下,Data Binding特别常见。因为我们需要通过它来将前后端分离,让UI的归UI,业务归业务。 所谓Dat

WPF - Realtime charting by using DevExpress WPF toolkit

Realtime charting by using DevExpress WPF toolkit Realtime chart的用途十分广泛,特别是在测量领域尤为常见。 这个代码样例实现了一个realtime chart的原型,借助了DevEx

WPF - Localization on-the-fly

WPF的本地化或者说对多国语言的支持,微软官方给出的方案是借助Uid加上WPF Samples中的小工具locBaml来实现。这种方案的一个缺

WPF - Locbaml : Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly

这个error信息十分隐晦,解决方案是将LocBaml.exe拷贝到project的build目录下(xxxproject\bin\Debu

WPF - Creating Control Template Assembly

WPF - Creating Control Template Assembly 1. 新建一个WPF User Control Library project 删除 User Control1.xaml 2. Add New Item - Resource Dictionary MyButtonTemplate.xaml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> </ResourceDictionary> 在MyButtonTemplate.xaml中加入template定义。