我需要将以下代码应用于每个DataGridTextColumn:
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<TextBlock
Text="{Binding Content, RelativeSource=
{RelativeSource Mode=TemplatedParent}}"
Margin="5" />
<Border DockPanel.Dock="Top"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="Azure">
<TextBox Width="Auto"
Text="{Binding SearchEngineCompassLogView.SearchText,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
DataContext="{StaticResource CompassLogView}" />
</Border>
</StackPanel>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
问题是每个TextBox
都需要一个特定的绑定,具体取决于DataGridTextColumn
(在这种情况下,绑定是SearchEngineCompassLogView.SearchText
)
有什么建议我可以解决这个问题吗?