と を含むこの CustomControl がありInkPresenterますImage。AdornerDecorator後で画像に装飾を追加する予定なので、画像には があります。が画像の上に描画されるように、Canvas.ZIndexをImageより高く設定しました。InkPresenterInkPresenter
InkPresenter問題は、ストロークからインクを収集して表示しようとすると、画像の下に描画されることです。(以前は Snoop を使用してビジュアル ツリーを確認していましたが、InkPresenterは の上にありますImage) なぜそうなのかわかりません。Imageがの上に描かれている理由を知っている人はいInkPresenterますか? どんな助けでも大歓迎です。
私のコードは次のとおりです。
Generic.xaml
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:HotSpotImage">
<Style TargetType="{x:Type local:HotSpotImage}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:HotSpotImage}">
<ControlTemplate.Resources>
<local:StringtoImageSource x:Key="ImageSourceConverter"/>
</ControlTemplate.Resources>
<Canvas Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}">
<InkPresenter Canvas.ZIndex="1"
x:Name="PART_InkPresenter"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"/>
<Image Canvas.ZIndex="2" x:Name="PART_Image"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}" Source="{Binding
RelativeSource={RelativeSource TemplatedParent},
Path=Source,
Converter={StaticResource ImageSourceConverter}}"/>
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
MouseDown、などのイベントを にMouseUp添付しました。後でこれらのイベントの処理を他のクラスに移動する予定です。MouseMoveInkPresenter
残念ながら、これらのイベントはキャプチャされません。これは、Imageが の上に描画され、InkPresenterではなくイベントが取得されるためInkPresenterです。これがなぜなのか誰か知っていますか?
どんな助けでも大歓迎です。