Create a group
In DevToys, tools are often part of a group. Group are displayed in the navigation bar.
Predefined groups
A set of pre-defined groups are available in PredefinedCommonToolGroupNames.
Define a Gui Tool Group
To define a new group, you can implement GuiToolGroup and expose it to MEF using ExportAttribute attribute.
using DevToys.Api;
using System.ComponentModel.Composition;
namespace MyProject;
[Export(typeof(GuiToolGroup))]
[Name("My Group")]
[Order(After = PredefinedCommonToolGroupNames.Converters)]
internal class MyGroup : GuiToolGroup
{
[ImportingConstructor]
internal MyGroup()
{
IconFontName = "FluentSystemIcons";
IconGlyph = '\uE670';
DisplayTitle = MyProject.Strings.MyGroupDisplayTitle;
AccessibleName = MyProject.Strings.MyGroupAccessibleName;
}
}
The NameAttribute is required and its value should be an unique name that stays internal. This name may appear in logs as it can help for debugging purposes. It is also used to associate a tool to a group.
Four properties can be set into the group:
- IconFontName: Name of the font the contains the glyph to display in the navigation bar. The font name should be installed on the operating system, or being shipped with the tool. The font FluentSystemIcons is shipped with DevToys 2.0 and therefore is available to every extensions by default, on every operating systems.
- IconGlyph: The character of the font for the tool icon to use in the navigation bar.
- DisplayTitle: A localized text to display in the navigation bar.
- AccessibleName: (Optional) A localized text to use as a descriptive name of the group, useful for users who rely on assistive technology such as screen readers.
Some other optional attributes can be used to personalize how the tool behaves:
- OrderAttribute: Defines how this tool should be ordered in the list of groups compared to another one. The Before and After properties should be equal to the NameAttribute of other groups.