Skip to content

Commit 92d2717

Browse files
authored
Merge pull request #70 from icsharpcode/feature/net5
Feature/net5
2 parents 5f68f0a + bed1d1c commit 92d2717

File tree

20 files changed

+317
-302
lines changed

20 files changed

+317
-302
lines changed

MyDesigner/Demo.MyDesigner.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>WinExe</OutputType>
4-
<TargetFramework>net45</TargetFramework>
4+
<TargetFramework>net5.0-windows</TargetFramework>
55
<UseWPF>true</UseWPF>
66
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
77
<ApplicationIcon />

MyTestAssembly/Demo.MyTestAssembly.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4-
<TargetFramework>net45</TargetFramework>
4+
<TargetFramework>net5.0-windows</TargetFramework>
55
<UseWPF>true</UseWPF>
66
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
77
</PropertyGroup>

SimpleSample/Demo.SimpleSample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFrameworks>netcoreapp3.0;net45</TargetFrameworks>
4+
<TargetFrameworks>net5.0-windows</TargetFrameworks>
55
<UseWPF>true</UseWPF>
66
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
77
</PropertyGroup>

WpfDesign.Design.ExpressionBlendInteractionAddon/WpfDesign.Designer.ExpressionBlendInteractionAddon.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4-
<TargetFramework>net45</TargetFramework>
4+
<TargetFrameworks>net45;net5.0-windows</TargetFrameworks>
55
<UseWPF>true</UseWPF>
66
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
77
<AssemblyName>ICSharpCode.WpfDesign.Designer.ExpressionBlendInteractionAddon</AssemblyName>
@@ -11,7 +11,7 @@
1111
<Compile Include="..\GlobalAssemblyInfo.cs" Link="Properties\GlobalAssemblyInfo.cs" />
1212
</ItemGroup>
1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.0.1" />
14+
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
1515
</ItemGroup>
1616
<ItemGroup>
1717
<ProjectReference Include="..\WpfDesign.Designer\Project\WpfDesign.Designer.csproj" />

WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,16 @@ private IEnumerable<DesignItem> AllDesignItems(DesignItem designItem = null)
332332
}
333333
}
334334
}
335+
336+
/// <summary>
337+
/// Method Returns the DesignItems for wich Snaplines are created
338+
/// </summary>
339+
/// <param name="operation"></param>
340+
/// <returns></returns>
341+
protected IEnumerable<DesignItem> GetSnapToDesignItems(PlacementOperation operation)
342+
{
343+
return AllDesignItems();
344+
}
335345

