私のxamlには、ItemTemplateプロパティに設定されたデータテンプレートを持つItemscontrolがあります。データテンプレート内にボタンがあり、ボタンにツールチップが設定されています。ツールチップの配置ターゲットをそのボタンに設定しようとしていますが、バインディングは失敗します。以下は私のコードです:
<DataTemplate x:Key="MyTemplate">
<Grid x:Name="PopupGrid" Background="Red">
<Button Width="100" Height="30" Content="Click Me!" x:Name="button">
<Button.ToolTip>
<ToolTip Style="{StaticResource ToolTipStyle}" PlacementTarget="{Binding ElementName= button}">
<StackPanel Orientation="Vertical">
<Label Content="Newly Rejected" Style="{StaticResource ToolTipHeaderStyle}"></Label>
<Label Content="Please perform requested edits and resubmit" Style="{StaticResource ToolTipTextStyle}"></Label>
</StackPanel>
</ToolTip>
</Button.ToolTip>
</Button>
</Grid>
プレースメント ターゲット バインディングをボタンに指定するにはどうすればよいですか?
ありがとう -マイク