Free Xaml Designer Tool

Material Design In XAML Toolkit. Welcome the one of the most comphrensive and easy to use Material Design UI libraries across any platform. With Material Design In XAML Toolkit you can easily bring beautiful desktop applications to life, using a modern and popular design language.

With ReSharper, you get additional assistance editing XAML files whenever you work with Universal Windows Platform (UWP), WPF, Silverlight, or Windows Phone applications. This includes code quality analysis on-the-fly, refactorings, code generation and rearrangement, as well as quick solution-wide navigation.

Code quality analysis

ReSharper's code quality analysis features help you quickly locate and correct errors in your XAML files. Let's see how it works using a few examples.

Example 1. XAML Language Level Errors

Say, you're working on a WPF project where only XAML 2006 is allowed. If ReSharper encounters a generic object from XAML 2009, it highlights the object as a language error. Should you press Alt+Enter on the highlighting, ReSharper displays a quick-fix suggesting to declare a type inherited from System.Collections.Generic.List<string> instead.

When you apply the quick-fix, ReSharper:

  • Creates a new .cs file where it declares a new wrapper type that inherits from List.
  • In the original XAML file, it deletes the TypeArguments attribute, changes the type of the object to the new wrapper type, and inserts a new namespace directive if necessary.

Example 2. Nonexistent Resources

If you're using a resource that is not yet declared, ReSharper error highlighting won't let you forget about that.

When you press Alt+Enter, ReSharper suggests several possible locations for creating the missing resource.

If the type of the generated resource is not yet declared, no problem: ReSharper will offer you the option to create either a CLR type or a XAML type (i.e., a UserControl) from usage. Choosing one of the two options creates a file with the default implementation.

Example 3. Misplaced Comments

Accidentally placing a comment within an element will result in ReSharper highlighting it and offering options for resolving the error.

Example 4. Redundant Type Qualifiers

In the case where a TargetType is defined on a style setter, ReSharper detects redundancies in type qualifiers and offers a fix.

Extended XAML IntelliSense

You can make use of ReSharper's code completion in XAML tags. Support for CamelHumps will help you quickly add attributes: simply enter a few symbols and press Ctrl+Space to show the list of relevant suggestions that ReSharper's Symbol Completion provides.

If you invoke Smart Completion by pressing Ctrl+Alt+Space, ReSharper will offer additional context-sensitive options depending where you are in code. For example, invoking smart completion in an event handler declaration will offer to generate the handler method.

By using Smart Completion inside an attribute, you can quickly create a new resource (static or dynamic), a binding or a reference to a static element.

Another exciting advantage of ReSharper code completion is that it displays colors for brushes that are expected in attributes such as Background or OpacityMask.

ReSharper also supports Import Symbol Completion in XAML. That means, you can complete types from assemblies that are referenced in your solution but don't have corresponding namespace import directives in the current file.

Of course, once you've used ReSharper code completion this way, the required namespace import directive will be inserted automatically.

Alternatively, if you have a type inside a XAML file that is not imported for some reason, ReSharper will offer you the option to quickly create the namespace directive.

Navigation and search

ReSharper's Navigate To menu works on XAML code elements in the same way as it does in C# code files. Pressing Alt+` on a symbol declaration or usage opens a menu with multiple possible navigation destinations.

Navigation via Go To File Member works in a XAML file the same as in a C# file, helping navigate to an element with a particular type, name or key. Once again, you don't have to type the whole name — support for lowercase CamelHumps lets you find WatchList by only typing wl.

When you press Ctrl+Alt+F7 in a XAML file, you get a list of all related files: for example, the code-behind file, any resources referenced in the current XAML file, or images used in your controls.

Go to Declaration (F12) and Ctrl-click navigation also works the same way in a XAML file as it does in an ordinary C# code file. For example, while holding Ctrl, you can hover over the name of a particular class. ReSharper will underline the class name, and clicking the link will take you straight to the class definition.

Also, just like with code files, the File Structure window displays the structure of the XAML file, letting you quickly navigate to the code element that you're looking for.

You can look for usages of a particular XAML element by pressing Shift+F12, which will invoke the Find Usages command. ReSharper will display all locations where the element is being used.

You can also press Shift+Alt+F11, which will highlight usages, giving you a quick overview of locations where a particular symbol is being used in the current file.

Generating dependency properties

