共用方式為


New Template Extension on the Gallery

I just created an new Item Template for the WPF AboutBox that I've been discussing in this blog. The item template will create a new AboutBox for your WPF application... It is currently only in C#, but I'm working on a VB version as well. This is Visual Studio 2010 template that has been uploaded to the VS Gallery, so that you can download and install it through the Extension Manager in Beta 1.

And, I'm working on another blog post that describes how to package templates up into VSIXs, so that they can be uploaded to the VS Gallery... that will be up soon.

Here is my blurb from the Gallery:

Every application has an AboutBox (and WinForms even ships a template for it), but there isn't a common one for WPF Applications... until now.

This Item Template creates an AboutBox for a WPF Application, and uses assembly attributes in your project to control what data is displayed in the AboutBox (similar to the way the WinForms template works). Just change the following attributes into your AssemblyInfo.cs file to affect what is shown in the dialog:

[assembly: AssemblyTitle("WPF About Box Sample App")]
[assembly: AssemblyDescription("This is a simple application to show of the WPF About Box.")]
[assembly: AssemblyCompany("Microsoft Samples")]
[assembly: AssemblyProduct("WPF About Box Sample")]
[assembly: AssemblyCopyright("Copyright © 2009 - Pedro Silva")]
[assembly: AssemblyVersion("1.0.*")]

To launch the AboutBox in your application, you will need to add the following code to your program (usually in a menu handler for Help > About):

   // Uses a constructor that takes a parent window for the AboutBox. WPFAboutBox1 about = new WPFAboutBox1(this);
about.ShowDialog();
 

This Item Template also creates an image file (AboutLogo.png) that is used for the AboutBox's banner. Edit this file to provide your own product-specific image for the banner.

Note:When this file is first added to the project, you need to build for XAML to be able to resolve the type to the AboutDataProvider that is part of the source code.

Comments