WPFには、1行2列のグリッドがあります。
<Grid>
<Textbox Grid.Column=0>
<Validation.ErrorTemplate>
<DockPanel>
<Image DockPanel.Dock="Right" Margin="20,0,0,0"/>
</DockPanel>
</Validation.ErrorTemplate>
</Textbox>
<Button Grid.Column=1>
</Button>
画像(エラーアイコン)をボタンの右側に配置したいのですが、ボタンのテキストに応じてサイズを変えることができます。ボタンの幅に基づいて画像のマージンを動的に設定する方法はありますか?現在、テキストボックスの右側の20ピクセルに固定されています。