/// <summary> /// Gets the index of the first column corresponding to the specified flow direction. /// </summary> /// <param name="treeGrid"> /// The corresponding treeGrid to get the index of first column. /// </param> /// <param name="flowdirection"> /// Corresponding direction to get the index of first column. /// </param> /// <returns> /// Returns the index of first column. /// </returns> public static int GetFirstColumnIndex(this SfTreeGrid treeGrid, FlowDirection flowdirection = FlowDirection.LeftToRight) { if (flowdirection == FlowDirection.RightToLeft) { return(treeGrid.GetLastColumnIndex()); } int firstColumnIndex = treeGrid.Columns.IndexOf(treeGrid.Columns.FirstOrDefault(col => col.ActualWidth != 0d && !double.IsNaN(col.ActualWidth))); //CurrentCell is updated when clicking on RowHeader when there is no columns in view, hence the below condition is added. if (firstColumnIndex < 0) { return(firstColumnIndex); } firstColumnIndex = treeGrid.ResolveToScrollColumnIndex(firstColumnIndex); return(firstColumnIndex); }
/// <summary> /// Get the index value for the next focused TreeGridColumn. /// </summary> /// <param name="TreeGrid"></param> /// <param name="columnIndex"></param> /// <returns></returns> internal static int GetNextFocusTreeGridColumnIndex(this SfTreeGrid TreeGrid, int columnIndex, FlowDirection flowdirection = FlowDirection.LeftToRight) { if (flowdirection == FlowDirection.RightToLeft) { return(GetPreviousFocusTreeGridColumnIndex(TreeGrid, columnIndex)); } var index = columnIndex; if (index < 0 || index >= TreeGrid.Columns.Count) { return(-1); } var gridColumn = TreeGrid.Columns[index]; if (gridColumn == null || !gridColumn.AllowFocus || gridColumn.ActualWidth == 0.0 || double.IsNaN(gridColumn.ActualWidth)) { if (columnIndex < TreeGrid.GetLastColumnIndex()) { index = GetNextFocusTreeGridColumnIndex(TreeGrid, columnIndex + 1); } } return(index); }