摘要:
blend为我们提供方便的behavior来扩展我们的控件,写好之后就可以在blend中方便的使用了。下面是自定义的behavior来实现Listbox自动滚动到选中项其中this.AssociatedObject为使用该行为的控件。其中OnAttached()和OnDetaching()为必须重写的内容,通常可以在OnAttched()里面添加事件处理程序,来达到拓展的目的。public class AutoScrollBehavior : Behavior<ListBox> { protected override void OnAttached() { ba... 阅读全文
摘要:
转自: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... 阅读全文