Transcript - Creating A Visual Basic WPF Application
Transcript - Creating A Visual Basic WPF Application
Transcript I'm Kathleen McGrath, and in this presentation, you're going to learn how to create a WPF Application using Visual Basic Express. WPF stands for Windows Presentation Foundation, and its a new technology for creating rich, graphical applications. Like Windows Forms applications, WPF applications can be designed by dragging controls from the Toolbox to a design surface. In addition to having a designer, Properties window, and Toolbox, the IDE in WPF projects has a window that contains XAML. XAML is an acronym for Extensible Application Markup Language, which is used to create a user interface. In this demonstration, you will learn how to create a drawing application using WPF and Visual Basic.
Setting Properties
I'm going to change the size of the WPF window by using the Properties window. If you do not see the Properties window, on the View menu, click Properties. This window lists the properties of the currently selected WPF window or control, and it's here that you can change the existing values. First I'll select the WPF window, then I'll change the size of the WPF Window by setting the Height property to 550 and the Width property to 370 in the Properties window, and then I'll change the Title to Ink Pad. Notice that the title changes in the title bar. Next, I'll change the Background property of the WPF window by clicking the drop-down control, and selecting a color.
The WPF window changes color. Now I'll add some controls to the form from the Toolbox. If the Toolbox isn't visible, you can open it by clicking the View menu, and then clicking Toolbox. I want to add an InkCanvas control, but I don't see it on the Toolbox. To add it, I'll rightclick the Toolbox, and then click Choose Items. In the WPF Components tab of the dialog box, I'll scroll down to InkCanvas, and select it. Then I'll click OK to add the InkCanvas control to the Toolbox. Now I'll drag the InkCanvas control from the Toolbox to the WPF window, and I'll set the following properties for the InkCanvas control in the Properties window. Property values for the InkCanvas control Property Width Height HorizontalAlignment VerticalAlignment Margin Value Auto Auto Stretch Stretch 9, 9, 9, 68
Editing XAML
If you look at the XAML window, you will see that these changes appear. You can also make these changes directly in the XAML markup. So next, I'll change the Background color of the InkCanvas control to yellow by adding the following attribute and value: Background="LightYellow". Next, Ill drag two buttons from the Toolbox to the bottom of the WPF window. Now I'll select Button1, and make some changes in the XAML markup. The text that appears on the button is located between the opening Button tag and the closing tag. I'll move my cursor between these two tags, and then type the word Clear. Now, I'll select Button2, and change the text to Close.