Поделиться через


Supported Controls and Features in Expression Blend (Compact 2013)

10/26/2015

If a control in the Blend for Visual Studio toolbox or another feature is not compatible with XAML for Windows Embedded, the XAML for Windows Embedded Application project template generally hides it. This topic describes the controls and features that are supported in a XAML for Windows Embedded project in Expression Blend. Note that the XAML for Windows Embedded API supports more features than the XAML for Windows Embedded Application project template exposes in Expression Blend. If you want to use them, you must manually add those features in Microsoft Visual Studio 2013 or Microsoft Visual Studio 2015.

XAML

When you use the visual design tools in Expression Blend, the XAML of your application is automatically modified. For example, when you select the Button tool from the Toolbox or from the Assets panel, and you use your cursor to draw a button on the artboard in the Expression Blend workspace, XAML similar to the following is added to the file in which you are working:

    <Button 
        Height="26" 
        HorizontalAlignment="Right" 
        Margin="0,0,63,206" 
        VerticalAlignment="Bottom" 
        Width="45" 
        Content="Button"
    />

When you use Windows Embedded XAML Tools to convert your Expression Blend project to a XAML for Windows Embedded project in Visual Studio, your XAML is preserved, and the XAML files in your Expression Blend project are converted to resources in the Resources folder of the XAML for Windows Embedded project.

States

In Expression Blend, you can define a different visual appearance for each state of a control to which you can apply templates. In a user control, you can create states and define their visual appearance. For example, the template of a Button control includes a Pressed state that darkens the color of the button when a user clicks it. You can modify the transition time between two states and even create animation storyboards that run when a state is first entered.

When you convert your project in Visual Studio, any state definitions and transitions in the XAML files of your Expression Blend project are preserved.

For information about using states and transitions in Expression Blend, see Defining Different Visual States for a Control on MSDN.

Storyboards

In Expression Blend, you can create animations by modifying objects and setting key frames in a storyboard. Each key frame defines a visual state for one part of a storyboard animation. Storyboards can be stand-alone animations that are triggered to run when a user interacts with the application, or they can be part of a state group that animates the transition between two states.

When you convert your project in Visual Studio, storyboards that are defined in XAML are preserved. However, in your converted XAML for Windows Embedded project, you must use the IXRFrameworkElement::FindName method to obtain a smart interface pointer for the storyboard object to run it from a method in your code. For example, you might use the following code to obtain an IXRDoubleAnimationPtr to a storyboard named SecondAnimation:

  IXRDoubleAnimationPtr pSecondAnimation = NULL;
  pRoot->FindName(L"SecondAnimation", &pSecondAnimation);
  pSecondAnimation->Begin();

For information about using storyboards in Expression Blend, see Animating Objects on MSDN.

Events

You can attach event handler methods to objects in your Expression Blend application by using the Events view of the Properties panel. Stubs for the event handler methods are automatically added to your code-behind files.

You can write code for those event handler methods to make your prototype application in Expression Blend more interactive, but when you convert your application in Visual Studio, that .NET Framework code is ignored, and template Visual C++ code stubs are generated for your event handler methods. For more information, see Managed Code in Unsupported Controls and Features in Expression Blend.

For information about using events in Expression Blend, see Create a New Event Handler Method on MSDN.

Behaviors

Behaviors are reusable pieces of packaged code that can be dragged onto any object and then fine-tuned by changing their properties. They add interactivity to your application. Custom behaviors must be coded. For more information on adding interactivity to XAML for Windows Embedded applications, see Classes for Interactivity.

Styles and Templates

You can apply modified styles and templates to your controls in Expression Blend to give your application a unique or themed appearance.

When you convert your project in Visual Studio, any styles and templates defined in the XAML page files or in the App.xaml file of your Expression Blend project are preserved.

Warning

Styles and templates that you define in separate resource dictionary files are not preserved. XAML for Windows Embedded does not support the merged dictionary feature in Expression Blend, which includes resource dictionaries. If you have resources defined in dictionary files, move them into the App.xaml file or into a XAML page file. You move them by dragging the files in the Resources panel of Expression Blend. For more information, see Move, Copy, or Export a Resource.

For information about using styles and templates in Expression Blend, see Styling a Control That Supports Templates and Styling Tips for Common Silverlight Controls on MSDN.

User Controls

You can create your own customized control by creating a new UserControl item in Expression Blend. A user control is stored in a XAML and code-behind file, just like the main page of your application. Templates cannot be applied to user controls.

When you convert your project in Visual Studio, the Windows Embedded XAML Tools generate wrapper classes for each user control defined in XAML, generate event handler method stubs, and register the user controls in the App::RegisterUserControls() method.

Visual C# code in the code-behind file for a user control is ignored, but empty native Visual C++ stubs are created for methods. For more information, see "Managed Code" in Unsupported Controls and Features in Expression Blend.

For information about creating user controls in Expression Blend, see Designing a User Control from Scratch on MSDN.

Win32Control

The XAML for Windows Embedded Application project template for Expression Blend includes a Win32Control placeholder control that you can use to combine standard Win32 controls with XAML for Windows Embedded controls. The Win32Control control is available from the Assets panel in Expression Blend. You can use it to represent the future location of a graphics device interface (GDI) control in the converted XAML for Windows Embedded project. GDI controls are child windows that always appear in front of other objects in your XAML for Windows Embedded application.

See Also

Concepts

Expression Blend and XAML for Windows Embedded