I've made a netstandard class library. I target netstandard 1.6. My csproj is like:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Xml" Version="4.3.0" />
</ItemGroup>
</Project>
And I have a WPF-Project, in which I reference this dll. I can use the classes of the netstandard dll in c#. I can use them in xaml, too. I get even intellicence for them. But xaml designer says, my xaml is invalid. I can compile the solution, I can run the application. At runtime is everything ok. But the designer cannot work with it.
The Person class looks like:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
namespace DS.Publications.Common
{
[DataContract(Namespace = Constants.NamespaceConstants.DataContractNamespace)]
public class Person : INotifyPropertyChanged
{
private string _Title = string.Empty;
[DataMember]
public string Title { get { return _Title; } set { Set(ref _Title, value); } }
private string _ForeName;
[DataMember]
public string ForeName { get { return _ForeName; } set { Set(ref _ForeName, value); } }
private string _LastName;
[DataMember]
public string LastName { get { return _LastName; } set { Set(ref _LastName, value); } }
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private bool Set<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (field == null || !field.Equals(value))
{
field = value;
this.OnPropertyChanged(propertyName);
return true;
}
return false;
}
}
}
Do you know a workaround, or do you have an idea, how can I correct it?