How to modify DatagridTemplateColumn header conten

2019-08-02 17:51发布

问题:

I defined the DataGridTemplateColumn.HeaderStyle as resource.

<UserControl.Resources>
 <Style x:Key="DataGridHeaderStyleProductName" TargetType="sdk:DataGridColumnHeader">
  <Setter Property="ContentTemplate">
   <Setter.Value>
    <DataTemplate>
     <StackPanel Orientation="Horizontal">
      <TextBlock x:Name="ProductName" Text="ProductName" />
     </StackPanel>
    </DataTemplate>
   </Setter.Value>
  </Setter>
 </Style>
</UserControl.Resources>

I need to modify the Text of TextBlock (ProductName) runtime. How can I modify?