Пример #1
0
        protected virtual bool IsLastChildRow(IHierarchicalRow parent, GridViewRowInfo row)
        {
            ITraverser <GridViewRowInfo> traverser = this.GetTraverser(parent);

            traverser.MoveToEnd();
            return(traverser.Current == row);
        }
Пример #2
0
        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (keyData == Keys.Tab)
            {
                var view        = this.ListViewElement.ViewElement as DetailListViewElement;
                var element     = this.ListViewElement;
                int columnIndex = element.Columns.IndexOf(element.CurrentColumn);

                ITraverser <ListViewDetailColumn> colEnumerator = (ITraverser <ListViewDetailColumn>)view.ColumnScroller.Traverser.GetEnumerator();
                colEnumerator.Position = columnIndex;

                if (colEnumerator.MoveNext())
                {
                    var isEditing = element.IsEditing;

                    element.CurrentColumn = colEnumerator.Current;
                    if (isEditing)
                    {
                        element.BeginEdit();
                    }
                    return(true);
                }
                else
                {
                    ListViewTraverser enumerator = view.Scroller.Traverser.GetEnumerator() as ListViewTraverser;
                    enumerator.Position = element.CurrentItem;

                    if (enumerator.MoveNext())
                    {
                        var isEditing = element.IsEditing;


                        colEnumerator.Reset();
                        colEnumerator.MoveNext();
                        element.CurrentColumn = colEnumerator.Current;
                        element.CurrentItem   = enumerator.Current;
                        element.SelectedItem  = enumerator.Current;

                        if (isEditing)
                        {
                            element.BeginEdit();
                        }

                        return(true);
                    }
                }
            }
            if (keyData == (Keys.Tab | Keys.Shift))
            {
                var view        = this.ListViewElement.ViewElement as DetailListViewElement;
                var element     = this.ListViewElement;
                int columnIndex = element.Columns.IndexOf(element.CurrentColumn);

                ITraverser <ListViewDetailColumn> colEnumerator = (ITraverser <ListViewDetailColumn>)view.ColumnScroller.Traverser.GetEnumerator();
                colEnumerator.Position = columnIndex;

                if (colEnumerator.MovePrevious())
                {
                    var isEditing = element.IsEditing;

                    element.CurrentColumn = colEnumerator.Current;

                    if (isEditing)
                    {
                        element.BeginEdit();
                    }
                    return(true);
                }
                else
                {
                    ListViewTraverser enumerator = view.Scroller.Traverser.GetEnumerator() as ListViewTraverser;
                    enumerator.Position = element.CurrentItem;

                    if (enumerator.MovePrevious())
                    {
                        var isEditing = element.IsEditing;

                        colEnumerator.MoveToEnd();
                        element.CurrentColumn = colEnumerator.Current;
                        element.CurrentItem   = enumerator.Current;
                        element.SelectedItem  = enumerator.Current;

                        if (isEditing)
                        {
                            element.BeginEdit();
                        }

                        return(true);
                    }
                }
            }
            return(base.ProcessDialogKey(keyData));
        }