Skip to content

Commit eafab70

Browse files
Merge pull request #104 from SyncfusionExamples/WPF-1045773_To_prepare_sample_for_GroupSnapping
WPF-1045773-Need to prepare a sample for Group Snapping
2 parents 01aa97e + e1cd9d6 commit eafab70

23 files changed

Lines changed: 1284 additions & 32 deletions

Samples/Automatic Layout/Force Directed Tree layout/ForceDirectedTreeCodeBehind/MainWindow.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public MainWindow()
4747
CreatedNode();
4848
Diagram.LayoutManager = new LayoutManager()
4949
{
50-
Layout = new ForceDirectedTree()
50+
Layout = new ForceDirectedTreeLayout()
5151
{
5252
AttractionStrength = 0.6,
5353
RepulsionStrength = 25000,
@@ -197,19 +197,19 @@ private ConnectorViewModel Edge(string sourceId, string targetId)
197197
private void UpDown_ValueChanged_1(DependencyObject d, DependencyPropertyChangedEventArgs e)
198198
{
199199
if (Diagram.LayoutManager != null)
200-
(Diagram.LayoutManager.Layout as ForceDirectedTree).MaximumIteration = (int)(double)e.NewValue;
200+
(Diagram.LayoutManager.Layout as ForceDirectedTreeLayout).MaximumIteration = (int)(double)e.NewValue;
201201
}
202202

203203
private void UpDown_ValueChanged_2(DependencyObject d, DependencyPropertyChangedEventArgs e)
204204
{
205205
if (Diagram.LayoutManager != null)
206-
(Diagram.LayoutManager.Layout as ForceDirectedTree).RepulsionStrength = (int)(double)e.NewValue;
206+
(Diagram.LayoutManager.Layout as ForceDirectedTreeLayout).RepulsionStrength = (int)(double)e.NewValue;
207207
}
208208

209209
private void UpDown_ValueChanged_3(DependencyObject d, DependencyPropertyChangedEventArgs e)
210210
{
211211
if (Diagram.LayoutManager != null)
212-
(Diagram.LayoutManager.Layout as ForceDirectedTree).AttractionStrength = (double)e.NewValue;
212+
(Diagram.LayoutManager.Layout as ForceDirectedTreeLayout).AttractionStrength = (double)e.NewValue;
213213
}
214214
}
215215

Samples/Automatic Layout/Force Directed Tree layout/ForceDirectedTreeDataSource/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
Value="{Binding MaximumIteration, Mode=TwoWay}"/>
114114

115115
<TextBlock Margin="10,5,0,0" Grid.Row="2" Grid.Column="0" Text="Repulsion Strength" Height="25" VerticalAlignment="Center"/>
116-
<Syncfusion:UpDown x:Name="repulsionstrength" MinValue="25000" Margin="5,5,0,0" Grid.Row="2" Grid.Column="1" Step="250" MaxValue="30000"
116+
<Syncfusion:UpDown x:Name="repulsionstrength" MinValue="25000" Margin="5,5,0,0" Grid.Row="2" Grid.Column="1" Step="250" MaxValue="33000"
117117
Value="{Binding RepulsionStrength, Mode=TwoWay}" />
118118

119119
<TextBlock Grid.Row="3" Grid.Column="0" Text="Attraction strength" Height="26" VerticalAlignment="Center" HorizontalAlignment="Right" Width="120"/>

Samples/Automatic Layout/Force Directed Tree layout/ForceDirectedTreeDataSource/ViewModel/ForceDirectedViewModel.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ public class ForceDirectedViewModel : DiagramViewModel
3030
/// <summary>
3131
/// Gets or sets the value for the Lenght of the Connectors
3232
/// </summary>
33-
public double ConnectorLength
34-
{
35-
get
36-
{
37-
return _connectorlength;
38-
}
39-
set
40-
{
41-
if (!_connectorlength.Equals(value))
42-
{
43-
_connectorlength = value;
44-
45-
OnPropertyChanged(nameof(ConnectorLength));
46-
(this.LayoutManager.Layout as ForceDirectedTree).ConnectorLength = value;
47-
}
48-
}
49-
}
33+
//public double ConnectorLength
34+
//{
35+
// get
36+
// {
37+
// return _connectorlength;
38+
// }
39+
// set
40+
// {
41+
// if (!_connectorlength.Equals(value))
42+
// {
43+
// _connectorlength = value;
44+
45+
// OnPropertyChanged(nameof(ConnectorLength));
46+
// (this.LayoutManager.Layout as ForceDirectedTreeLayout).ConnectorLength = value;
47+
// }
48+
// }
49+
//}
5050

5151
/// <summary>
5252
/// Gets or sets the value for the AttractionStrength
@@ -63,7 +63,7 @@ public double AttractionStrength
6363
{
6464
attractionStrength = value;
6565
OnPropertyChanged(nameof(AttractionStrength));
66-
(this.LayoutManager.Layout as ForceDirectedTree).AttractionStrength = value;
66+
(this.LayoutManager.Layout as ForceDirectedTreeLayout).AttractionStrength = value;
6767
}
6868
}
6969
}
@@ -83,7 +83,7 @@ public int RepulsionStrength
8383
{
8484
repulsionStrength = value;
8585
OnPropertyChanged(nameof(RepulsionStrength));
86-
(this.LayoutManager.Layout as ForceDirectedTree).RepulsionStrength = value;
86+
(this.LayoutManager.Layout as ForceDirectedTreeLayout).RepulsionStrength = value;
8787
}
8888
}
8989
}
@@ -103,7 +103,7 @@ public int MaximumIteration
103103
{
104104
maxIteration = value;
105105
OnPropertyChanged(nameof(MaximumIteration));
106-
(this.LayoutManager.Layout as ForceDirectedTree).MaximumIteration = value;
106+
(this.LayoutManager.Layout as ForceDirectedTreeLayout).MaximumIteration = value;
107107
}
108108
}
109109
}
@@ -136,7 +136,7 @@ public ForceDirectedViewModel()
136136
// Initialize the Layout Manager
137137
LayoutManager = new LayoutManager()
138138
{
139-
Layout = new ForceDirectedTree()
139+
Layout = new ForceDirectedTreeLayout()
140140
{
141141
AttractionStrength = 0.6,
142142
RepulsionStrength = 25000,

Samples/Automatic Layout/Force Directed Tree layout/ForceDirectedTreeView/MainWindow.xaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ private void UpDown_ValueChanged_1(DependencyObject d, DependencyPropertyChanged
4949
{
5050
if (temp)
5151
{
52-
if ((Diagram.LayoutManager.Layout as ForceDirectedTree).MaximumIteration != (int)(double)e.NewValue)
53-
(Diagram.LayoutManager.Layout as ForceDirectedTree).MaximumIteration = (int)(double)e.NewValue;
52+
if ((Diagram.LayoutManager.Layout as ForceDirectedTreeLayout).MaximumIteration != (int)(double)e.NewValue)
53+
(Diagram.LayoutManager.Layout as ForceDirectedTreeLayout).MaximumIteration = (int)(double)e.NewValue;
5454
}
5555
}
5656

5757
private void UpDown_ValueChanged_2(DependencyObject d, DependencyPropertyChangedEventArgs e)
5858
{
5959
if (temp)
6060
{
61-
if ((Diagram.LayoutManager.Layout as ForceDirectedTree).RepulsionStrength != (int)(double)e.NewValue)
62-
(Diagram.LayoutManager.Layout as ForceDirectedTree).RepulsionStrength = (int)(double)e.NewValue;
61+
if ((Diagram.LayoutManager.Layout as ForceDirectedTreeLayout).RepulsionStrength != (int)(double)e.NewValue)
62+
(Diagram.LayoutManager.Layout as ForceDirectedTreeLayout).RepulsionStrength = (int)(double)e.NewValue;
6363
}
6464
}
6565

6666
private void UpDown_ValueChanged_3(DependencyObject d, DependencyPropertyChangedEventArgs e)
6767
{
6868
if (temp)
6969
{
70-
if ((Diagram.LayoutManager.Layout as ForceDirectedTree).AttractionStrength != (double)e.NewValue)
71-
(Diagram.LayoutManager.Layout as ForceDirectedTree).AttractionStrength = (double)e.NewValue;
70+
if ((Diagram.LayoutManager.Layout as ForceDirectedTreeLayout).AttractionStrength != (double)e.NewValue)
71+
(Diagram.LayoutManager.Layout as ForceDirectedTreeLayout).AttractionStrength = (double)e.NewValue;
7272
}
7373
}
7474
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
5+
</startup>
6+
</configuration>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Application x:Class="GroupSnapping.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:GroupSnapping"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="/Syncfusion.SfDiagram.Wpf;component/Resources/BasicShapes.xaml"/>
10+
</ResourceDictionary.MergedDictionaries>
11+
</ResourceDictionary>
12+
</Application.Resources>
13+
</Application>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace GroupSnapping
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>WinExe</OutputType>
4+
<TargetFramework>net10.0-windows</TargetFramework>
5+
<UseWindowsForms>true</UseWindowsForms>
6+
<UseWPF>true</UseWPF>
7+
<EnableDefaultEmbeddedResourceItems>False</EnableDefaultEmbeddedResourceItems>
8+
<EnableDefaultItems>false</EnableDefaultItems>
9+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
10+
<AssemblyName>GroupSnapping</AssemblyName>
11+
<RootNamespace>GroupSnapping</RootNamespace>
12+
</PropertyGroup>
13+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
14+
<DefineConstants>TRACE;NET50</DefineConstants>
15+
</PropertyGroup>
16+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
17+
<DefineConstants>TRACE;NET50</DefineConstants>
18+
</PropertyGroup>
19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Xml|AnyCPU'">
20+
<DefineConstants>TRACE;NET50</DefineConstants>
21+
</PropertyGroup>
22+
<ItemGroup>
23+
<Compile Remove="obj\**" />
24+
<Compile Remove="obj_45\**" />
25+
<Compile Remove="obj_462\**" />
26+
<Compile Remove="obj_50\**" />
27+
<Compile Remove="obj_60\**" />
28+
<Compile Remove="obj_70\**" />
29+
<Compile Remove="obj_80\**" />
30+
<Compile Remove="obj_90\**" />
31+
<EmbeddedResource Remove="obj\**" />
32+
<EmbeddedResource Remove="obj_45\**" />
33+
<EmbeddedResource Remove="obj_462\**" />
34+
<EmbeddedResource Remove="obj_50\**" />
35+
<EmbeddedResource Remove="obj_60\**" />
36+
<EmbeddedResource Remove="obj_70\**" />
37+
<EmbeddedResource Remove="obj_80\**" />
38+
<EmbeddedResource Remove="obj_90\**" />
39+
<None Remove="obj\**" />
40+
<None Remove="obj_45\**" />
41+
<None Remove="obj_462\**" />
42+
<None Remove="obj_50\**" />
43+
<None Remove="obj_60\**" />
44+
<None Remove="obj_70\**" />
45+
<None Remove="obj_80\**" />
46+
<None Remove="obj_90\**" />
47+
<Page Remove="obj\**" />
48+
<Page Remove="obj_45\**" />
49+
<Page Remove="obj_462\**" />
50+
<Page Remove="obj_50\**" />
51+
<Page Remove="obj_60\**" />
52+
<None Remove="obj_70\**" />
53+
<None Remove="obj_80\**" />
54+
<None Remove="obj_90\**" />
55+
<None Remove="App.config" />
56+
<Compile Remove="App.xaml.cs" />
57+
<None Remove="GroupSnapping_472.slnx" />
58+
<ApplicationDefinition Include="App.xaml" />
59+
<Compile Include="App.xaml.cs" />
60+
<Compile Include="MainWindow.xaml.cs" />
61+
<Compile Include="ViewModel\SnappingViewModel.cs" />
62+
</ItemGroup>
63+
<ItemGroup>
64+
<Page Include="MainWindow.xaml">
65+
<Generator>MSBuild:Compile</Generator>
66+
</Page>
67+
<PackageReference Include="Syncfusion.Licensing" Version="*" />
68+
<PackageReference Include="Syncfusion.SfDiagram.WPF" Version="*" />
69+
<PackageReference Include="Syncfusion.Shared.WPF" Version="*" />
70+
</ItemGroup>
71+
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="GroupSnapping_10.0.csproj" />
3+
</Solution>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net472</TargetFramework>
6+
<UseWPF>true</UseWPF>
7+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8+
<LangVersion>latest</LangVersion>
9+
<RootNamespace>GroupSnapping</RootNamespace>
10+
<AssemblyName>GroupSnapping</AssemblyName>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Syncfusion.Licensing" Version="*" />
15+
<PackageReference Include="Syncfusion.SfDiagram.WPF" Version="*" />
16+
<PackageReference Include="Syncfusion.Shared.WPF" Version="*" />
17+
</ItemGroup>
18+
19+
</Project>

0 commit comments

Comments
 (0)