Skip to content

Commit

Permalink
Fix bindings that are not working with net6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperSK committed Aug 26, 2022
1 parent 31c8005 commit dd5117f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0-windows;net6.0-windows</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<AssemblyName>Caliburn.Micro.Platform.Core</AssemblyName>
<RootNamespace>Caliburn.Micro</RootNamespace>
<AssemblyOriginatorKeyFile>.\..\Caliburn.Micro.snk</AssemblyOriginatorKeyFile>
Expand Down
11 changes: 1 addition & 10 deletions src/Caliburn.Micro.Platform/ActionMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
using Microsoft.Xaml.Behaviors;
using EventTrigger = Microsoft.Xaml.Behaviors.EventTrigger;
#endif
#if NET5_0_WINDOWS || NET6_0_WINDOWS
using System.IO;
using System.Xml;
#endif


/// <summary>
/// Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked.
Expand Down Expand Up @@ -205,12 +202,6 @@ void ElementLoaded(object sender, RoutedEventArgs e) {
var binding = new Binding {
Source = currentElement
};
#elif NET5_0_WINDOWS || NET6_0_WINDOWS
const string bindingText = "<Binding xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation\' xmlns:cal='clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro.Platform' Path='(cal:Message.Handler)' />";
StringReader stringReader = new StringReader(bindingText);
XmlReader xmlReader = XmlReader.Create(stringReader);
var binding = (Binding)XamlReader.Load(xmlReader);
binding.Source = currentElement;
#else
const string bindingText = "<Binding xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation\' xmlns:cal='clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro.Platform' Path='(cal:Message.Handler)' />";

Expand Down
5 changes: 4 additions & 1 deletion src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<PropertyGroup Condition="$(TargetFramework.StartsWith('netcore'))">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net5.0'))">
<PropertyGroup Condition="$(TargetFramework.StartsWith('net5.0'))">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0'))">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
Expand Down

0 comments on commit dd5117f

Please sign in to comment.