Change ControlTemplate dynamically

87 Views Asked by At

There is a template:

<Window.Resources>
<ResourceDictionary>
    <ControlTemplate x:Key="Class1">
        <objs:Class1 FontSize="12" x:Name="class1"/>
    </ControlTemplate>
</ResourceDictionary>
</Window.Resources>

It consists of a UserControl. I apply it like this:

<local:MyThumb Width="120" Height="70" x:Name="myThumb1" Canvas.Left="270" Canvas.Top="60" Template="{StaticResource Class1}"/>

The question is how to get this UserControl from the code and change its properties, such as Background for example.

0

There are 0 best solutions below