How do you escape parentheses in a Binding indexer
Posted
by Chris S
on Stack Overflow
See other posts from Stack Overflow
or by Chris S
Published on 2010-05-27T16:25:45Z
Indexed on
2010/05/27
17:51 UTC
Read the original article
Hit count: 174
I have the following XAML:
<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource MyDataKey}}">
<TextBox Name="_myId" Text="{Binding MyDictionary[(Textbox.Name)]" />
</Grid>
But it thinks the key in my dictionary is called "(Textbox.Name)", instead of "_myId". The format below works, where I have a property in my class called "_myId":
<TextBox Name="_myId" Text="{Binding (Textbox.Name)" />
I've tried using ^ and \ to escape the brackets. Is this syntax supported? I'm trying to avoid duplication of the name in two attributes.
© Stack Overflow or respective owner