Skip to content

Instantly share code, notes, and snippets.

@ChaseFlorell
Last active August 29, 2015 13:57
Show Gist options
  • Save ChaseFlorell/9648056 to your computer and use it in GitHub Desktop.
Save ChaseFlorell/9648056 to your computer and use it in GitHub Desktop.
Place this file beside the `Cirrious.MvvmCross.dll` file in each of the `lib` directories. Doing so will enable you to [alt] + [enter] (resharper) on an AutoProperty, and get the additional option "To property with change notification".
<?xml version="1.0" encoding="utf-8"?>
<assembly name="Cirrious.MvvmCross">
<member name="M:Cirrious.MvvmCross.ViewModels.MvxNotifyPropertyChanged.RaisePropertyChanged``1(System.Linq.Expressions.Expression{System.Func{``0}})">
<attribute ctor="M:JetBrains.Annotations.NotifyPropertyChangedInvocatorAttribute.#ctor" />
</member>
</assembly>
<!-- https://github.com/MvvmCross/MvvmCross/blob/v3.1/Cirrious/Cirrious.MvvmCross/ViewModels/MvxNotifyPropertyChanged.cs#L40 -->
public class Foo : MvxViewModel
{
// before
public string Bar { get; set; }
// after [alt] + [enter]
private string _bar;
public string Bar
{
get { return _bar; }
set
{
if (value == _bar) return;
_bar = value;
RaisePropertyChanged(() => Bar);
}
}
}
@ChaseFlorell
Copy link
Author

So in that Nuget package directory I have the following two items.

  • Cirrious.MvvmCross.dll
  • Cirrious.MvvmCross.ExternalAnnotations.xml

The contents of the XML is what's posted above.
I re-launch Visual Studio, create a property

public string Foo {get; set;}

then I alt + enter

but unfortunately the option still doesn't exist.

@hmemcpy
Copy link

hmemcpy commented Mar 19, 2014

Took me a second to realize but I got it! There's a small issue with the xml - there should be 2 backticks (``), not just one!

Here's the "fixed" version:

<?xml version="1.0" encoding="utf-8"?>
<assembly name="Cirrious.MvvmCross">

  <member name="M:Cirrious.MvvmCross.ViewModels.MvxNotifyPropertyChanged.RaisePropertyChanged``1(System.Linq.Expressions.Expression{System.Func{``0}})">
    <attribute ctor="M:JetBrains.Annotations.NotifyPropertyChangedInvocatorAttribute.#ctor" />
  </member>

</assembly>

<!-- https://github.com/MvvmCross/MvvmCross/blob/v3.1/Cirrious/Cirrious.MvvmCross/ViewModels/MvxNotifyPropertyChanged.cs#L40 -->

woot!

@ChaseFlorell
Copy link
Author

Working now - Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment