How to reference BrushKey / ColorKey colors for Visual Studio 2013 NewProjectDialog?

Basically, I create the VS2013 extension with a dialog that should have the same layout and colors as the New Project / Add Item dialogs.

This is a dialog box representing patterns for generating code in the left pane and a tree view of the types in the current solution in the middle pane.

To my great joy, I found the Microsoft.VisualStudio.PlatformUI.EnvironmentColors class , which contains many color keys for linking to thematic colors in VS, but, unfortunately, it does not contain colors for the "New Project" category, which, for example, see and change in "NewProjectDialog" in the expanded view of the color theme editor. These theme settings are responsible for a consistent look at New Project, Add Item, Nuget Package Manager, and several other similar dialogs.

Extensibility VS UX Manual really mentions themed colors of VsColors . VsColors exports several properties for explicitly unclassified color values, but not for the NewProjectDialog category.

After a little twist, I found the colors programmatically through the enumeration, Microsoft.VisualStudio.Shell.VsColors.GetCurrentThemedColorValues()and theoretically I could set them from there in the code:

var allColors = VsColors.GetCurrentThemedColorValues().Keys;
var newProjColors = allColors.Where(c => c.Category == new Guid("c36c426e-31c9-4048-84cf-31c111d65ec0")); // guid extracted from an exported theme
var newProjBgKey = newProjColors.SingleOrDefault(c => c.Name == "Background");

This seems completely the opposite, and in addition, it clutters my otherwise empty code.

How to correctly refer to colors in the NewProjectDialog category from XAML?

+2
source share

Source: https://habr.com/ru/post/1651876/


All Articles