Export (0) Print
Expand All

Visual design compared to writing XAML and code

Editing XAML markup or code can be a complex task to those who do design work. Microsoft Expression Blend was designed for creative people. You can create complete Windows Presentation Foundation (WPF)–based or Microsoft Silverlight-based applications in Design view in Expression Blend. You can import art assets and XAML that have been exported from Microsoft Expression Design, and import Silverlight encoding templates that were generated by Microsoft Expression Encoder.

Expression Blend was also designed to accommodate team development. Software teams often consist of designers who work on the user interface (UI) and programmers who work on the code that runs behind the UI. For this reason, Expression Blend includes features for generating minimal code that can be handed off to developers, and features that allow you to hook into existing code such as event handlers or custom controls that can be used like existing controls.

  • Create a solution that contains a project for a WPF-based application (.exe), a Silverlight-based application (.exe), a Silverlight-based application with an accompanying website, or a library of controls (.dll).

  • Add a new Extensible Application Markup Language (XAML) file (and corresponding code-behind file) to create a top-level window in your application, a user control, a navigable page in your application, or a resource dictionary that can contain reusable styles, control templates, brush resources, and more.

  • Add existing files to your project or link to existing files, such as image, XML, video, audio, license, XAML, or code files.

  • Add references to existing custom controls that are contained in .dll files. Custom controls can also be contained in existing source code files (.vb or .cs). After you add a custom control to your Expression Blend project, you can use it just as you use the controls that come with Expression Blend.

    For an example of a custom control that is contained in a .cs file, see Try it: Create a custom control with custom properties.

    Cc294780.alert_tip(en-us,Expression.30).gifTip:

    When you add source code files that contain custom controls to an Expression Blend project, you must build the project before you can see the controls in the Controls category of the Assets panel.

  • Add a new project to a solution. You can add or link to existing projects in an Expression Blend WPF project.

  • Open any file that is in your project. XAML files open on the artboard for editing, image files can be inserted in the active document, and sound and video files open in an animation timeline. Code-behind files open on the artboard in a text editor. All files can open in an external editor that is mapped to the file type. For example, if you double-click an .xml file in the Projects panel of Expression Blend, the file will most likely open in Notepad. Code files will open in the Expression Blend text editor, but you can optionally open the files in Microsoft Visual Studio 2008, if it is installed.

    For more information, see Modify a code-behind file.

  • Open a Visual Studio 2008 project or solution for a WPF or Silverlight application and create the UI.

  • Debug your application by building (CTRL+SHIFT+B) or running (F5) it, and resolve any error messages that you might receive, in the Results panel.

  • Add code files for custom classes that you can instantiate in your application.

    For an example, see Try it: Create a custom control with custom properties.

  • Edit code files. If you double-click a code file in the Projects panel of Expression Blend, the file will open on the artboard in a text editor that includes find-and-replace functionality and IntelliSense.

    For more information, see Modify a code-behind file.

  • Define more complicated behavior in event handlers when a user interacts with the UI elements of your application. You can program event handlers to respond to key-presses, mouse actions, and so on. This differs from event triggers for animations and media. For example, event handlers let you use mathematical equations to program the behavior of your application.

    For an example, see Create a new event handler method.

    For a list of events, see the links in Controls, properties, and events reference.

  • Customize the behavior of existing controls, or create new custom controls.

    For an example of a custom control that is based on the WPF Button control, see Try it: Create a custom control with custom properties.

  • Load data, such as Microsoft SQL Server data, into a data table and convert it to a CLR data object that you can use in Expression Blend.

    For an example, see Try it: Display data from a sample SQL database.

  • Create a value converter to add custom logic to a data binding. This is useful if you want to bind a property of one element to a property of an incompatible data type.

    For an example, see Try it: Convert data from one type to another.

  • Debug your application by stepping through it line by line, when the application is running.

    Cc294780.alert_tip(en-us,Expression.30).gifTip:

    You can have the same project file open in Expression Blend and in Visual Studio 2008 at the same time, on the same computer. When you save a change to a file in one system, you will get a notification when you switch to the other system, asking if you want to reload the file.

    For more information, see Debug Expression Blend applications in Visual Studio 2008.

  • Expression Blend optionally creates a corresponding code-behind file for any XAML file that you create by using the Add New Item wizard. If you double-click a code file in the Projects panel of Expression Blend, the file will open on the artboard in a text editor that includes find-and-replace functionality and IntelliSense.

    For more information, see Modify a code-behind file.

  • Expression Blend generates code for an empty event handler method when you double-click an event in the Events view Cc294780.6c67bb3b-e8a2-4a63-bad5-54d5c15b04dd(en-us,Expression.30).png of the Properties panel.

    For more information, see Writing code that will respond to events.

    Cc294780.alert_tip(en-us,Expression.30).gifTip:

    If more than one person has to work on the same project at the same time, we recommend that you use a source control system such as Microsoft Team Foundation. A source control system maintains a central repository for project files that you can check out and edit locally on your computer. For more information, see Working with Team Foundation source control.

If you need help writing code for your Expression Blend application, you can use one of the resources listed at Learning and community resources. These include links to discussion forums, tutorials, and other resources.

Community Additions

ADD
Show:
© 2014 Microsoft