How to create a new plug-in Options page
This topic is about adding a DXCore Options page. It has three parts to make it easier to read and follow:
- Adding and designing an options page (this post)
- Implementing the options page settings storing logic
- Using settings from an options page inside a plug-in
Here’s the first part of the topic, and the steps we need to accomplish, to add an options page to your plug-in, and make it work:
- Run the options page wizard
- Layout controls on the page
- Add runtime behavior code for controls, if necessary
Let’s take a look at these steps in detail.
The Options Page Wizard
In the Visual Studio’s Solution Explorer tool window, right-click your DXCore plug-in project and choose Add | New Item…
The Add New Item dialog appears. Follow these steps to add an Options page:
- Choose the Language section of you plug-in (CSharp or Visual Basic)
- Select the DXCore category inside of the Language section
- Select the Options Page template
- Specify a meaningful name. It is convention to prefix options pages with “Opt“.
- Click the Add button:
The New Options Page dialog will appear:
There are three options to set here:
- User Level
The User Level option determines when the page will be seen: for new users, for advanced users, or expert users. This mode is changed on the IDE tools Options Dialog, for example, at the Expert level, all options pages are visible.
The Category list is populated with all the existing option categories automatically. You can select one of them, or specify your own. Sub-categories are separated with the backslash character (e.g., “Editor\Painting“).
- Page Name
Enter the page name (it is recommended to use only characters that are legal for file names). You can change all these options later, inside the options page source code, but you’ll save some time if you set them correctly from the beginning.
Click OK. The options page wizard will generate the new options page item and add it to the active project:
The Options Page design surface is activated in the editor after the item is added:
Layout controls on the page
Populate your options page with controls suitable for manipulating your options. If you plan on sharing this options page with other developers outside of your team, it is recommended using only the .NET controls that ship with Visual Studio, or controls that ship with the DXCore (the controls located in the “DXCore…” groups of the Toolbox).
Adding runtime behavior code for controls
Here, you might want to fill the control content with appropriate items, group radio buttons, implement drag-n-drop behavior for controls, etc.
The next step is to implement the logic of the options page to correctly read and write plug-in settings.—– Products: DXCore Versions: 10.2 and up VS IDEs: any Updated: Feb/26/2011 ID: D065