Como: Adicionar novos itens a um projeto WPF
This topic shows how to add new windows, pages, user controls, and resource dictionaries to your Windows Presentation Foundation (WPF) projects. For information on adding items which are not specific to WPF, see Como: Adicionar novos itens de projeto.
Observação |
---|
Caixas de diálogo e comandos de menu que você vê podem diferir das descritas na Help dependendo das suas configurações ativas ou edição. Para alterar as configurações, escolha Import and Export Settings sobre o Ferramentas menu. For more information, see Trabalhando com configurações. |
To create the project
Create a WPF Application project named DemoApplication. For more information, see Como: Criar um novo projeto de aplicativo WPF.
MainWindow. XAML é aberto no WPF Designer.
To add a new Window class
On the Project menu, select Add Window.
O Add New Item caixa de diálogo aparece.
In the Name text box, name the class DemoWindow.xaml and click the Add button.
DemoWindow.xaml is added to the project and opens in the designer. The code-behind file is also added to the project. It is named DemoWindow.xaml.cs or DemoWindow.xaml.vb, depending on the project's language.
To add a new Page class
In Solution Explorer, select the DemoApplication project.
On the Project menu, select Add Page.
O Add New Item caixa de diálogo aparece.
In the Name text box, name the class DemoPage.xaml and click the Add button.
DemoPage.xaml is added to the project and opens in the designer. The code-behind file is also added to the project. It is named DemoPage.xaml.cs or DemoPage.xaml.vb, depending on the project's language.
To add a new User Control class
In Solution Explorer, right-click the DemoApplication project, point to Add, and then select User Control.
O Add New Item caixa de diálogo aparece.
In the Name text box, name the class DemoControl.xaml and click the Add button.
DemoControl.xaml is added to the project and opens in the designer. The code-behind file is also added to the project. It is named DemoControl.xaml.cs or DemoControl.xaml.vb, depending on the project's language.
To add a new Resource Dictionary
In Solution Explorer, right-click the DemoApplication project, point to Add, and then select Resource Dictionary.
O Add New Item caixa de diálogo aparece.
In the Name text box, name the dictionary Resources.xaml and click the Add button.
Resources.xaml is added to the project and opens in the code editor.
Observação There is no visual designer for XAML resources.
Consulte também
Tarefas
Como: Criar um novo projeto de aplicativo WPF
Como: Criar um projeto de biblioteca UserControl WPF
Como: Adicionar novos itens de projeto
Como: Adicionar itens existentes a um projeto
How to: Create a C# WPF Application
Creating a Drawing Application by Using WPF