I am getting a weird crash whenever I am trying to change a path fill using a trigger on a ToggleButton. After doing some process of elimination it seems that the actual trigger property is causing the program to crash.
When it crashes I am getting this:
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: briantestwpf.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 54de1f87
Problem Signature 04: PresentationFramework
Problem Signature 05: 4.0.30319.18408
Problem Signature 06: 52312f13
Problem Signature 07: 65f2
Problem Signature 08: 5e
Problem Signature 09: System.Windows.Markup.XamlParse
OS Version: 6.1.7601.2.1.0.256.4
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Here is the code in question, nothing fancy since I'm trying to mess with the concept. My Project Lead is also confused on this.
<ToggleButton Background="Transparent" BorderThickness="1" BorderBrush="Transparent" Canvas.Left="410" Canvas.Top="384" Height="41" Width="81">
<Canvas>
<Path x:Name="Arrow"
Width="32"
Data="M0,0 L0,2 L4,6 L8,2 L0,2 "
Fill="#FF827F96" Canvas.Left="0" Canvas.Top="-15" Stretch="Fill" Height="29" />
</Canvas>
<ToggleButton.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter TargetName="Arrow" Property="Path.Fill" Value="GhostWhite"/>
</Trigger>
</ToggleButton.Triggers>
</ToggleButton>
Thank you very much!
try this --
<ToggleButton Background="Transparent" BorderThickness="1" BorderBrush="Transparent" Canvas.Left="410" Canvas.Top="384" Height="41" Width="81">
<Canvas>
<Path x:Name="Arrow" Width="32" Data="M0,0 L0,2 L4,6 L8,2 L0,2 " Fill="#FF827F96" Canvas.Left="0" Canvas.Top="-15" Stretch="Fill" Height="29" >
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type ToggleButton}}}" Value="True">
<Setter Property="Stroke" Value="GhostWhite"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Canvas>
</ToggleButton>