C# DataGrid ColumnHeaderStyle文本块多重绑定
为了显示包含2个属性的格式化字符串,我尝试设置列标题的样式,但没有成功 我做错了什么C# DataGrid ColumnHeaderStyle文本块多重绑定,c#,wpf,datagrid,C#,Wpf,Datagrid,为了显示包含2个属性的格式化字符串,我尝试设置列标题的样式,但没有成功 我做错了什么 <DataGrid.ColumnHeaderStyle> <Style TargetType="{x:Type DataGridColumnHeader}"> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalContentAlig
<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>
试试这个
<MultiBinding StringFormat="**Identified barcodes: {} {0} / {1}"**>
<Binding Path="Prop1.Prop2.Count" />
<Binding Path="Prop1.Prop3" />
</MultiBinding>
逃逸似乎不是问题所在