代码之家  ›  专栏  ›  技术社区  ›  amurra

Silverlight文本块文本属性与内容

  •  3
  • amurra  · 技术社区  · 15 年前

    <TextBlock> <文本块>

    <TextBlock Text="Example Text" />
    
                vs.    
    
    <TextBlock>Example Text</TextBlock>
    
    2 回复  |  直到 13 年前
        1
  •  4
  •   Tim Cooper    14 年前

    前者可以绑定,而后者在组合时特别有用 Run 学生:

    <TextBlock Text="{Binding SomeProperty}"/>
    <TextBlock>
        <Run>You have </Run>
        <Run Text="{Binding Count}"/>
        <Run>items.</Run>
    </TextBlock>
    
        2
  •  3
  •   AnthonyWJones    15 年前

    使用 Text

    文本 财产。此外,后一种可能带来的任何全球化也可能以绑定取代这些文字而告终。