1

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.

Aryan Firouzian
  • 1,940
  • 5
  • 27
  • 41
D. Malakhov
  • 165
  • 1
  • 11
  • Use triggers in the control template, or write a style which applies the template and also has triggers. To do it with a style, you'll want to use template bindings in the ControlTemplate so that the properties will be used: ``. What is the target of this template? How is it being used? This doesn't look like a normal usage of the WPF template feature. – 15ee8f99-57ff-4f92-890c-b56153 Oct 30 '17 at 16:56

0 Answers0