Creating dependency properties can be ridiculously boring. That's another problem that ReSharper can fix: its code template engine is powerful enough to let you create fine-grained snippets that deploy into dependency properties in a couple of keystrokes. You just type the name of a live template in the editor — and you get the pair of a property and the corresponding dependency property deployed, with intelligent code completion available in all placeholders that you need to fill.

Similarly, you can make ReSharper deploy attached properties, which are even more cumbersome than regular dependency properties. Upon deployment of the live template, you can pass through all its numerous variables and use ReSharper code completion where applicable.

Although live templates for dependency property and attached property are not currently included in ReSharper out of the box, you can download and import them.

XML and XAML editing helpers

ReSharper supports various context actions which simplify working with XML syntax and can be used in XAML. To mention just a few, you can replace a tag name with a different name, convert an attribute to a nested element, or remove a tag and promote its children up a level.

There's also over a dozen XAML-specific context actions, letting you add or remove column or row definitions, create views and resources, switch between different types of resource references, extract property setters to styles, and more.

Refactoring XAML code

Since XAML elements are, essentially, equivalent to ordinary class members, some of the refactorings which work in C# also work in XAML. For example, you can rename or safely delete a resource just by opening the Refactor This menu.

When you navigate over a reference to a property or method in XAML, the range of refactorings presented in the Refactor This menu matches what you would expect if you opened that menu in C# or VB.NET code.

In addition to C# and VB.NET refactorings, there are some XAML-specific refactorings:

It's a common situation in XAML to define inline styles for several controls and then relocate them to a style definition. ReSharper makes this operation a breeze with the Extract Style refactoring.

The dialog box that appears for this refactoring helps you decide which resource to extract the properties into (you can choose an existing resource or create a new one), as well as what properties you want to extract.

Extract Resource and Inline Resource refactorings let you move virtually any property assignment (including those in markup extensions) to a resource and vice versa — take a definition out of a resource and splice it right into the element.

Code reordering

Using ReSharper's code reordering features, you can move around elements within a XAML file or even attributes within these elements. Both operations are performed by pressing Ctrl+Alt+Shift keys and arrow keys.

When working with attributes, these key combinations let you move the attributes around within the tag, so that the Left and Right arrow keys change the position of the attribute. If, however, you press the Up and Down keys, your actions will affect the entire tag.

The Up and Down keys move the whole tag in relation to other tags. If you extend a selection using Ctrl+Alt+Right to encompass the tag with everything in it, you can also use the Left and Right keys to the same extent, with the only difference that these combinations will also 'demote' your current selection, putting it inside any tag that you come across.

Note on shortcuts

All keyboard shortcuts provided in this page are available in ReSharper's default 'Visual Studio' keymap. For details on ReSharper's two keymaps, see ReSharper Documentation.

-->

You can add elements—controls, layouts, and shapes—to your app in XAML, in code, or by using XAML Designer. This topic describes how to work with elements in XAML Designer in Visual Studio or Blend for Visual Studio.

Add an element to a layout

Layout is the process of sizing and positioning elements in a UI. To position visual elements, you must put them in a layout Panel. A Panel has a child property that is a collection of FrameworkElement types. You can use various Panel child elements, such as Canvas, StackPanel, and Grid, to serve as layout containers and to position and arrange the elements on a page.

Free

By default, a Grid panel is used as the top-level layout container within a page or form. You can add layout panels, controls, or other elements within the top-level page layout.

To add an element to a layout in XAML Designer, do one of the following:

  • Double-click an element in the Toolbox (or select an element in the Toolbox and press Enter).

  • Drag an element from the Toolbox to the artboard.

  • In the Toolbox, select one of the drawing tools (for example, Ellipse or Rectangle), and then draw an element in the active panel.

Change the layering order of elements

When there are two elements on the artboard in XAML Designer, one element will appear in front of the other in the layering order. At the bottom of the list of elements, in the Document Outline window is the front-most element (except for when the ZIndex property for an element is set). When you insert an element into a page, form, or layout container, the element is automatically placed in front of other elements in the active container element. To change the order of elements, you can use the Order commands or drag the elements in the object tree in the Document Outline window.

