简体   繁体   中英

Bind control to escaped property?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM