Cannot set collapsed project icon using IProjectTreePropertiesProvider
See original GitHub issueThis issue has a corresponding ticket on Developer Community. Please vote and comment there to make sure your voice is heard.
When setting the icon of the project tree using IProjectTreePropertiesProvider
the Icon
property doesn’t change the icon that is showned. It’s always the default C# proect.
Here’s the code I’m using:
[Export(typeof(IProjectTreePropertiesProvider))]
[AppliesTo(NanoCSharpProjectUnconfigured.UniqueCapability)]
internal class ProjectTreePropertiesProvider : IProjectTreePropertiesProvider
{
/// <summary>
/// Calculates new property values for each node in the project tree.
/// </summary>
/// <param name="propertyContext">Context information that can be used for the calculation.</param>
/// <param name="propertyValues">Values calculated so far for the current node by lower priority tree properties providers.</param>
public void CalculatePropertyValues(
IProjectTreeCustomizablePropertyContext propertyContext,
IProjectTreeCustomizablePropertyValues propertyValues)
{
// set the icon for the root project node
if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
{
propertyValues.Icon = KnownMonikers.AbstractCube.ToProjectSystemType(); ;// NanoFrameworkMonikers.NanoFrameworkProject.ToProjectSystemType();
propertyValues.ExpandedIcon = NanoFrameworkMonikers.NanoFrameworkProject.ToProjectSystemType();
}
}
}
To rule out any issues with the icon format on my resources, I’ve momentarily replaced it with one of VS stock icons, as can be seen from the above. The result is the same.
The ExpandedIcon
property does work.
Attaching screenshots of a project tree expanded and colapsed for illustration.
Worth noting that this happens in both VS2017 and VS2019.
Original Comments
Visual Studio Feedback System (6/10/2019, 04:18 PM)
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
José Simões (7/17/2019, 06:09 PM)
Hi,
Any update on this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (7 by maintainers)
Glad to hear you got it working. I agree the comment is confusing. Take a look at https://github.com/microsoft/VSProjectSystem/pull/327 and see if you find it an improvement.
Thanks again for your feedback and helping to improve the project system!
@josesimoes please let us know if
Order
attribute solves the problem.See also https://github.com/microsoft/VSProjectSystem/blob/master/doc/extensibility/IProjectTreePropertiesProvider.md