Trigger doesn't work
Posted
by Pasha
on Stack Overflow
See other posts from Stack Overflow
or by Pasha
Published on 2010-05-06T16:32:52Z
Indexed on
2010/05/06
17:28 UTC
Read the original article
Hit count: 388
Hello everyone,
I have an user control, It is editable text block. The content of the control is:
<DataTemplate x:Key="DisplayModeTemplate">
<TextBlock
Text="{Binding ElementName=mainControl, Path=FormattedText}"
Margin="5,3,5,3" />
</DataTemplate>
<Style TargetType="{x:Type Controls:EditableTextBlock}">
<Setter Property="ContentTemplate" Value="{StaticResource EditModeTemplate}"/>
<Style.Triggers>
<Trigger Property="IsInEditMode" Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource EditModeTemplate}" />
</Trigger>
<Trigger Property="IsInEditMode" Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource DisplayModeTemplate}" />
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
Also i have another window with tree view:
When treeView1_KeyDown fires I set IsInEditMode to true, but it seems that trigger doesn't work, because content template don't change. Anyone, please explain me why?
© Stack Overflow or respective owner