Comments (5)
Description Stylet/PropertyChangedBase.cs is missing the attribute [System.Text.Json.Serialization.JsonIgnore] to make classes serializable and deserializable.
To Reproduce
public class Test : Stylet.PropertyChangedBase { public string TestString {get; set; } }
can be serialized, but has a
"PropertyChangedDispatcher": {}
object which can't be deserialized.Version Info
- Stylet version: 1.3.6
- Runtime version: 6.0.1
**Solution **
[System.Xml.Serialization.XmlIgnore] [System.Text.Json.Serialization.JsonIgnore] public virtual Action<Action> PropertyChangedDispatcher { get { return this._propertyChangedDispatcher; } set { this._propertyChangedDispatcher = value; } }
You could serialize only what you want. Just mark your class with [JsonObject(MemberSerialization.OptIn)]
and properties to serialize with [JsonProperty]
.
For more info see docs
from stylet.
That would also solve it, but in my opinion is more like a workaround. Especially because the xaml ignore attribute exist in your code.
from stylet.
Scheduled for the next release.
Note that I strongly recommend against serializing ViewModels. They're not meant to be serialized. Create a dedicated model that's meant to be serialized instead.
from stylet.
Thanks a lot!
I know and normally I'm against it too. But when I found this, I had to use the VM...
from stylet.
(this will be closed when the next release is merged)
from stylet.
Related Issues (20)
- Unable to use Style in xaml
- Built-in message box button text clips HOT 1
- Documentation correction
- EventAggregator shouldn't call handlers from within a lock
- when TabControl and Frame are used,viewmodel do not carry out HOT 1
- OnInitialActivate does not get called in "Child" Screen
- Using MicrosoftDependencyInjectionBootstrapper runtime errors
- How to ignore StyletIoCFindConstructorException
- About button binding HOT 1
- NRE in design mode with MahApps HamburgerMenu control
- Cannot open a new discussion! HOT 3
- ClassLibrary Start Stylet It is necessary!
- ShowMessageBox MessageBoxButtons.YesNo disabling the Esc key and Window "X" close functionality
- BindableCollection races against any call which adds/removes elements before it
- Binding an abstract type which has an abstract inheritor ToAllImplementations causes StyletIoCRegistrationException
- `ShowMessageBox` freeze primary window when show a message box on secondary windows HOT 2
- Conductor.OnActivate() shoudl not be required to call base.OnActivate() HOT 4
- referencing grpc.net.client in the project, error CS0234 is reported. HOT 1
- I have a class ScreenEx that inherits from Screen, rewriting OnActivate in a new ViewModel that is unresponsive HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stylet.