Exemple #1
0
        internal void BringUpdatedItemIntoView(TreeNode node, string propertyName)
        {
            var column = this.treeGrid.Columns.FirstOrDefault(c => c.MappingName == propertyName);

            if (column != null)
            {
                var scrollColumnIndex = treeGrid.ResolveToScrollColumnIndex(treeGrid.Columns.IndexOf(column));
                var rowIndex          = treeGrid.ResolveToRowIndex(node.Item);
                treeGrid.ScrollInView(new RowColumnIndex(rowIndex, scrollColumnIndex));
            }
        }
Exemple #2
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);
        }