Here goes my code:
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="Chrome">
<Grid x:Name="Arrow">
<Grid.Background>
<DrawingBrush Viewport="0,0,4,4" Viewbox="0,-0.4,16,16" ViewboxUnits="Absolute">
<DrawingBrush.Drawing>
<GeometryDrawing x:Name="ArrowDrawing">
<GeometryDrawing.Geometry>
<PathGeometry>
<PathFigure StartPoint="1,1" IsClosed="True">
<LineSegment Point="2,2.45"/>
<LineSegment Point="3,1"/>
<LineSegment Point="2,1.75"/>
</PathFigure>
</PathGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Grid.Background>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Brush" TargetName="ArrowDrawing" Value="{StaticResource DisabledForecolor}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
So when the trigger triggers (on compile time), I got the error:
Cannot find the Trigger target 'ArrowDrawing'. (The target must appear before any Setters, Triggers, or Conditions that use it.)
How do I actually access that GeometryDrawing
named ArrowDrawing
from the trigger?
This post might help
There is a way to solve this, though, by using data binding. With a Binding, you can find your way out of the brush to an element, and then the Setter can target that element.