Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khellang/caliburn.micro.exposedproperties
A small Caliburn.Micro extension to allow exposing Model properties through a ViewModel with a simple attribute.
https://github.com/khellang/caliburn.micro.exposedproperties
Last synced: about 2 months ago
JSON representation
A small Caliburn.Micro extension to allow exposing Model properties through a ViewModel with a simple attribute.
- Host: GitHub
- URL: https://github.com/khellang/caliburn.micro.exposedproperties
- Owner: khellang
- License: apache-2.0
- Created: 2012-11-12T21:45:04.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-09-11T14:37:29.000Z (over 11 years ago)
- Last Synced: 2024-11-04T04:37:11.584Z (2 months ago)
- Language: C#
- Size: 391 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Caliburn.Micro.ExposedProperties
=============================A small Caliburn.Micro extension that allows you to expose Model properties through a ViewModel with a simple attribute.
Usage
----------Hook up the property binding to Caliburn.Micro by setting `ViewModelBinder.BindProperties`:
```csharp
ViewModelBinder.BindProperties = ExposedPropertyBinder.BindProperties;
```
Decorate your ViewModel properties with the `ExposeAttribute`:```csharp
public class MyViewModel : PropertyChangedBase
{
private Person _person;[Expose("FirstName")]
[Expose("LastName")]
[Expose("ZipCode")]
public Person Person
{
get { return _person; }
set
{
_person = value;
NotifyOfPropertyChange(() => Person);
}
}
}public class Person
{
public string FirstName { get; set; }public string LastName { get; set; }
[Expose("ZipCode", "zip_code")]
public Address Address { get; set; }
}public class Address
{
public string zip_code { get; set; }
}
```
And bind to the new properties:```xml
```