To change the layering order, do one of the following:

  • In the Document Outline window, drag the elements up or down to create the desired layering order.

  • Right-click the element in the Document Outline window or the artboard for which you want to change the layering order, point to Order, and then click one of the following:

    • Bring to Front to bring the element all the way to the front of the order.

    • Bring Forward to bring the element forward one level in the order.

    • Send Backward to send the element back one level in the order.

    • Send to Back to send the element all the way to the back of the order.

  • Change the ZIndex property in the Layout section in the Properties window. For overlapping elements, the ZIndex property takes precedence over the order of elements shown in the Document Outline window. An element that has a higher ZIndex value appears in front when elements overlap.

Change the alignment of an element

You can align elements in the artboard by using menu commands or by dragging elements to snaplines.

A snapline is a visual cue that helps you align an element relative to other elements in the app.

To align two or more elements by using menu commands:

  1. Select the elements that you want to align. You can select more than one element by pressing and holding the Ctrl key while you select the elements.

  2. Select one of the following properties under HorizontalAlignment in the Layout section of the Properties window: Left, Center, Right, or Stretch.

  3. Select one of the following properties under VerticalAlignment in the Layout section of the Properties window: Top, Center, Bottom, or Stretch.

To align two or more elements by using snaplines, in XAML Designer, in a layout that contains at least two elements, drag or resize one of the elements so that the edge is aligned with another element.

When the edges are aligned, an alignment boundary appears to indicate alignment. The alignment boundary is a red dashed line. Alignment boundaries appear only when snapping to snaplines is enabled. For an illustration of the artboard that shows an alignment boundary, see Creating a UI by using XAML Designer.

Change an element's margins

The margins in XAML Designer determine the amount of empty space that is around an element on the artboard. For example, margins specify the amount of space between the outside edges of an element and the boundaries of a Grid panel that contains the element. Margins also specify the amount of space between elements that are contained in a StackPanel.

To change an element's margins in the Properties window:

  1. Select the element whose margins you want to change.

  2. Under Layout in the Properties window, change the value (in pixels or device-independent units, which are approximately 1/96 inch) for any of the Margin properties (Top, Left, Right, or Bottom).

Aurora

In the artboard, to change an element's margins relative to the element's layout container, click the margin adorners that appear around the element when the element is selected and is within a layout container. For an illustration that shows margin adorners, see Creating a UI by using XAML Designer.

Xaml Visual Designer

If a margin adorner is open, vertically or horizontally, that margin isn't set. If a margin adorner is closed, that margin is set.

When you open a margin adorner and the opposite margin isn't set, the opposite margin is set to the correct value according to the location of the element in the artboard. For opposite margins, such as the Left and Right margins, at least one property is always set.

Important

Free xaml designer tools

Elements placed inside some layout containers, such as a Canvas, don't have margin adorners. Elements placed inside a StackPanel have margin adorners for either the left and right margins or the top and bottom margins, depending on the orientation of the StackPanel.

Group and ungroup elements

Grouping two or more elements in XAML Designer creates a new layout container and places those elements within that container. Placing two or more elements together in a layout container enables you to easily select, move, and transform the group as if the elements in that group were one element. Grouping is also useful for identifying elements that are related to each other in some way, such as the buttons that make up a navigation element. When you ungroup elements, you are simply deleting the layout container that contained the elements.

To group elements into a new layout container:

  1. Select the elements that you want to group. (To select multiple elements, press and hold the Ctrl key while you click them.)

  2. Right-click the selected elements, point to Group Into, and then click the type of layout container in which you want the group to reside.

    Tip

    If you select Viewbox, Border, or ScrollViewer to group your elements, the elements are placed in a new Grid panel within the Viewbox, Border, or ScrollViewer. If you ungroup elements in one of these layout containers, only the Viewbox, Border, or ScrollViewer is deleted, and the Grid panel remains. To delete the Grid panel, ungroup the elements again.

To ungroup elements and delete the layout, right-click the group that you want to ungroup and click Ungroup. You can also group or ungroup elements by right-clicking selected items in the Document Outline window and clicking Group Into or Ungroup.

Reset the element layout

You can restore default values for specific layout properties of an element by using the Layout Reset commands. By using this command, you can reset the margin, alignment, width, height, and size of an element, either individually or collectively.

Wpf Xaml Designer

To reset the element layout, right-click the element in the Document Outline window or the artboard, and then choose Layout > ResetPropertyName, where PropertyName is the property that you want to reset (or choose Layout > Reset All to reset all the layout properties for the element).

Free Xaml Designer Tools

See also