<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>
我有一个WPF项目,其中引用了这个dll。我可以在C#中使用netstandard dll的类,也可以在xaml中使用它们。我甚至可以得到它们的智能提示。但是xaml设计师说我的xaml无效。我可以编译解决方案,运行应用程序。运行时一切正常。但是设计师无法使用它。
Person类如下:
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;
}
}
}
你知道有什么解决方法,或者有什么想法,可以帮助我纠正这个问题吗?