/// <summary>
 /// Fired before a row lost the focus
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnFocusRowLeaving(RowCancelEventArgs e)
 {
     if (FocusRowLeaving != null)
     {
         FocusRowLeaving(this, e);
     }
 }
 private void GridViewDataControl_OnRowIsExpandedChanging(object sender, RowCancelEventArgs e)
 {
     var row = e.Row as GridViewRow;
     if (row != null && !row.IsExpandable && !row.IsExpanded)
     {
         e.Cancel = true;
     }
 }
Example #3
0
        private void Selection_FocusRowLeaving(object sender, RowCancelEventArgs e)
        {
            try
            {
                //EndEditingRow(false);
            }
            catch (Exception exc)
            {
                OnUserException(new ExceptionEventArgs(new EndEditingException(exc)));

                e.Cancel = true;
            }
        }
Example #4
0
 /// <summary>
 /// Fired before a row lost the focus
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnFocusRowLeaving(RowCancelEventArgs e)
 {
     if (FocusRowLeaving != null)
         FocusRowLeaving(this, e);
 }
Example #5
0
        /// <summary>
        /// Fired when a cell lost the focus
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnCellLostFocus(ChangeActivePositionEventArgs e)
        {
            if (e.Cancel)
                return;

            //This code is not necessary because when the cell receive a focus I check
            // if the grid can receive the focus using the SetFocusOnCells method.
            // The SetFocusOnCells method cause any editor to automatically close itself.
            // If I leave this code there are problem when the cell lost the focus because the entire grid lost the focus,
            // in this case the EndEdit cause the grid to receive again the focus. (this problem is expecially visible when using the grid inside a tab and you click on the second tab after set an invalid cell value inside the first tab)
            //CellContext cellLostContext = new CellContext(Grid, e.OldFocusPosition);
            ////Stop the Edit operation
            //if (cellLostContext.EndEdit(false) == false)
            //    e.Cancel = true;
            //if (e.Cancel)
            //    return;

            //evento Lost Focus
            if (CellLostFocus != null)
                CellLostFocus(this, e);
            if (e.Cancel)
                return;

            //Row/Column leaving
            //If the new Row is different from the current focus row calls a Row Leaving event
            int focusRow = ActivePosition.Row;
            if (ActivePosition.IsEmpty() == false && focusRow != e.NewFocusPosition.Row)
            {
                RowCancelEventArgs rowArgs = new RowCancelEventArgs(focusRow);
                OnFocusRowLeaving(rowArgs);
                if (rowArgs.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }
            //If the new Row is different from the current focus row calls a Row Leaving event
            int focusColumn = ActivePosition.Column;
            if (ActivePosition.IsEmpty() == false && focusColumn != e.NewFocusPosition.Column)
            {
                ColumnCancelEventArgs columnArgs = new ColumnCancelEventArgs(focusColumn);
                OnFocusColumnLeaving(columnArgs);
                if (columnArgs.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            //Change the focus cell to Empty
            m_ActivePosition = Position.Empty; //from now the cell doesn't have the focus

            //Cell Focus Left
            Grid.Controller.OnFocusLeft(new CellContext(Grid, e.OldFocusPosition), EventArgs.Empty);
        }
        /// <summary>
        /// Fired when a cell lost the focus
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnCellLostFocus(ChangeActivePositionEventArgs e)
        {
            if (e.Cancel)
            {
                return;
            }

            //This code is not necessary because when the cell receive a focus I check
            // if the grid can receive the focus using the SetFocusOnCells method.
            // The SetFocusOnCells method cause any editor to automatically close itself.
            // If I leave this code there are problem when the cell lost the focus because the entire grid lost the focus,
            // in this case the EndEdit cause the grid to receive again the focus. (this problem is expecially visible when using the grid inside a tab and you click on the second tab after set an invalid cell value inside the first tab)
            //CellContext cellLostContext = new CellContext(Grid, e.OldFocusPosition);
            ////Stop the Edit operation
            //if (cellLostContext.EndEdit(false) == false)
            //    e.Cancel = true;
            //if (e.Cancel)
            //    return;

            //evento Lost Focus
            if (CellLostFocus != null)
            {
                CellLostFocus(this, e);
            }
            if (e.Cancel)
            {
                return;
            }

            //Row/Column leaving
            //If the new Row is different from the current focus row calls a Row Leaving event
            int focusRow = ActivePosition.Row;

            if (ActivePosition.IsEmpty() == false && focusRow != e.NewFocusPosition.Row)
            {
                RowCancelEventArgs rowArgs = new RowCancelEventArgs(focusRow);
                OnFocusRowLeaving(rowArgs);
                if (rowArgs.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }
            //If the new Row is different from the current focus row calls a Row Leaving event
            int focusColumn = ActivePosition.Column;

            if (ActivePosition.IsEmpty() == false && focusColumn != e.NewFocusPosition.Column)
            {
                ColumnCancelEventArgs columnArgs = new ColumnCancelEventArgs(focusColumn);
                OnFocusColumnLeaving(columnArgs);
                if (columnArgs.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            //Change the focus cell to Empty
            m_ActivePosition = Position.Empty; //from now the cell doesn't have the focus

            //Cell Focus Left
            Grid.Controller.OnFocusLeft(new CellContext(Grid, e.OldFocusPosition), EventArgs.Empty);
        }
 private void GridViewDataControl_OnRowIsExpandedChanging(object sender, RowCancelEventArgs e)
 {
     //throw new System.NotImplementedException();
 }
Example #8
0
		private void Selection_FocusRowLeaving(object sender, RowCancelEventArgs e)
		{
			try
			{
				//EndEditingRow(false);
			}
			catch(Exception exc)
			{
				OnUserException(new ExceptionEventArgs(new EndEditingException( exc ) ) );
				
				e.Cancel = true;
			}
		}