Teil von  SELFPHP
  +++ SELFPHP CronJob-Service :: Jetzt auch als Professional-Version verfügbar! +++

:: Anbieterverzeichnis ::

Globale Branchen

Informieren Sie sich über ausgewählte Unternehmen im Anbieterverzeichnis von SELFPHP  

 

:: SELFPHP Forum ::

Fragen rund um die Themen PHP? In über 120.000 Beiträgen finden Sie sicher die passende Antwort!  

 

:: Newsletter ::

Abonnieren Sie hier den kostenlosen SELFPHP Newsletter!

Vorname: 
Name:
E-Mail:
 
 

:: Qozido ::

Die Bilderverwaltung mit Logbuch für Taucher und Schnorchler.   

 
 
Creating a UserControl


SELFPHP Produktempfehlung
Microsoft Windows Server 2008
Seite Windows Server 2008
Seite

Microsoft SQL Server 2008
Seite SQL Server 2008
Seite

Microsoft Expression Web 3
Seite Microsoft Expression
Seite







What you’ll learn in this module:

Creating a User Control
Editing a User Control
Rebuilding a UserControl


Venture into Gaming Using Expression Blend: Module 4

Creating a UserControl

If you’re familiar with the Flash convention of Movie Clips, UserControls is not a new concept. Essentially, a UserControl is an object with its own XAML and CS files. This can be very useful if you need more than one object that behaves or looks the same way.

Making a UserControl
Rather than copying and pasting objects, which can get messy when you go to edit them; create a UserControl. That way your edits are reflected in every instance of the UserControl used in your project.

In this section, you’ll turn the hive object into a user control. This will make it easier to apply changes to multiple objects and save you time as you develop the game.

To start, you will open an existing file that contains the assets for the Beehive game.

  1. Choose File > Open Project/Solution and browse to the module04_assets folder (inside the guide_assets folder).Locate the folder named beehive and open the beehive project file located within.
  2. If necessary double-click MainPage.xaml in the Projects tab to see the design view of the project.
  3. Turn down the arrow to the left of the honeycomb canvas in the Object and Timeline panel, and click the object named HexShape. The honeycomb object is now selected.
  4. Choose Tools > Make Into UserControl, or press F8. A Make Into UserControl dialog box appears. Change the default name of HexShapeControl to Honeycomb the same and press OK.

Inside the User Control
You are now in the Honeycomb. Notice that when you created this control that a new XAML document was added, named Honeycomb.xaml and placed in your Projects panel.



The newly created HexShapeControl.xaml.

  1. Turn down the arrow to the left of Honeycomb.xaml (located in the Projects panel) to see the Honeycomb.xaml.cs file. This is the code behind file that is associated with the UserControl. You can use this file to add functionality to the UserControl.
  2. Now return to the MainPage.xaml, by clicking the tab at the top.
    Notice the orange border that is created around the Honeycomb control. This indicates that you need to rebuild the project, in order to see an accurate rendition of the new control.




  3. Choose Project > Rebuild Project, or press the keyboard shortcut Ctrl+Shift+8.
    While in the MainPage.xaml, look in the Objects & Timeline panel to see that the HexShape object has now been changed into the UserControl, Honeycomb.
  4. Click the Honeycomb UserControl in the Objects and Timeline panel, then choose Edit > Copy, and then Edit > Paste. If you like keyboard shortcuts you can use Ctrl+C and Ctrl+V.
  5. Using the Selection tool, click the second Honeycomb UserControl in the Objects and Timeline panel to select it, then click and drag the control (in the artboard) so that it is positioned next to the original Honeycomb object.



    Copying and pasting a UserControl.

    You will now use a keyboard shortcut to create a second copy of the original control.
  6. Using the Selection tool, click one of the Honeycomb controls on the artboard, then hold down the Alt key and drag the Honeycomb. Notice that the cursor changes into a double-arrow and that you are cloning the UserControl.
    Position the cloned control next to the original, you now have three Honeycomb controls on the artboard.



    Cloning by holding down the Alt key.


Seite 1 von 2 1 2



Downloads

Copyright © 2010
Microsoft Deutschland GmbH
Alle Rechte vorbehalten.

 Microsoft Deutschland GmbH
 




:: Premium-Partner ::

Webhosting/Serverlösungen


Premium-Partner MECO Systemhaus GmbH & Co. KG
Premium-Partner PSW GROUP GmbH & Co. KG
Premium-Partner BPI-Systeme
Premium-Partner Pixel X
Premium-Partner
 

:: SELFPHP Sponsoren ::


DM Solutions
Microsoft Deutschland GmbH
twosteps.net - ...Premium-Webhosting
Sedo - Bei uns wird PHP großgeschrieben
hostfactory.ch - OptimaNet Schweiz AG
ZEND - The PHP Company
Kaspersky Labs
HighText iBusiness
SELFPHP Sponsoren
 

Qozido


© 2001-2013 E-Mail SELFPHP OHG, info@selfphp.deImpressumKontakt