と を含むこの CustomControl がありInkPresenter
ますImage
。AdornerDecorator
後で画像に装飾を追加する予定なので、画像には があります。が画像の上に描画されるように、Canvas.ZIndex
をImage
より高く設定しました。InkPresenter
InkPresenter
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
添付しました。後でこれらのイベントの処理を他のクラスに移動する予定です。MouseMove
InkPresenter
残念ながら、これらのイベントはキャプチャされません。これは、Image
が の上に描画され、InkPresenter
ではなくイベントが取得されるためInkPresenter
です。これがなぜなのか誰か知っていますか?
どんな助けでも大歓迎です。