# diagram-getting-started

> SfDiagram with RibbonWindow toolbar, shapes with ports and connection handles.

**Framework:** wpf  **Component:** Diagram  **Variant:** getting-started

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/wpf/diagram-getting-started.json
```

**Install Package(s)**

```bash
dotnet add package Syncfusion.SfDiagram.WPF
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/diagram-getting-started/Diagram.xaml

```xaml
<UserControl
    x:Class="GettingStarted.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
    xmlns:local="clr-namespace:GettingStarted"
    mc:Ignorable="d"
    d:DesignHeight="450" d:DesignWidth="800">

    <UserControl.DataContext>
        <local:GettingStartedDataSource />
    </UserControl.DataContext>

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Syncfusion.SfDiagram.WPF;component/Resources/BasicShapes.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="syncfusion:NodePort">
                <Setter Property="UnitHeight" Value="8" />
                <Setter Property="UnitWidth" Value="8" />
                <Setter Property="Shape">
                    <Setter.Value>
                        <RectangleGeometry Rect="10,10,10,10" />
                    </Setter.Value>
                </Setter>
            </Style>

            <!--
                Style for the nodes. The ShapeStyle supplies the fill and the stroke
                for the shape markup that the data source assigns to every node; a
                node without a ShapeStyle renders its annotation but no body.
            -->
            <!--<Style TargetType="syncfusion:Node">
                <Setter Property="ShapeStyle">
                    <Setter.Value>
                        <Style TargetType="Path">
                            <Setter Property="Fill" Value="#5B9BD5" />
                            <Setter Property="Stretch" Value="Fill" />
                            <Setter Property="Stroke" Value="#41719C" />
                            <Setter Property="StrokeThickness" Value="1" />
                        </Style>
                    </Setter.Value>
                </Setter>
            </Style>-->
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="8*" />
        </Grid.ColumnDefinitions>

        <!-- Diagram ribbon provides the common editing toolbar for the diagram. -->
        <syncfusion:SfDiagramRibbon x:Name="diagramRibbon"
                                     DataContext="{Binding ElementName=diagramControl}"
                                     Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" />

        <!-- The diagram itself. Nodes and connectors are supplied by GettingStartedDataSource. -->
        <syncfusion:SfDiagram x:Name="diagramControl"
                              Grid.Row="1" Grid.Column="1"
                              Margin="-1"
                              DefaultConnectorType="{Binding DefaultConnectorType}"
                              Constraints="{Binding Constraints}"
                              Tool="{Binding Tool}"
                              Nodes="{Binding Nodes}"
                              Connectors="{Binding Connectors}">
            <syncfusion:SfDiagram.Theme>
                <syncfusion:OfficeTheme/>
            </syncfusion:SfDiagram.Theme>
            <syncfusion:SfDiagram.ScrollSettings>
                <syncfusion:ScrollSettings ScrollLimit="Diagram" />
            </syncfusion:SfDiagram.ScrollSettings>

            <syncfusion:SfDiagram.PageSettings>
                <syncfusion:PageSettings PageBorderBrush="White" PageBackground="White" />
            </syncfusion:SfDiagram.PageSettings>

            <syncfusion:SfDiagram.SnapSettings>
                <syncfusion:SnapSettings SnapConstraints="All" SnapToObject="All" />
            </syncfusion:SfDiagram.SnapSettings>

            <syncfusion:SfDiagram.HorizontalRuler>
                <syncfusion:Ruler Orientation="Horizontal" />
            </syncfusion:SfDiagram.HorizontalRuler>

            <syncfusion:SfDiagram.VerticalRuler>
                <syncfusion:Ruler Orientation="Vertical" />
            </syncfusion:SfDiagram.VerticalRuler>
        </syncfusion:SfDiagram>
    </Grid>
</UserControl>

```
