DiagramLite Programmer's Guide
Getting Started

Creating a new Silverlight Application using Microsoft Visual Studio 2008

 You need the following components:

• Silverlight version 2.
• Silverlight Tools for Visual Studio 2008.
• Visual Studio 2008 SP1.

There are App.xaml and Page.xaml files in the Solution Explorer. In App.xaml, you can specify resources and code that applies to the entire application. Page.xaml defines a page, similar to a page in a Web site.

  1. Expand the Page.xaml node.
    Page.xaml.vb or Page.xaml.cs is the code-behind file for your managed code.

Add the  DiagramLite control to the Visual Studio Toolbox

Add references to the required assembly to your project

The next steps are optional, but recommended:

Add the Diagram control to the Silverlight application

Markup is added to XAML view  Copy Code

<my:Diagram></my:Diagram>


Create an instance of the Diagram control

Page.xaml  Copy Code
<my:Diagram AlignToGrid="True" Behavior="LinkShapes" AllowInplaceEdit="True" LinkBrush="Green" ShapeBrush="LightSkyBlue" x:Name="DiagramLite"></my:Diagram>

You can reference the control in XAML later in the code-behind file through the name specified by the x:Name attribute in the XAML declaration.

In the Solution Explorer, right-click the project and select View in Browser.
You can draw nodes and links to create a diagram by using the default values.

Set the properties of the DiagramLite control

In the Page.xaml file, set the properties of your diagram as desired.

 Note

In the Visual Studio main menu, select Tools > Options > Text Editor > XAML. Check the 'Word wrap" setting.

Set the AlignToGrid property to trueAllowInplaceEdit to true. For more information, see Diagram properties

Now you can draw a diagram in a Silverlight application in the browser.