开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