相关文章  
  • 浅谈如何利用BartPE创建PE工具盘
  • Windows Mobile 2003 Second Edition 中 ActiveSync 编程模型的增强功能
  • 你真的了解windows的自启动方式吗?
  • C# 中数组和类型转换的功能实现
  • C#中调用带回调函数和自定义结构体的DLL例程
  • 演练:在Excel中建立自定义菜单项
  • 定时检测邮件并且自动转发的例子
  • Internet Explorer 中编辑 OLE 嵌入文档
  • 教你通过 Emit 实现动态生成一个类
  • 如何才能在10046event自由漫步
  •   推荐  
      科普之友首页   专利     科普      动物      植物        天文   考古   前沿科技
     您现在的位置在:  首页 >>文献 >>培训

    在完成所有绑定后仍然有许多要进行的操作3

    ons.Add(new Person("Tom", 8));
      this.DataContext = this.persons;
      
      showButton.Click += showButton_Click;
      birthdayButton.Click += birthdayButton_Click;
      addPersonButton.Click += addPersonButton_Click;
       }
      
       void showButton_Click(object sender, ClickEventArgs e) {
      ListCollectionView view =
       (ListCollectionView)Binding.GetView(persons);
      Person person = (Person)view.CurrentItem.Current;
      
      MessageBox.Show(
       string.Format("Name is '{0}' and you are {1} years old",
        person.Name,
        person.Age));
       }
       ...
      }
      
      这个 Show 按钮单击处理程序代码调用 Binding 对象上的静态 GetView 方法,该对象会返回与 person 数据相关联的默认视图。回忆 persons 字段是 ArrayListDataCollection 的实例(您将会想到我的上一篇文章),它是 ArrayList 类的子类,该类添加 ICollectionChange 接口的实现,以便绑定到集合的控件(如 Perso

    页码:[1] [2] [3] [4] [5] [6] [7] [8]3页、共8页

         

          设为首页       |       加入收藏       |       广告服务       |       友情链接       |       版权申明      

    Copyriht 2007 - 2008 ©  科普之友 All right reserved