摘要: Command模式是设计模式中一个很重要也是十分好用的一个模式。具体见Wiki : http://en.wikipedia.org/wiki/Command_pattern SilverLight中定义了一个ICommand接口,该接口即为Command pattern的一个实现,接口定义如下: 可以由上图看出CanExecute方法中用来定义命令是否可被执行的逻辑。 这... 阅读全文
posted @ 2012-07-25 13:13 孤狼晖 阅读(7130) 评论(2) 推荐(2) 编辑
摘要: 当我们进行开发的时候,不论是独立开发还是处在团队中,合理的对源代码管理是十分重要的。 下面我就介绍一下如何在本地创建SVN服务器。 我们需要首先安装 TortoiseSVN 之后教程开始: 首先我们需要在本地创建一个文件夹,作为SVN服务的文件夹 之后我们右键选择菜单下Create Repository here如下图: 屏幕剪辑的捕获时间: 2012/7/22 9:25 小乌龟这时会提示你创建成功! 接下来我们在另一个目录下进行Check Out 屏幕剪辑的捕获时间: 2012/7/22 9:27 在地址中选择之前创建成功时的位置 这样CheckOut就成功了! 之后我们... 阅读全文
posted @ 2012-07-22 09:39 孤狼晖 阅读(13158) 评论(6) 推荐(3) 编辑
摘要: 当使用Vs2010或blend设计器时常常会出现异常而无法进行UI的编辑 如下图所示,这样会对设计带来不便: 这时我们可以利用Vs2010的Debug功能对此进行追踪,首先用blend打开要调试的工程,然后在VS2010里面选择Debug-->Attach to Process 里面选中Blend.exe 确定后VS2010进入跟踪模式 屏幕剪辑的捕获时间: 2012/7/21 15:41 再回到blend里面打开需要跟踪错误的页面,此时Vs2010就会捕获到这个异常,我们可以根据这个异常来解决UI设计器的问题。十分方便。 阅读全文
posted @ 2012-07-21 16:01 孤狼晖 阅读(2160) 评论(0) 推荐(0) 编辑
摘要: 摘自MSDN官方文档MSDNListBoxUsage of the ItemsControl and ListBox are perhaps the most common places applications can experience performance problems. To use these controls correctly, you need to consider how many items you are going to display in your ListBox control. You next need to consider how complex 阅读全文
posted @ 2012-02-08 10:12 孤狼晖 阅读(302) 评论(0) 推荐(1) 编辑
摘要: 当我们使用Listbox binding的时候 可能遇到binding的结合是一个数据集合,这样当我们想获得相应ListboxItem的时候问题就出现了。 这个时候可以按如下方法找到: ListBoxItem lbi = listbox.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem; 其中item为bindi... 阅读全文
posted @ 2011-09-27 13:34 孤狼晖 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 转自WPFtutorial,很好的WPF专题网站WPF Performance TipsWindows Presentation Foundation provides a very confortable way to develop rich user experiences. A drop shadow for example can added by inserting two simple lines of XML. But this simplicity can also mislead us to overuse them. This leads to performance i 阅读全文
posted @ 2011-09-02 18:42 孤狼晖 阅读(1883) 评论(2) 推荐(3) 编辑
摘要: blend为我们提供方便的behavior来扩展我们的控件,写好之后就可以在blend中方便的使用了。下面是自定义的behavior来实现Listbox自动滚动到选中项其中this.AssociatedObject为使用该行为的控件。其中OnAttached()和OnDetaching()为必须重写的内容,通常可以在OnAttched()里面添加事件处理程序,来达到拓展的目的。public class AutoScrollBehavior : Behavior<ListBox> { protected override void OnAttached() { ba... 阅读全文
posted @ 2011-08-25 16:20 孤狼晖 阅读(752) 评论(0) 推荐(0) 编辑
摘要: 转自:http://geekswithblogs.net/thibbard/archive/2008/02/13/wpf---get-listboxitem-from-listbox.selecteditem.aspx I had some trouble today getting the actual control that hosts data in a WPF listbox. The... 阅读全文
posted @ 2011-08-25 09:53 孤狼晖 阅读(1307) 评论(0) 推荐(0) 编辑
摘要: 当我们需要操作ListBox中的ScrollerBar的时候我们可以通过VisualTreeHelper来找到。代码如下:public static childItem FindVisualChild<childItem>(DependencyObject obj) where childItem : DependencyObject{ // Search immediate childr... 阅读全文
posted @ 2011-08-24 14:28 孤狼晖 阅读(278) 评论(0) 推荐(0) 编辑
摘要: Reduce unnecessary invocations of the layout pass -- update a Transform rather than replacing itUse the most efficient Panel where possible -- don't use Grid if you need is CanvasUse Drawing which are cheaper than Shape objectsUse StreamGeometry, which is a light-weight alternative to PathGeomet 阅读全文
posted @ 2011-08-12 11:31 孤狼晖 阅读(648) 评论(0) 推荐(0) 编辑