Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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


```