protected override void OnKeyUp(KeyEventArgs e) { BaseBrowseEditorElement editorElement = this.EditorElement as BaseBrowseEditorElement; PropertyGridItemElement visualItem = this.OwnerElement as PropertyGridItemElement; if (visualItem != null) { int selectionStart = editorElement.FilePathTextBox.TextBoxItem.SelectionStart; int selectionLength = editorElement.FilePathTextBox.TextBoxItem.SelectionLength; switch (e.KeyCode) { case Keys.Right: if ((RightToLeft && selectionStart == 0) || (!RightToLeft && selectionStart == editorElement.Text.Length)) { editorElement.Validate(); } break; case Keys.Left: if ((RightToLeft && selectionStart == editorElement.Text.Length) || (!RightToLeft && selectionStart == 0 && selectionLength == 0)) { editorElement.Validate(); } break; } } }
protected override void OnKeyDown(KeyEventArgs e) { BaseBrowseEditorElement editorElement = this.EditorElement as BaseBrowseEditorElement; PropertyGridItemElement visualItem = this.OwnerElement as PropertyGridItemElement; if (visualItem != null) { switch (e.KeyCode) { case Keys.Enter: if (this.Validate()) { visualItem.PropertyTableElement.EndEdit(); } break; case Keys.Escape: visualItem.Data.PropertyGridTableElement.CancelEdit(); break; case Keys.Delete: if (editorElement.FilePathTextBox.TextBoxItem.SelectionLength == editorElement.FilePathTextBox.TextBoxItem.TextLength) { editorElement.Text = String.Empty; } break; } } }
private string GetEditorValue() { BaseBrowseEditorElement editorElement = this.EditorElement as BaseBrowseEditorElement; editorElement.Validate(); return(editorElement.Value); }
public override bool EndEdit() { base.EndEdit(); BaseBrowseEditorElement editorElement = this.EditorElement as BaseBrowseEditorElement; editorElement.ValueChanging -= editorElement_ValueChanging; editorElement.ValueChanged -= editorElement_ValueChanged; editorElement.KeyDown -= editorElement_KeyDown; editorElement.KeyUp -= editorElement_KeyUp; editorElement.FilePathTextBox.TextBoxItem.HostedControl.LostFocus -= new EventHandler(HostedControl_LostFocus); return(true); }
private void SetEditorValue(Object value) { BaseBrowseEditorElement editorElement = this.EditorElement as BaseBrowseEditorElement; if (string.IsNullOrEmpty(value.ToString()) || !File.Exists(value.ToString())) { editorElement.Value = String.Empty; } else { editorElement.Value = value.ToString(); } }
public override void BeginEdit() { base.BeginEdit(); BaseBrowseEditorElement editorElement = this.EditorElement as BaseBrowseEditorElement; editorElement.ValueChanging += new ValueChangingEventHandler(editorElement_ValueChanging); editorElement.ValueChanged += new EventHandler(editorElement_ValueChanged); editorElement.KeyDown += new KeyEventHandler(editorElement_KeyDown); editorElement.KeyUp += new KeyEventHandler(editorElement_KeyUp); editorElement.FilePathTextBox.TextBoxItem.SelectAll(); editorElement.FilePathTextBox.TextBoxItem.TextBoxControl.Focus(); editorElement.RightToLeft = this.RightToLeft; editorElement.FilePathTextBox.TextBoxItem.HostedControl.LostFocus += new EventHandler(HostedControl_LostFocus); }