-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainWindow.xaml
43 lines (43 loc) · 2.88 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DiagramNestedItemsExample"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxdiag="http://schemas.devexpress.com/winfx/2008/xaml/diagram" x:Class="DiagramNestedItemsExample.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="900" Width="1000">
<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>
<Window.Resources>
<local:MyKeySelector x:Key="myKeySelector"/>
<local:DiagramItemTemplateSelector x:Key="diagramItemTemplateSelector">
<local:DiagramItemTemplateSelector.DepartmentTemplate>
<DataTemplate>
<dxdiag:DiagramList CanCollapse="True" Height="120" Width="120" ItemsCanMove="False" ShowHeader="True" Header="{Binding DepartmentName}" ItemsCanSelect="False" DragMode="ByAnyPoint" CanAttachConnectorEndPoint="False" CanAttachConnectorBeginPoint="False"/>
</DataTemplate>
</local:DiagramItemTemplateSelector.DepartmentTemplate>
<local:DiagramItemTemplateSelector.EmployeeTemplate>
<DataTemplate>
<dxdiag:DiagramShape Background="Green" Content="{Binding EmployeeName}" Height="30" ConnectionPoints="0,0.5 1,0.5"/>
</DataTemplate>
</local:DiagramItemTemplateSelector.EmployeeTemplate>
</local:DiagramItemTemplateSelector>
<DataTemplate x:Key="connectorTemplate">
<dxdiag:DiagramConnector CanEdit="False" BeginPointRestrictions="KeepConnected" EndPointRestrictions="KeepConnected">
</dxdiag:DiagramConnector>
</DataTemplate>
</Window.Resources>
<Grid>
<dxdiag:DiagramControl ConnectorsSeparationMode="AllLines" SelectedStencils="BasicShapes, BasicFlowchartShapes"
SugiyamaLayoutColumnSpacing="300"
SugiyamaLayoutLayerSpacing="400"
SugiyamaLayoutDirection="LeftToRight" SugiyamaLayoutLayersAlignment="Center">
<dxmvvm:Interaction.Behaviors>
<dxdiag:DiagramDataBindingBehavior LayoutKind="Sugiyama" ItemsPath="Employees" ConnectorFromMember="FromEmployeeID" ConnectorToMember="ToEmployeeID" KeySelector="{StaticResource myKeySelector}" ItemTemplateSelector="{StaticResource diagramItemTemplateSelector}" ConnectorTemplate="{StaticResource connectorTemplate}" ItemsSource="{Binding Departments}" ConnectorsSource="{Binding Relations}"/>
</dxmvvm:Interaction.Behaviors>
</dxdiag:DiagramControl>
</Grid>
</Window>