5

I'm having issues binding one of my controls to an escaped property. The JSON data I'm pulling into my app has a value that uses the reserved C# keyword event. To get around this in my class i've escaped event using the @ sign.

public string @event { get; set; }

But when i go to bind that property to one of my controls it doesn't seem to work

<TextBlock> Text="{Binding @event}" />

How do I get this to work?

nos9
  • 601
  • 2
  • 6
  • 16
  • Check out the answer here: http://stackoverflow.com/questions/16704733/how-can-i-use-a-reserved-keyword-as-an-identifier-in-my-json-model-class Basically he suggests avoiding escaped property names, and instead using the Json.NET attributes to map "event" to a non-reserver property name in your class. – Ebsan Aug 18 '15 at 03:20

1 Answers1

0

Event is a C# keyword, nothing to do with XAML so just do "{Binding event}". Property change notification can use either.

Mark Feldman
  • 15,731
  • 3
  • 31
  • 58