I have a xaml file with this code:
<GridViewColumn
x:Name="lvCol3"
Header="Quantità"
Width="120"
>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Control x:Name="host">
<Control.Template>
<ControlTemplate>
<TextBlock
Text="{Binding Path=Entity.Quantita}"
/>
</ControlTemplate>
</Control.Template>
</Control>
<DataTemplate.Triggers>
<DataTrigger
Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}"
Value="True"
>
<Setter TargetName="host" Property="Template">
<Setter.Value>
<ControlTemplate x:Name="myControlTemplate" />
</Setter.Value>
</Setter>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
I would manage "myControlTemplate" from code behind in order to assign different UI object.
I try to use FindResource but it don't work. How can I do?