This example demonstrates how to create and use custom EditSettings with a custom editor in GridControl.
For this, we create a TextEditSettings class descendant with a custom EditFont property which is used to set the editor's FontFamily property. Then, we create a TextEdit class descendant. In the static constructor of the TextEditSettings class descendant, we call EditorSettingsProvider's RegisterUserEditor2 method with our TextEditSettings and TextEdit as parameters. After that, we override its AssignToEditCore method to set the editor's FontFamily value to the EditFont value.
Added By: WAGENHEIM Laurent at: 10/9/2015 1:52:08 AM
For this, we create a TextEditSettings class descendant with a custom EditFont property which is used to set the editor's FontFamily property. Then, we create a TextEdit class descendant. In the static constructor of the TextEditSettings class descendant, we call EditorSettingsProvider's RegisterUserEditor2 method with our TextEditSettings and TextEdit as parameters. After that, we override its AssignToEditCore method to set the editor's FontFamily value to the EditFont value.
Question Comments
Added By: WAGENHEIM Laurent at: 10/9/2015 1:52:08 AM
Hi,
When using this snippet to make a CustomComboBoxEditSettings I get a NullReferenceException on editSettings.ApplyToEdit(this, true, EmptyDefaultEditorViewInfo.Instance);
If I comment this line of code, everything seems to work fine.
NB : using reflector it seems to crash in this function :
protected internal virtual void UnsubscribeToItemsProviderChanged()
{
this.ItemsProvider.ItemsProviderChanged -= this.ItemsProviderChangedEventHandler.Handler;
}
Hello,
To process your recent post more efficiently, I created a separate ticket on your behalf: NullReferenceException occurs when custom EditSettings are being applied to the editor. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.