XPath syntax within binding XAML
What is the syntax for using XPath with Binding in XAML? Are there any MSDN pages which describe where to put the braces?
Visual Studio doesn't like the following:
<TextBlock Text="{Binding XPath=/One/Two[@id='0开发者_JS百科']/Three/@Four}" />
I want the Text
of the TextBlock
to be set to the value of the Four
attribute.
Looking at the documentation, you should set the binding using nested syntax as follows:
<TextBlock>
<TextBlock.Text>
<Binding XPath="/One/Two[@id='0']/Three/@Four" />
</TextBlock.Text>
</TextBlock>
精彩评论