XAML TextBlock和Run绑定

sco*_*dro 19 wpf xaml

我有一个问题,运行的绑定不起作用.这是我目前的代码.

<TextBlock
  x:Name="txtCompanyName"
  Text="{Binding Path=SelectedItem.CompanyName, ElementName=lbSourceList}"
  Foreground="White"
  FontSize="18.667"
  Height="33.667" 
  Margin="10,-0.5,0,-1.5">
  <Run Text=" : " Foreground="White"/>
  <Run Text=" "/>
  <Run Text=" " Foreground="White"/>
  <Run Text=" "/>
  <Run Text="{Binding Path=SelectedItem.RFQID, ElementName=lbSourceList}" />
</TextBlock>
Run Code Online (Sandbox Code Playgroud)

我正在显示公司名称,但额外的数据从未显示出来.任何想法为什么这种类型的绑定失败?


替代答案以及最终答案

<TextBlock TextWrapping="Wrap" 
           Text="{Binding RFQID}" 
            FontWeight="Bold" 
            Foreground="#FFFFF504" 
            HorizontalAlignment="Left" Width="185"> 
            <Run Text=" ~ "/> 
            <Run Text="{Binding RFQNo}" FontWeight="Bold" Foreground="#FFFFF504"/> 
            <Run Text=" ~ "/> 
            <Run Text="{Binding Status}" FontWeight="Bold" 
                                         Foreground="#FF85F35F"/>
 </TextBlock>
Run Code Online (Sandbox Code Playgroud)

H.B*_*.B. 27

您不能同时使用Inlines(Run子节点)TextBlock.Text.