XPath syntax in XAML binding

What is the syntax for using XPath with binding in XAML? Are there any MSDN pages that describe where to put curly braces?

Visual Studio doesn't like the following:

<TextBlock Text="{Binding XPath=/One/Two[@id='0']/Three/@Four}" />

I want Textfrom to TextBlockbe set to an attribute value Four.

+3
source share
1 answer

After 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>
+1
source

Source: https://habr.com/ru/post/1721308/


All Articles