Skip to content

Commit d89d3cd

Browse files
Merge pull request #94 from SyncfusionExamples/WPF-945926-SampleForCreateNodeusingMultipleSVGPaths
WPF-945926-Need to prepare sample for KB article
2 parents 9a8f709 + af79dcc commit d89d3cd

17 files changed

+780
-0
lines changed
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="NodeCreation.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:NodeCreation"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</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 NodeCreation
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<Window x:Class="NodeCreation.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:NodeCreation"
7+
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
8+
mc:Ignorable="d"
9+
Title="MainWindow" Height="450" WindowState="Maximized" Width="800">
10+
<Window.Resources>
11+
<ResourceDictionary>
12+
<!--Resource Dictionary which contains predefined shapes for Node-->
13+
<ResourceDictionary.MergedDictionaries>
14+
<ResourceDictionary Source="/Syncfusion.SfDiagram.Wpf;component/Resources/BasicShapes.xaml" />
15+
</ResourceDictionary.MergedDictionaries>
16+
17+
18+
<Style TargetType="syncfusion:Node">
19+
<Setter Property="ShapeStyle">
20+
<Setter.Value>
21+
<Style TargetType="Path">
22+
<Setter Property="Fill" Value="#FF5B9BD5"/>
23+
<Setter Property="Stretch" Value="Fill"/>
24+
<Setter Property="Stroke" Value="#FFEDF1F6 "/>
25+
</Style>
26+
</Setter.Value>
27+
</Setter>
28+
</Style>
29+
<DataTemplate x:Key="NodeShape">
30+
<Viewbox Margin="0,0,19.8,14.6">
31+
<Grid Background="Transparent">
32+
<Path Data="m16.6,14.6H2.6L0,.4C0,.2,0,0,.3,0c.2,0,.4,0,.4.3l2.5,13.6h12.8L19.1.7c0-.2.2-.3.4-.3.2,0,.3.2.3.4l-3.2,13.8Z" Fill="#231f20" StrokeThickness="0"/>
33+
<Path Data="m18.3,5.1H1.5c-.2,0-.3-.2-.3-.4s.2-.4.3-.4h16.8c.2,0,.3.2.3.4s-.2.4-.3.4Z" Fill="#231f20" StrokeThickness="0"/>
34+
</Grid>
35+
</Viewbox>
36+
</DataTemplate>
37+
38+
39+
<DataTemplate x:Key="NodeShape1">
40+
<Viewbox>
41+
<Grid Width="76.99" Height="31.364" Margin="0,0,76.99,31.364" Background="Transparent">
42+
<Grid.RenderTransform>
43+
<TranslateTransform X="-922.26" Y="-523.886"/>
44+
</Grid.RenderTransform>
45+
<Path Data="M32.143,31.35H5.065L-.04.723,1.44.477l4.9,29.373H30.857l4.6-29.864,1.482.228Z" Fill="Black">
46+
<Path.RenderTransform>
47+
<TranslateTransform X="922.3" Y="523.9"/>
48+
</Path.RenderTransform>
49+
</Path>
50+
51+
<Path Data="M33,.75H0V-.75H33Z" Fill="Black">
52+
<Path.RenderTransform>
53+
<TranslateTransform X="924.5" Y="533"/>
54+
</Path.RenderTransform>
55+
</Path>
56+
57+
<Path Data="M10,.75H0V-.75H10Z" Fill="Black">
58+
<Path.RenderTransform>
59+
<TranslateTransform X="956.5" Y="539"/>
60+
</Path.RenderTransform>
61+
</Path>
62+
63+
<Path Data="M-.75-.75h33.5v24.5H-.75Zm32,1.5H.75v21.5h30.5Z" Fill="Black">
64+
<Path.RenderTransform>
65+
<TranslateTransform X="966.5" Y="528"/>
66+
</Path.RenderTransform>
67+
</Path>
68+
69+
<Rectangle Width="16" Height="12" Fill="Black">
70+
<Rectangle.RenderTransform>
71+
<TranslateTransform X="966.5" Y="528"/>
72+
</Rectangle.RenderTransform>
73+
</Rectangle>
74+
75+
<Rectangle Width="16" Height="12" Fill="Black">
76+
<Rectangle.RenderTransform>
77+
<TranslateTransform X="982" Y="539.5"/>
78+
</Rectangle.RenderTransform>
79+
</Rectangle>
80+
81+
</Grid>
82+
</Viewbox>
83+
84+
</DataTemplate>
85+
</ResourceDictionary>
86+
</Window.Resources>
87+
88+
<Grid>
89+
<!--Initialize the Sfdiagram-->
90+
<syncfusion:SfDiagram x:Name="diagram">
91+
<syncfusion:SfDiagram.Nodes>
92+
<syncfusion:NodeCollection>
93+
<syncfusion:NodeViewModel ID="Node1" UnitHeight="100" UnitWidth="100" OffsetX="100" OffsetY="200" ContentTemplate="{StaticResource NodeShape}" x:Name="Node1">
94+
95+
</syncfusion:NodeViewModel>
96+
97+
<syncfusion:NodeViewModel ID="Node2" OffsetX="400" OffsetY="200" UnitHeight="80" UnitWidth="150" ContentTemplate="{StaticResource NodeShape1}" x:Name="Node2">
98+
99+
</syncfusion:NodeViewModel>
100+
101+
102+
</syncfusion:NodeCollection>
103+
</syncfusion:SfDiagram.Nodes>
104+
</syncfusion:SfDiagram>
105+
106+
</Grid>
107+
</Window>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using Syncfusion.UI.Xaml.Diagram;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.IO.Packaging;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using System.Windows;
9+
using System.Windows.Controls;
10+
using System.Windows.Data;
11+
using System.Windows.Documents;
12+
using System.Windows.Input;
13+
using System.Windows.Media;
14+
using System.Windows.Media.Imaging;
15+
using System.Windows.Navigation;
16+
using System.Windows.Shapes;
17+
18+
namespace NodeCreation
19+
{
20+
/// <summary>
21+
/// Interaction logic for MainWindow.xaml
22+
/// </summary>
23+
public partial class MainWindow : Window
24+
{
25+
26+
public MainWindow()
27+
{
28+
InitializeComponent();
29+
diagram.SnapSettings = new SnapSettings()
30+
{
31+
SnapConstraints = SnapConstraints.ShowLines,
32+
};
33+
34+
diagram.HorizontalRuler = new Syncfusion.UI.Xaml.Diagram.Controls.Ruler();
35+
diagram.VerticalRuler = new Syncfusion.UI.Xaml.Diagram.Controls.Ruler()
36+
{
37+
Orientation = Orientation.Vertical,
38+
};
39+
40+
41+
42+
}
43+
}
44+
45+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{F0E1D463-A4B1-4BAA-A485-F43D3AE24AB7}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>NodeCreation</RootNamespace>
10+
<AssemblyName>NodeCreation</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<WarningLevel>4</WarningLevel>
15+
<Deterministic>true</Deterministic>
16+
<TargetFrameworkProfile />
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>AnyCPU</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
39+
<Reference Include="System" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Xml" />
42+
<Reference Include="Microsoft.CSharp" />
43+
<Reference Include="System.Core" />
44+
<Reference Include="System.Xml.Linq" />
45+
<Reference Include="System.Data.DataSetExtensions" />
46+
<Reference Include="System.Net.Http" />
47+
<Reference Include="System.Xaml">
48+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
49+
</Reference>
50+
<Reference Include="WindowsBase" />
51+
<Reference Include="PresentationCore" />
52+
<Reference Include="PresentationFramework" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<ApplicationDefinition Include="App.xaml">
56+
<Generator>MSBuild:Compile</Generator>
57+
<SubType>Designer</SubType>
58+
</ApplicationDefinition>
59+
<Page Include="MainWindow.xaml">
60+
<Generator>MSBuild:Compile</Generator>
61+
<SubType>Designer</SubType>
62+
</Page>
63+
<Compile Include="App.xaml.cs">
64+
<DependentUpon>App.xaml</DependentUpon>
65+
<SubType>Code</SubType>
66+
</Compile>
67+
<Compile Include="MainWindow.xaml.cs">
68+
<DependentUpon>MainWindow.xaml</DependentUpon>
69+
<SubType>Code</SubType>
70+
</Compile>
71+
</ItemGroup>
72+
<ItemGroup>
73+
<Compile Include="Properties\AssemblyInfo.cs">
74+
<SubType>Code</SubType>
75+
</Compile>
76+
<Compile Include="Properties\Resources.Designer.cs">
77+
<AutoGen>True</AutoGen>
78+
<DesignTime>True</DesignTime>
79+
<DependentUpon>Resources.resx</DependentUpon>
80+
</Compile>
81+
<Compile Include="Properties\Settings.Designer.cs">
82+
<AutoGen>True</AutoGen>
83+
<DependentUpon>Settings.settings</DependentUpon>
84+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
85+
</Compile>
86+
<EmbeddedResource Include="Properties\Resources.resx">
87+
<Generator>ResXFileCodeGenerator</Generator>
88+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
89+
</EmbeddedResource>
90+
91+
<None Include="Properties\Settings.settings">
92+
<Generator>SettingsSingleFileGenerator</Generator>
93+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
94+
</None>
95+
</ItemGroup>
96+
<ItemGroup>
97+
<None Include="App.config" />
98+
<PackageReference Include="Syncfusion.SfDiagram.WPF" Version="*" />
99+
</ItemGroup>
100+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
101+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35209.166
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultipleSVGpaths_462", "MultipleSVGpaths_462.csproj", "{F0E1D463-A4B1-4BAA-A485-F43D3AE24AB7}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{F0E1D463-A4B1-4BAA-A485-F43D3AE24AB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{F0E1D463-A4B1-4BAA-A485-F43D3AE24AB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{F0E1D463-A4B1-4BAA-A485-F43D3AE24AB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{F0E1D463-A4B1-4BAA-A485-F43D3AE24AB7}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {E06219EB-8A4F-4640-9802-FFA79F15C0FF}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>WinExe</OutputType>
4+
<TargetFramework>net6.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>NodeCreation</AssemblyName>
11+
<RootNamespace>NodeCreation</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+
56+
<None Remove="Properties\Settings.settings" />
57+
<None Include="Properties\Settings.settings" />
58+
<None Remove="App.config" />
59+
<None Include="App.config" />
60+
<ApplicationDefinition Include="App.xaml" />
61+
<Compile Include="App.xaml.cs" />
62+
<Compile Include="MainWindow.xaml.cs" />
63+
<PackageReference Include="Syncfusion.SfDiagram.WPF" Version="*" />
64+
<Page Include="MainWindow.xaml">
65+
<Generator>MSBuild:Compile</Generator>
66+
</Page>
67+
</ItemGroup>
68+
</Project>

0 commit comments

Comments
 (0)