The constructed moniker has to match the editor extension registered with the package. For instance, when you create your package and drop the attribute line:
Code: Select all
[ProvideEditorExtension(typeof(MyEditorFactory), "sp-select", "mypackage/record", 10)]
it means that any moniker built with extension "mypackage/record" will be routed to the factory you have setup to instantiate your package editors (MyEditorFactory in this example).
Then you can construct your moniker as such:
Code: Select all
Uri moniker = "sp-select:///mypackage/record";
If you need multiple instances of the same editor, as with multiple Orders in Select, you will need to expand your moniker to include at least an id fragment, and as many optional fragment pairs as you need; and have your factory, or a "RecordUri" class of your own, handle its parsing. The moniker with ID would look like this:
Code: Select all
"sp-select:///mypackage/record?id=C5672F56-62AA-4EC7-8E6D-92B826EB3607"
and the more complex one with fragments:
Code: Select all
"sp-select:///mypackage/record?id=C5672F56-62AA-4EC7-8E6D-92B826EB3607#arg1=val1&arg2=val2"
You are correct about the need to create a UserControl to be hosted in that editor pane. This control should be instantiated in the OnCreateControl() method that you override in your "MyEditorPane" class:
Code: Select all
/// <summary>
/// Creates the control.
/// </summary>
/// <returns></returns>
protected override Control OnCreateControl()
{
// editorControl is a private member of type Control.
if (editorControl == null)
{
editorControl = new MyEditorControl();
// More initialization code here.
}
return editorControl;
}
I hope this helps.