Book Image

Blend for Visual Studio 2012 by Example: Beginner's Guide

By : Abhishek Shukla
Book Image

Blend for Visual Studio 2012 by Example: Beginner's Guide

By: Abhishek Shukla

Overview of this book

<p>Creating applications with compelling graphics has been one of the main goals of client applications, and with the arrival of WPF, Silverlight, and HTML5 it is much easier than ever before to create interactive and rich user interfaces.</p> <p>Blend for Visual Studio 2012 by Example Beginner's Guide will give you a good grounding in creating Windows, Web, and Windows Phone applications. You will also look at the various layouts and controls available in Blend and how we can create animations and behaviors in Blend.</p> <p>Towards the end, you will be aware of the various capabilities that are available in Blend out of the box.</p>
Table of Contents (19 chapters)
Blend for Visual Studio 2012 by Example Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – adding a user control in a window


We could add user control in a window, page, or another user control. To add SetRGBUserControl to MainWindow, simply open MainWindow from the Projects panel. Then, Open Assets and Search for SetRGBUserControl. This is shown in the following screenshot:

Drag and drop the user control onto the art board. This will add a copy of SetRGBUserControl to the grid layout of MainWindow.xaml. We can also add the user control by dragging and dropping the user control onto the Objects and Timeline panel as well.

Run the application and we can see the user control as part of MainWindow, and when we change the values in the textboxes, the color of the rectangle changes. This is shown in the following screenshot:

When we look at the XAML code for MainWindow.xaml, we can see a namespace declaration added. The namespace refers the current Chapter09 and has an alias local. SetRGBUserControl is available in this namespace, and we need to reference it in the XAML...