I have a grid with a qty and a description. Currently, when I edit the cell it gives me the default keyboard. 1. I need to make this a number pad2. I need to automatically select the number automatically, so when he edits he overwrites the existing value
3. Perform validation on the number as it is entered or when editing ends.
I figured this out myself yesterday, and I thought i'd take the time to explain how to do this in a little more detail then we usually get on this forum. 1. You need to create a new class as follows. Inherit from IGGridViewDatasourceHelperEditingDelegate public class SomeNewEditingDelegate : IGGridViewDataSourceHelperEditingDelegate
2. Inside this class you need to override the CellEnteringEditMode method as follows public override void CellEnteringEditMode(IGGridViewDataSourceHelper dsh, IGGridViewCell cell, Foundation.NSObject val, UIKit.UIView editor, IGGridViewColumnDefinition col)
3. Inside of the method in #2, add the code to do any validation or change the keyboard. Should look something like this... txtQuantity = (UITextField)editor; txtQuantity.InputAccessoryView = qtyInputView; txtQuantity.PerformSelector(new Selector("selectAll"), null, 0.0f); //it is important to call the selector here because txtQuantity.SelectAll does not work
4. Now in your method where you bind to the grid (probably in your ViewController) myGrid. EditingDelegate = new CullEditingDelegate(this);That's all there is to it. You can now change the keyboard, select the number and validate the value as needed.
One clarification in step #4. It is not "myGrid", but rather your DataSourceHelper