336346
void BuildMaps(PlacementOperation operation)
337347
{
@@ -351,7 +361,7 @@ void BuildMaps(PlacementOperation operation)
351361
if (!CanPlace(operation.PlacedItems.Select(x => x.Item), operation.Type, PlacementAlignment.Center))
352362
return;
353363

354-
foreach (var item in AllDesignItems()
364+
foreach (var item in GetSnapToDesignItems(operation)
355365
.Except(operation.PlacedItems.Select(f => f.Item))
356366
.Where(x=> x.View != null && !GetDisableSnaplines(x.View))) {
357367
if (item != null) {

WpfDesign.Designer/Project/WpfDesign.Designer.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4-
<TargetFrameworks>netcoreapp3.0;net45</TargetFrameworks>
4+
<TargetFrameworks>net45;net5.0-windows</TargetFrameworks>
55
<UseWPF>true</UseWPF>
66
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
77
<AssemblyName>ICSharpCode.WpfDesign.Designer</AssemblyName>
8-
<DocumentationFile>..\..\bin\netcoreapp3.0\ICSharpCode.WpfDesign.Designer.xml</DocumentationFile>
8+
<DocumentationFile>..\..\bin\net5.0-windows\ICSharpCode.WpfDesign.Designer.xml</DocumentationFile>
99
<OutputPath>..\..\bin\</OutputPath>
1010
</PropertyGroup>
1111
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">

WpfDesign.Designer/Tests/WpfDesign.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
44
<TargetFramework>net45</TargetFramework>
@@ -7,8 +7,8 @@
77
<AssemblyName>ICSharpCode.WpfDesign.Tests</AssemblyName>
88
</PropertyGroup>
99
<ItemGroup>
10-
<PackageReference Include="NUnit" Version="3.11.0" />
11-
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
10+
<PackageReference Include="NUnit" Version="3.13.1" />
11+
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
1212
<PackageReference Include="RhinoMocks" Version="3.6.1" />
1313
</ItemGroup>
1414
<ItemGroup>

WpfDesign.XamlDom/Project/PositionXmlDocument.cs

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -147,28 +147,62 @@ public override void WriteTo(XmlWriter w)
147147
if (xmlWriterField != null)
148148
{
149149
var xmlwriter = xmlWriterField.GetValue(w);
150+
150151
var rawTextWPrp = xmlwriter.GetType()
151152
.GetProperty("InnerWriter", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
152-
var rawTextW = rawTextWPrp.GetValue(xmlwriter, null);
153-
var bufCharsField = rawTextW.GetType()
154-
.GetField("bufChars", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
155-
var contentPosField = rawTextW.GetType()
156-
.GetField("contentPos", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
157-
var buffPosField = rawTextW.GetType()
158-
.GetField("bufPos", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
159-
var ioTextWriterField = rawTextW.GetType()
160-
.GetField("writer", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
161-
var ioTextWriter = ioTextWriterField.GetValue(rawTextW);
162-
var sbField = ioTextWriter.GetType()
163-
.GetField("_sb", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
164-
positionXmlDocument.writerSb = sbField.GetValue(ioTextWriter) as StringBuilder;
165-
166-
positionXmlDocument.bufGetter =
167-
Expression.Lambda<Func<char[]>>(Expression.Field(Expression.Constant(rawTextW), bufCharsField)).Compile();
168-
positionXmlDocument.contentPosFieldGetter =
169-
Expression.Lambda<Func<int>>(Expression.Field(Expression.Constant(rawTextW), contentPosField)).Compile();
170-
positionXmlDocument.buffPosGetter =
171-
Expression.Lambda<Func<int>>(Expression.Field(Expression.Constant(rawTextW), buffPosField)).Compile();
153+
if (rawTextWPrp != null)
154+
{
155+
var rawTextW = rawTextWPrp.GetValue(xmlwriter, null);
156+
var bufCharsField = rawTextW.GetType()
157+
.GetField("bufChars", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
158+
var contentPosField = rawTextW.GetType()
159+
.GetField("contentPos", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
160+
var buffPosField = rawTextW.GetType()
161+
.GetField("bufPos", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
162+
var ioTextWriterField = rawTextW.GetType()
163+
.GetField("writer", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
164+
var ioTextWriter = ioTextWriterField.GetValue(rawTextW);
165+
var sbField = ioTextWriter.GetType()
166+
.GetField("_sb", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
167+
positionXmlDocument.writerSb = sbField.GetValue(ioTextWriter) as StringBuilder;
168+
169+
positionXmlDocument.bufGetter =
170+
Expression.Lambda<Func<char[]>>(Expression.Field(Expression.Constant(rawTextW), bufCharsField)).Compile();
171+
positionXmlDocument.contentPosFieldGetter =
172+
Expression.Lambda<Func<int>>(Expression.Field(Expression.Constant(rawTextW), contentPosField)).Compile();
173+
positionXmlDocument.buffPosGetter =
174+
Expression.Lambda<Func<int>>(Expression.Field(Expression.Constant(rawTextW), buffPosField)).Compile();
175+
}
176+
else
177+
{
178+
179+
rawTextWPrp = xmlwriter.GetType()
180+
.GetProperty("RawWriter", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
181+
if (rawTextWPrp != null)
182+
{
183+
var rawTextW = rawTextWPrp.GetValue(xmlwriter, null);
184+
var bufCharsField = rawTextW.GetType()
185+
.GetField("_bufChars", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
186+
var contentPosField = rawTextW.GetType()
187+
.GetField("_contentPos", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
188+
var buffPosField = rawTextW.GetType()
189+
.GetField("_bufPos", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
190+
var ioTextWriterField = rawTextW.GetType()
191+
.GetField("_writer", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
192+
var ioTextWriter = ioTextWriterField.GetValue(rawTextW);
193+
var sbField = ioTextWriter.GetType()
194+
.GetField("_sb", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
195+
positionXmlDocument.writerSb = sbField.GetValue(ioTextWriter) as StringBuilder;
196+
197+
positionXmlDocument.bufGetter =
198+
Expression.Lambda<Func<char[]>>(Expression.Field(Expression.Constant(rawTextW), bufCharsField)).Compile();
199+
positionXmlDocument.contentPosFieldGetter =
200+
Expression.Lambda<Func<int>>(Expression.Field(Expression.Constant(rawTextW), contentPosField)).Compile();
201+
positionXmlDocument.buffPosGetter =
202+
Expression.Lambda<Func<int>>(Expression.Field(Expression.Constant(rawTextW), buffPosField)).Compile();
203+
}
204+
}
205+
172206
}
173207
}
174208
catch(Exception)

WpfDesign.XamlDom/Project/WpfDesign.XamlDom.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4-
<TargetFrameworks>netcoreapp3.0;net45</TargetFrameworks>
5-
<DocumentationFile>..\..\bin\netcoreapp3.0\ICSharpCode.WpfDesign.XamlDom.xml</DocumentationFile>
4+
<TargetFrameworks>net45;net5.0-windows</TargetFrameworks>
5+
<DocumentationFile>..\..\bin\net5.0-windows\ICSharpCode.WpfDesign.XamlDom.xml</DocumentationFile>
66
<OutputPath>..\..\bin\</OutputPath>
77
<UseWPF>true</UseWPF>
88
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

WpfDesign/Project/WpfDesign.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4-
<TargetFrameworks>netcoreapp3.0;net45</TargetFrameworks>
5-
<DocumentationFile>..\..\bin\netcoreapp3.0\ICSharpCode.WpfDesign.xml</DocumentationFile>
4+
<TargetFrameworks>net45;net5.0-windows</TargetFrameworks>
5+
<DocumentationFile>..\..\bin\net5.0-windows\ICSharpCode.WpfDesign.xml</DocumentationFile>
66
<OutputPath>..\..\bin\</OutputPath>
77
<UseWPF>true</UseWPF>
88
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

0 commit comments

Comments
 (0)