共用方式為


Template Policy and the Properties Window

When a project is contained inside an enterprise template project, that enterprise template project can enforce policy. Template policy becomes a constraining system that can be used to set default values for properties, hide properties, add properties, and so on.

Using template policy to control the display of information in the Properties window is different from implementing IVsPerPropertyBrowsing. IVsPerPropertyBrowsing handles object properties at the component level, while template policy can be used to constrain object properties at the solution or project level. In other words

  • Implement the methods on IVsPerPropertyBrowsing to determine what is displayed in the Properties window for specific objects

  • Use template policy at the solution and project level to determine what is displayed in the Properties window for previously specified objects

Using template policy to selectively constrain specific properties in the Properties window when a project item of a specified type is selected in Solution Explorer can be beneficial to all members of the development team working on a project. For example, using template policy, you can set up all the connection-string information in a database for your developers and make the connection string read-only. In that way, you can provide a simple way to assure that each developer uses the correct path for data access.

See Also

Reference

IVsPerPropertyBrowsing

Other Resources

Properties Window and Property Pages