zoukankan      html  css  js  c++  java
  • Extensions

    public static partial class Extensions
        {
            public static T FindAncestor<T>(DependencyObject obj) where T : DependencyObject
            {
                while (obj != null)
                {
                    T o = obj as T;
                    if (o != null)
                        return o;

                    obj = VisualTreeHelper.GetParent(obj);
                }
                return null;
            }

            public static T FindAncestor<T>(this UIElement obj) where T : UIElement
            {
                return FindAncestor<T>((DependencyObject)obj);
            }

            public static void CollapseAllRow(this DataGrid dg)
            {
                foreach (var rowItem in dg.ItemsSource)
                {
                    // Ensures that all rows are loaded.
                    dg.ScrollIntoView(rowItem, dg.Columns.Last());

                    // Get the content of the cell.
                    FrameworkElement el = dg.Columns.Last().GetCellContent(rowItem);

                    // Retrieve the row which is parent of given element.
                    DataGridRow row = DataGridRow.GetRowContainingElement(el.Parent as FrameworkElement);

                    // Sometimes some rows for some reason can be null.
                    if (row != null)
                        row.DetailsVisibility = Visibility.Collapsed;

                }

            }
        }

  • 相关阅读:
    springcloud-Ribbon之手写轮询算法
    springcloud-Ribbon负载均衡规则的替换
    git本地库和远程库的连接和断开
    本地项目第一次提交到码云或github
    python基础语法练习
    Xss-labs-level11-15
    Vulnhub-靶机-ESCALATE_LINUX: 1
    Xss-labs-level7-10
    Vulnhub-靶机-DC: 6
    Jenkins入门之执行Powershell脚本
  • 原文地址:https://www.cnblogs.com/elaborateday/p/1831806.html
Copyright © 2011-2022 走看看