基本上,我有一个 DataTemplate 来定义 ItemsControl 中的项目,并且我想在单击项目时在项目上方弹出一个对话气泡。到目前为止,我的尝试导致我的装饰器出现在 DataTemplate 内并被该 DataTemplate 的边界剪裁而不是在它之上。我一直在使用一个漂亮的装饰器控件,可以在这里找到:http: //www.codeproject.com/KB/WPF/adornedcontrol.aspx。
我的 XAML 看起来像这样:
<DataTemplate x:Key="TrackActivityDetailTemplate">
<ac:AdornedControl HorizontalAlignment="Center" VerticalAlignment="Center" VerticalAdornerPlacement="Outside" >
<ac:AdornedControl.AdornerContent>
<TextBlock Foreground="Red" Text="HEY!!!!" />
</ac:AdornedControl.AdornerContent>
<Rectangle Name="btn" Height="35" Width="2" Fill="{Binding Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}}" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonDown">
<cmd:EventToCommand Command="{Binding Path=SelectActivityCommand}" PassEventArgsToCommand="True"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Rectangle>
</ac:AdornedControl>
</DataTemplate>
有什么想法吗?我试图对装饰者做的事情甚至可能吗?