eagleboost Blog

梦想做大侠

EnabledStateBinding

WPF Best Practices

1. 问题 UI编程中的一个常见场景是根据上下文把某些控件设置为不可用状态,比如这个并不恰当的例子。 在M-V-VM的语境下最简单的实现方法是在ViewModel中添加一个与所绑定的值属性对应的属性,比如TextBox的Text属性绑定到ViewModel的Name属性,那么TextBox的IsEnabled属性就绑定到ViewModel的IsNameEnabled属性,如下所示: ...

DispatcherTaskWaiter

ConfigureAwait(Dispatcher)

1. The problem The concept of the [DispatcherWaiter] presented in my previous post Convert BeginInvoke to async/await solves the problem of switching back to GUI thread after await some...

M-V-VM下实现数据项的选择(三)

WPF Best Practices

1. RadioSelectionContainer应用 互斥单选是该系列第一篇提到的痛点之一,通常基于RadioButton的做法代码略显累赘。使用上一篇提到的RadioSelectionContainer则可以非常优雅地实现。 假设有如下例子,ListBox根据ItemsSource生成多个互斥的RadioButton,上方的TextBlock显示当前选中的项。 对应的XAML...

从BeginInvoke到async/await

Convert BeginInvoke to async/await

The problem Dispatcher.BeginInvoke is one of the useful functions that is widely used in WPF applications. It’s often used in two scenarios: Cross thread scheduling - When some calc...

M-V-VM下实现数据项的选择(二)

WPF Best Practices

1. ISelectionContainer接口 先解释一下上一篇结尾定义的ISelectionContainer接口。 该接口提供了支持数据项选择的所有功能。SelectedItems很简单,用于返回当前选中的所有数据项。Clear/Select/Unselect几个方法用于改变选中列表,比如当界面控件的SelectionChanged事件发生时可以调用这几个方法把数据传递到ViewM...

M-V-VM下实现数据项的选择(一)

WPF Best Practices

问题 用户界面由数据驱动是M-V-VM编程模式最佳实践的指标之一,其中数据项的选择同步尤为重要。数据项选择指的是ViewModel中的数据项通过数据绑定显示在界面上供用户选择,常见的场景包括互斥单选,单选及多选,选中的数据项在ViewModel和View之间应实现双向传递。 在M-V-VM的范畴内实现数据项的选择的方法很多。单选最简单,实现方法没有争议。但要正确地实现互斥单选和多选却不容...

实现TabControl标签页缓存

TabControl Content Preservation

The problem Usually WPF developers use the TabControl in two ways: Hard code TabItems in the XAML with a specific UI controls as the content. Each TabItem can have its own different c...

博客搬家到Github

——也许不会再搬,但谁知道呢?

前后开过几次博客,希望这次能维护得久一点。 博客搬家到Github Github让程序员免费存代码不说,还帮程序员免费托管个人网站——反正网站也是代码——并且从托管空间到域名解析全部提供。微软收购Github后我便想也许可以在这里比较稳定地给博客安家了。 自己购买托管空间并从头到尾搭建博客的人我想并不在多数,对于写博客来说静态网页足够,甚至连WordPress那种半静态网站都用...

早年在CSDN写的博客备份

——谨以怀念写Delphi,MFC及浏览器编程的青春岁月

CathyEagle 2004年初,彼时研究生尚未毕业,精力充沛,时间也有闲暇,就在csdn用CathyEagle的用户名开了个博客,写一些Delphi和MFC编程的心得。 从2004年4月到2006年底,前后一共写了57篇,除去非技术的11篇外,技术博客共计46篇,分为四类,有交叉,分别是: 分类 文章数 说明 新地址...

Prism Splash Screen Module

本文转载自我2011年在wordpress.com发布的博客 Splash screen is a good thing. It makes your application looks professional while numbers of libraries are being loaded in the background, mean while, users may ...