Exemplo n.º 1
0
        /// <summary>
        /// Determines whether the specified row index is associated with DetailsViewDataGrid row.
        /// </summary>
        /// <param name="dataGrid">
        /// The SfDataGrid.
        /// </param>
        /// <param name="rowIdx">
        /// The corresponding row index to determine whether the row index in Details View DataGrid.
        /// </param>
        /// <returns>
        /// Returns <b>true</b> if the specified row index is  Details View index; otherwise, <b>false</b>.
        /// </returns>
        public static bool IsInDetailsViewIndex(this SfDataGrid dataGrid, int rowIdx)
        {
            if (!dataGrid.DetailsViewManager.HasDetailsView || rowIdx < 0)
            {
                return(false);
            }

            if (dataGrid.IsAddNewIndex(rowIdx) || dataGrid.IsFilterRowIndex(rowIdx) || dataGrid.IsUnBoundRow(rowIdx) || dataGrid.IsTableSummaryIndex(rowIdx))
            {
                return(false);
            }

            var startIdx = dataGrid.ResolveStartIndexBasedOnPosition();
            var counter0 = Math.Max((rowIdx - startIdx), 0);

            if (dataGrid.GridModel.HasGroup)
            {
                var displayEl = dataGrid.View.TopLevelGroup.DisplayElements[counter0];
                return(displayEl is NestedRecordEntry);
            }

            return((counter0 % (dataGrid.DetailsViewDefinition.Count + 1)) != 0);
        }