2015-09-22 86 views
0

爲了顯示包含2個屬性的格式化字符串,我試圖沒有成功地設置列標題的樣式。DataGrid ColumnHeaderStyle TextBlock多重綁定

我在這裏做錯了什麼?

<DataGrid.ColumnHeaderStyle> 
    <Style TargetType="{x:Type DataGridColumnHeader}"> 
    <Setter Property="HorizontalAlignment" Value="Stretch"/> 
    <Setter Property="HorizontalContentAlignment" Value="Left" /> 
    <Setter Property="Background" Value="#BF000000" /> 
    <Setter Property="Foreground" Value="White" /> 
    <Setter Property="Height" Value="32" /> 
    <Setter Property="FontWeight" Value="Bold" /> 
    <Setter Property="ContentTemplate"> 
     <Setter.Value> 
      <DataTemplate> 
       <TextBlock Foreground="#FFFFFEFE" FontWeight="Bold" > 
        <TextBlock.Text> 
         <MultiBinding StringFormat="**Identified barcodes: {0}/{1}"**> 
          <Binding Path="Prop1.Prop2.Count" /> 
          <Binding Path="Prop1.Prop3" /> 
         </MultiBinding> 
        </TextBlock.Text> 
       </TextBlock> 
      </DataTemplate> 
     </Setter.Value> 
    </Setter> 
    </Style> 
</DataGrid.ColumnHeaderStyle> 

<DataGrid.Columns> 
    <DataGridTextColumn Binding="{Binding Code}" Width="*" /> 
</DataGrid.Columns> 

回答

0

試試這個..

<MultiBinding StringFormat="**Identified barcodes: {} {0}/{1}"**> 
         <Binding Path="Prop1.Prop2.Count" /> 
         <Binding Path="Prop1.Prop3" /> 
</MultiBinding> 
+0

逃逸似乎並不成爲問題 – sam