코드 숨김을 통해 InkCanvas에 버튼을 추가했습니다. 이해할 수없는 이유 때문에 버튼을 클릭하면 버튼에 2의 인덱스가있는 결과가 항상 null이됩니다.InkCanvas의 자식에 대한 히트 테스트
아무도 자식 요소가 클릭되었는지 확인하는 방법을 알고 있습니까?
도움이 될 것입니다. (네, 저는 인터넷을 성공하지 않고 검색했습니다. 이것이 바보 같은 질문이라면 사과드립니다.)
체제 : Windows 7, WPF C 번호를
편집을 .net4.0 : 나는 아이 [0] 그러나 hitTest 위가 null resturns 다음를 RichTextBox이며, 같은 일을합니다. 왜 그런 생각을 가진 사람?
편집 다음를 RichTextBox과 버튼 모두 코드 숨김에서 추가의 XAML은 다음과 같습니다
<Grid Height="{x:Static local:pe.heightCanvas}" >
<!--NotepadCanvas. Canvas used to place user writing lines and borders.-->
<Canvas Name="NotePadCanvas" Panel.ZIndex="0"
Width="{x:Static local:pe.widthCanvas}"
Height="{x:Static local:pe.heightCanvas}"
Background="{Binding documenttype, Converter={StaticResource inkCanvasBackgroundConverter}}" />
<!--BackgroundCanvas. Canvas used for special highlighting of seleted items-->
<Canvas Name="BackgroundCanvas" Panel.ZIndex="1"
Width="{x:Static local:pe.widthCanvas}"
Height="{x:Static local:pe.heightCanvas}"
Background="Transparent" />
<!--FormsCanvas. Canvas used to place formatted text from lists, etc.-->
<Canvas Name="FormsCanvas" Panel.ZIndex="2"
Width="{x:Static local:pe.widthCanvas}"
Height="{x:Static local:pe.heightCanvas}"
Background="Transparent" />
<!--TranscriptionCanvas. Canvas used to place recognized ink from the InkAnalyzer-->
<Canvas Name="TranscriptionCanvas" Panel.ZIndex="3"
Width="{x:Static local:pe.widthCanvas}"
Height="{x:Static local:pe.heightCanvas}"
Background="Transparent" />
<!--InkCanv. Top most canvas used to gather handwritten ink strokes from the user. EditingMode="Ink" Gesture="OnGesture" -->
<local:CustomInkCanvas x:Name="InkCanvas" Panel.ZIndex="4"
Width="{x:Static local:pe.widthCanvas}"
Height ="{x:Static local:pe.heightCanvas}"
Background="Transparent"
AllowDrop="True" Drop="InkCanvas_Drop"/>
</Grid>
xaml 트리를 공유 할 수 있습니까? 그래서 우리는 모양을 가지고 시뮬레이션하려고 시도 할 것입니다. – pushpraj