목록으로 채우는 항목 컨트롤이 있고 목록에 '시간'과 '설명'이라는 두 매개 변수가 있습니다. 그것을 위해, 나는 시간을 위해 HyperLinkButton을 사용하고 설명을 위해 Label을 사용하고 있습니다.ItemControl 내에서 이벤트 트리거가 작동하지 않습니다.
내가 원하는 것은 메인 viewModel에서 하이퍼 링크 버튼의 EventTrigger를 사용하여 클릭 이벤트를 만들고 싶습니다. , 내가 프로젝트를 빌드 할 때
<ItemsControl
x:Name="transcriptionTextControl"
ItemsSource="{Binding MyCollectionOfTranscription, Mode=TwoWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<HyperlinkButton Content="{Binding Time}">
<ToolTipService.ToolTip>
<ToolTip Content="Time"/>
</ToolTipService.ToolTip>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction
Command="{Binding HyperLinkButtonCommand}"
CommandParameter="{Binding
ElementName=transcriptionTextControl }" />
</i:EventTrigger>
</i:Interaction.Triggers>
</HyperlinkButton>
<sdk:Label Content="{Binding Description}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
,이 하이퍼 링크에 오류가 있지만 ICommand의를 제공하지 않습니다이 이벤트 트리거이 외부에서 잘 작동하는 동안, '기호 HyperLinkButtonCommand를 확인할 수 없음'으로 경고를 보여줍니다 내 코드입니다.
점점 아니, 그 뒤에 실제 문제가 무엇인지, PLZ의 인스턴스에 HyperLinkButtonCommand
라는 속성을 찾습니다하려고하는 바인딩
<i:InvokeCommandAction
Command="{Binding HyperLinkButtonCommand}"
CommandParameter="{Binding
ElementName=transcriptionTextControl }" />
를 여러분의 소중한 제안 ...
왜 트리거를 사용하고 있습니까? HyperlinkButton에는 Command 속성이 이미 있습니다. –