当前位置: 首页 > news >正文

有关大学生做兼职的网站百度承德

有关大学生做兼职的网站,百度承德,网站改版是否有影响,天眼查 企业查询WPF中TreeView.BringIntoView方法的替代方案 周银辉 WPF中TreeView.BringIntoView#xff08;#xff09;方法并不是那么地好用#xff0c;不少时候会没有效果#xff0c;这里有一个替代方案#xff0c;调用SelectItem#xff08;#xff09;方法可以展开并呈现TreeView…                             WPF中TreeView.BringIntoView方法的替代方案                                        周银辉 WPF中TreeView.BringIntoView方法并不是那么地好用不少时候会没有效果这里有一个替代方案调用SelectItem方法可以展开并呈现TreeView上指定的Item   public static class TreeViewHelper     {         /// summary         /// Expands all children of a TreeView         /// /summary         /// param nametreeViewThe TreeView whose children will be expanded/param         public static void ExpandAll(this TreeView treeView)         {             ExpandSubContainers(treeView);         }           /// summary         /// Expands all children of a TreeView or TreeViewItem         /// /summary         /// param nameparentContainerThe TreeView or TreeViewItem containing the children to expand/param         private static void ExpandSubContainers(ItemsControl parentContainer)         {             foreach (Object item in parentContainer.Items)             {                 TreeViewItem currentContainer parentContainer.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;                 if (currentContainer ! null currentContainer.Items.Count 0)                 {                     //expand the item                     currentContainer.IsExpanded true;                       //if the items children are not generated, they must be expanded                     if (currentContainer.ItemContainerGenerator.Status ! GeneratorStatus.ContainersGenerated)                     {                         //store the event handler in a variable so we can remove it (in the handler itself)                         EventHandler eh null;                         eh new EventHandler(delegate                             {                                 //once the children have been generated, expand those childrens children then remove the event handler                                 if (currentContainer.ItemContainerGenerator.Status GeneratorStatus.ContainersGenerated)                                 {                                     ExpandSubContainers(currentContainer);                                     currentContainer.ItemContainerGenerator.StatusChanged - eh;                                 }                             });                           currentContainer.ItemContainerGenerator.StatusChanged eh;                     }                     else //otherwise the children have already been generated, so we can now expand those children                     {                         ExpandSubContainers(currentContainer);                     }                 }             }         }           /// summary         /// Searches a TreeView for the provided object and selects it if found         /// /summary         /// param nametreeViewThe TreeView containing the item/param         /// param nameitemThe item to search and select/param         public static void SelectItem(this TreeView treeView, object item)         {             ExpandAndSelectItem(treeView, item);         }           /// summary         /// Finds the provided object in an ItemsControls children and selects it         /// /summary         /// param nameparentContainerThe parent container whose children will be searched for the selected item/param         /// param nameitemToSelectThe item to select/param         /// returnsTrue if the item is found and selected, false otherwise/returns         private static bool ExpandAndSelectItem(ItemsControl parentContainer, object itemToSelect)         {             //check all items at the current level             foreach (Object item in parentContainer.Items)             {                 TreeViewItem currentContainer parentContainer.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;                   //if the data item matches the item we want to select, set the corresponding                 //TreeViewItem IsSelected to true                 if (item itemToSelect currentContainer ! null)                 {                     currentContainer.IsSelected true;                     currentContainer.BringIntoView();                     currentContainer.Focus();                       //the item was found                     return true;                 }             }               //if we get to this point, the selected item was not found at the current level, so we must check the children             foreach (Object item in parentContainer.Items)             {                 TreeViewItem currentContainer parentContainer.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;                   //if children exist                 if (currentContainer ! null currentContainer.Items.Count 0)                 {                     //keep track of if the TreeViewItem was expanded or not                     bool wasExpanded currentContainer.IsExpanded;                       //expand the current TreeViewItem so we can check its child TreeViewItems                     currentContainer.IsExpanded true;                       //if the TreeViewItem child containers have not been generated, we must listen to                     //the StatusChanged event until they are                     if (currentContainer.ItemContainerGenerator.Status ! GeneratorStatus.ContainersGenerated)                     {                         //store the event handler in a variable so we can remove it (in the handler itself)                         EventHandler eh null;                         eh new EventHandler(delegate                         {                             if (currentContainer.ItemContainerGenerator.Status GeneratorStatus.ContainersGenerated)                             {                                 if (ExpandAndSelectItem(currentContainer, itemToSelect) false)                                 {                                     //The assumption is that code executing in this EventHandler is the result of the parent not                                     //being expanded since the containers were not generated.                                     //since the itemToSelect was not found in the children, collapse the parent since it was previously collapsed                                     currentContainer.IsExpanded false;                                 }                                   //remove the StatusChanged event handler since we just handled it (we only needed it once)                                 currentContainer.ItemContainerGenerator.StatusChanged - eh;                             }                         });                         currentContainer.ItemContainerGenerator.StatusChanged eh;                     }                     else //otherwise the containers have been generated, so look for item to select in the children                     {                         if (ExpandAndSelectItem(currentContainer, itemToSelect) false)                         {                             //restore the current TreeViewItems expanded state                             currentContainer.IsExpanded wasExpanded;                         }                         else //otherwise the node was found and selected, so return true                         {                             return true;                         }                     }                 }             }               //no item was found             return false;         }     }  转载于:https://www.cnblogs.com/zhouyinhui/archive/2008/12/22/1360033.html
http://www.pierceye.com/news/870423/

相关文章:

  • 做视频导航网站有哪些天津西青区离哪个火车站近
  • 福州网站建设技术支持公司培训课程有哪些
  • 保定网站制作域名注册商查询
  • 医院网站建设公司价格低天津建设工程信息网 塘沽一中
  • 建设机械网站案例建国外网站需要多少钱
  • 比特币简易网站开发电商网站大全
  • 秀屿区建设局网站巨量广告投放平台
  • 合肥网站设计哪家公司好北京国贸网站建设公司
  • 帮人做网站怎么收费制作链接的app的软件有哪些
  • 商贸行业网站建设公司yoast wordpress seo
  • 上小学网站建设WordPress底部添加运行时间
  • 学校网站信息化建设工作心得网络营销现状分析
  • 藁城专业网站建设班级同学录网站建设
  • 北京手机网站开发公司wordpress用户列表
  • 上海 企业网站制成都营销型网站建设熊掌号
  • 无锡网站优化哪家好北京注册公司地址可以是住宅吗
  • 中国十大热门网站深圳哪做网站
  • 木渎网站建设聚美优品网站建设情况
  • 企业形象网站用什么语言开发网站优化要做哪些工作
  • 中国建设银行官网站电话号码wordpress关键词排名
  • 南通网站建设机构博物馆网站建设的根本意义
  • 食品企业网站建设中信建设有限责任公司陈晓佳
  • 中国网站服务器哪个好店名注册查询
  • 网站设计制作案例软件定制开发的发展前景
  • 中国联通网站备案小程序是什么原理
  • 企业网站建设御彩云dz做电影网站
  • 做网站需要的东西网站改版是什么
  • 网站需要哪些北京正规网站建设比较
  • 建设公共网站的手续成都公司网站制作
  • 怎么用安卓机顶盒做网站服务器怎样建立微信公众号平台