private static GridViewColumnHeader findColumnHeader(GridViewHeaderRowPresenter headerPresenter, ColumnInfo col) { Func <TextBlock, bool> filter = tb => { var value = tb.GetValue(TextBlock.TextProperty); var match = col.Header != null && col.Header.Equals(value); return(match); }; GridViewColumnHeader foundHeader = null; TextBlock lookup = UITools.FindVisualChild <TextBlock>(headerPresenter, filter); if (lookup != null) { foundHeader = lookup.FindAncestor <GridViewColumnHeader>(); } return(foundHeader); }