.NET Standard Class Library mentioned in WPF - Sign Error in XAML during Development

I created a netstandard class library. I am targeting netstandard 1.6. My csproj looks 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 netstandard dll classes in C #. I can use them in xaml too. I get for them even subtlety. But the xaml constructor says my xaml is not valid. I can compile the solution, I can run the application. During operation, everything is in order. But the designer cannot work with it.

enter image description here

The Person class looks like this:

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 I can fix it?

+4
source share
2 answers

... netstandard netstandard1.3. 1.3 . , VS-Update.

PS. netstandard1.3, , netstandard1.6 , , : .

0

; .NET Standard Project ListBox, Observable Collection. , XAML DataContracts. [DataContract] .NET Standard, . Microsoft . , , [DataContract].

. DataContract ( , , , ...), - , . , , Data Contracts ( ).

, , . , , , . , ?

( ), .NET Standard / . , DLL . .NET Standard, X .NET Framework Z, .NET Y. Y, , , X, . Y Z.

. - .NET Standard Serializable. , , , - XAML. .NET Framework , .

, , "" ...

0

Source: https://habr.com/ru/post/1687004/


All Articles