ContentControl
을 포함하는 UserControl이 있습니다. 사용자가이 ContentControl
을 클릭하면 해당 ContentTemplate
을 변경하여 "편집 가능"으로 만듭니다 (예 : 레이블 대신 텍스트 상자가 표시됨). 는 내가 가지고있는 것은 이것이다 : ContentControl change ContentTemplate on GotFocus
<StackPanel>
<ContentControl Style="{DynamicResource ContainerStyleEditable}" GotFocus="ContentControl_GotFocus"></ContentControl>
</StackPanel>
및 UserControl을 자원이
내가<Style TargetType="{x:Type ContentControl}" x:Key="ContainerStyleEditable">
<Setter Property="ContentTemplate" Value="{DynamicResource ItemTemplateReadOnly}" />
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="ContentTemplate" Value="{DynamicResource ItemTemplateEditable}" />
</Trigger>
</Style.Triggers>
</Style>
이 미상 작동하지 않을 수 있습니다, GotFocus
이벤트가 터지지 않 보인다. 이것에가는 방법은 무엇입니까? 자주 포커스 요소는 일반적으로 실제 ContentControl
하지 않기 때문에