Search code examples
wpfdata-bindingtextblock

A property question about WPF


Could any explain the following meaning of TextBlock.Text and Binding Path?

<TextBlock>
    <TextBlock.Text>
        <Binding Path="Something" /> 
    </TextBlock.Text>
</TextBlock>

Thanks.


Solution

  • TextBlock..Text: Property Gets or sets the text contents of a TextBlock. This is a dependency property. Note that all non-text content is stripped out, resulting in a plain text representation of the TextBlock contents. The default is String.Empty.

    Binding.Path Property: Gets or sets the path to the binding source property. The default is nullNothingnullptra null reference (Nothing in Visual Basic).

    DependencyProperty: Represents a dependency property that is registered with the Windows Presentation Foundation (WPF) property system. Dependency properties provide support for value expressions, property invalidation and dependent-value coercion, default values, inheritance, data binding, animation, property change notification, and styling.