Пример #1
0
 private void TreeGrid_CurrentCellValidating(object sender, TreeGridCurrentCellValidatingEventArgs args)
 {
     if (args.Column.MappingName == "LastName" && (args.NewValue == null || string.IsNullOrEmpty(args.NewValue.ToString())))
     {
         args.ErrorMessage = "LastName should not be null value";
         args.IsValid      = false;
     }
 }
        /// <summary>
        /// Raises the <see cref="Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.CurrentCellValidating"/> event.
        /// </summary>
        /// <param name="treeGrid">
        /// Specifies the corresponding grid .
        /// </param>
        /// <param name="column">
        /// The corresponding column that was in edit mode.
        /// </param>
        /// <param name="oldValue">
        /// The cell value before edited.
        /// </param>
        /// <param name="newValue">
        /// The value of the current cell is being edited.
        /// </param>
        /// <param name="changedNewValue">
        /// The cell value after editing completed.
        /// </param>
        /// <returns>
        /// <b>true</b> if <see cref="Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.CurrentCellValidating"/> event is raised; otherwise, <b>false</b>.
        /// </returns>
        protected bool RaiseCurrentCellValidatingEvent(SfTreeGrid treeGrid, TreeGridColumn column, object oldValue, object newValue, out object changedNewValue, object record, TreeNode treeNode)
        {
            var e = new TreeGridCurrentCellValidatingEventArgs(treeGrid)
            {
                OldValue = oldValue,
                NewValue = newValue,
                Column   = column,
                RowData  = record,
                Node     = treeNode
            };
            bool isSuspendValidating = TreeGrid.RaiseCurrentCellValidatingEvent(e);

            changedNewValue = e.NewValue;
            return(isSuspendValidating);
        }