示例#1
0
        /// <summary>
        /// Gets the index of the last column corresponding to the specified flow direction.
        /// </summary>
        /// <param name="treeGrid">
        /// The corresponding treeGrid to get the index of last column.
        /// </param>
        /// <param name="flowdirection">
        /// Corresponding direction to get the index of last column.
        /// </param>
        /// <returns>
        /// Returns the index of last column.
        /// </returns>
        public static int GetLastColumnIndex(this SfTreeGrid treeGrid, FlowDirection flowdirection = FlowDirection.LeftToRight)
        {
            if (flowdirection == FlowDirection.RightToLeft)
            {
                return(treeGrid.GetFirstColumnIndex());
            }

            int lastIndex = treeGrid.Columns.IndexOf(treeGrid.Columns.LastOrDefault(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 (lastIndex < 0)
            {
                return(lastIndex);
            }
            lastIndex = treeGrid.ResolveToScrollColumnIndex(lastIndex);
            return(lastIndex);
        }