Partager via


Add or modify an object

You can add an object to the artboard by selecting a control or a tool in the Tools panel or in the Assets panel, and then drawing the object on the artboard by using your mouse. You can also select a styled or custom control from the Assets panel, drag a styled control from the Resources panel, or drag resources from the Resources panel onto an existing object on the artboard to apply the resource to one of the properties of the object.

[!REMARQUE]

The following procedures assume that you have a project open in Design view in Blend for Visual Studio 2012.

To add an object by using the Tools panel

You can add an object to the artboard by doing one of the following:

  • Double-click the icon for a control (such as Rectangle JJ170871.81ffc148-cf5c-4faf-bd3f-f38d3073a12c(fr-fr,VS.110).png, Grid JJ170871.a87ee957-7fbf-4135-a6ab-6de7e63160aa(fr-fr,VS.110).png, Button JJ170871.05df1779-a68f-436b-b834-a91b7995a3ec(fr-fr,VS.110).png, or TextBlock JJ170871.42165963-00f7-4a33-abcd-b0849edebada(fr-fr,VS.110).png) in the Tools panel. The object is inserted into the upper-left corner of the artboard at a default width and size.

  • Select the icon of the control in the Tools panel and use your mouse to draw the control on the artboard.

[!REMARQUE]

If you cannot see a tool or control in the Tools panel, you might have to right-click one of the tools, select the tool or control that you want from the list that appears, and then double-click the icon.

JJ170871.8fbbbb21-be83-4cf6-903b-3a49f00c9860(fr-fr,VS.110).png

To add an object by using the Assets panel

  1. Open the Assets panel by clicking Assets JJ170871.0d8b8d29-1af9-418f-8741-be3097d76eab(fr-fr,VS.110).png in the Tools panel.

  2. Do one of the following:

    • To add a control   Under Controls, click All, select a control from the list, and then use your mouse to draw the control on the artboard.

    • To add a styled control that occurs in a resource dictionary   Under Styles, select the resource dictionary, select a styled control from the list, and then use your mouse to draw the control on the artboard.

      [!REMARQUE]

      You can create your own resource dictionaries by clicking Create new resource dictionary JJ170871.35c35d1d-ac87-42f7-adc4-d620dbe60297(fr-fr,VS.110).png in the Resources panel. For more information, see Create, export, or import a resource dictionary.

    • To add a styled control that is defined in your project   Under Styles, select a styled control from the list, and then use your mouse to draw the control on the artboard.

      [!REMARQUE]

      Styles are created by selecting an existing control and then modifying its style or template. You can also convert any property value in the Properties panel to a resource. For more information, see Create or modify a template and Create a resource.

    • To add a media item   Under Media, select a media item from the list (such as an image or video file), and then use your mouse to draw the control on the artboard.

      [!REMARQUE]

      The media file must already be listed in the Projects panel. To add a file to your project, click Add Existing Item on the Project menu. For more information about how to use media files in Blend, see Insert an item into the active document and Inserting audio and video.

    • To add a custom or user control   Under Project, select a custom control from the list, and then use your mouse to draw the control on the artboard.

      [!REMARQUE]

      If you have added a custom control or user control to your project and you do not see it listed in the Project category, build your project (Ctrl+SHIFT+B). For more information, see Creating custom controls and Try it: Create a custom control with custom properties.

[!REMARQUE]

You can type into the Search text box to filter the list of assets that appears in any category of the Assets panel.

To add an object by using the Resources panel

  1. From the Resources panel, expand the nodes, and then select a resource.

  2. Drag the resource onto the artboard.

    • If the resource is a style or a template, an instance of the control that the resource was created from is added to the artboard, with the style or template already applied.

    • If the resource is a property value, a pop-up menu appears that gives you the option to create a new object and then apply the style to one of its properties, or apply the style to one of the existing objects on the artboard.

To modify an object

Do one of the following:

  • Modify the object by using the on-object handles that appear on the artboard when you move the pointer over the corners of the blue bounding box of the object. These handles enable you to rotate JJ170871.888cbf6b-c442-424d-977d-61d942703c4a(fr-fr,VS.110).png, resize or flip JJ170871.7d350cd4-6d4f-40bc-9d04-d46d2d54ebee(fr-fr,VS.110).png, move JJ170871.eff911a7-b891-4315-a86c-cc4cd088e647(fr-fr,VS.110).png, or add a corner radius JJ170871.8ff4c5e0-3b7f-49d7-97cb-ad373c3a7fe7(fr-fr,VS.110).png to the object. If you do not see the on-object handles, click Selection JJ170871.2ff91340-477e-4efa-a0f7-af20851e4daa(fr-fr,VS.110).png or Direct Selection JJ170871.6dd6571f-c116-451d-8dd2-1f88b8406362(fr-fr,VS.110).png, and then select the object.

    You can change the behavior of the on-object handles in the following ways:

    • To constrain the aspect ratio, hold down the Shift key while you resize or scale.

    • To maintain the position of the center point (instead of maintaining the position of the opposite corner or edge), hold down the Alt key while you resize, scale, or skew.

    • To snap every 15 degrees, hold down the Shift key while you rotate the object.

  • Modify the object by selecting it in the Objects and Timeline panel and then changing the properties in the Properties panel. You can use this method to change the appearance of the object, change its location, or bind data to specific properties on the object.

    For more information, see the following topics:

  • Animate the object.

    For more information, see Animating objects.

  • Create a template for the object by selecting the object in the Objects and Timeline panel, and then selecting Edit Style or Edit Template under the Object menu.

    For more information, see the following topics:

Voir aussi

Tâches

Reposition or translate an object

Rename an object

Select or cancel the selection of objects

Rotate an object

Copy, cut, paste, or delete an object

Align objects

Group or ungroup objects