Note that there are some explanatory texts on larger screens.

plurals
  1. POTroubles with GoToStateAction
    text
    copied!<p>I have had several problems with the GoToStateAction in different scenarios, and I'm beginning to believe that either the feature is buggy, or that my understanding of it is off.</p> <p>In this case, I have a datatemplate with an ellipse that is representing a connector. The connector has an IsConnected property... I am using VisualStates and the GoToStateAction with a DataTrigger to switch between the 2 states 'Connected' and 'NotConnected'. However, in this case the state is never set.</p> <p>I know the model is set up correctly, as trying other binding scenarios with IsConnected works fine. What am I doing wrong?</p> <pre><code>&lt;DataTemplate x:Key="ConnectorTemplate"&gt; &lt;Grid x:Name="grid"&gt; &lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name="ConnectionStates"&gt; &lt;VisualState x:Name="Connected"&gt; &lt;Storyboard&gt; &lt;ColorAnimation Duration="0" To="#FFEAFFDD" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/&gt; &lt;ColorAnimation Duration="0" To="#FF56992B" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;VisualState x:Name="NotConnected"/&gt; &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; &lt;VisualStateManager.CustomVisualStateManager&gt; &lt;ei:ExtendedVisualStateManager/&gt; &lt;/VisualStateManager.CustomVisualStateManager&gt; &lt;Ellipse x:Name="ellipse" Height="8" Width="8"&gt; &lt;i:Interaction.Triggers&gt; &lt;ei:DataTrigger Binding="{Binding IsConnected}" Value="true"&gt; &lt;ei:GoToStateAction StateName="Connected"/&gt; &lt;/ei:DataTrigger&gt; &lt;ei:DataTrigger Binding="{Binding IsConnected}" Value="false"&gt; &lt;ei:GoToStateAction StateName="NotConnected"/&gt; &lt;/ei:DataTrigger&gt; &lt;/i:Interaction.Triggers&gt; &lt;Ellipse.Fill&gt; &lt;RadialGradientBrush Center="0.275,0.262" GradientOrigin="0.275,0.262" RadiusX="0.566" RadiusY="0.566"&gt; &lt;GradientStop Color="#FF333333" Offset="1" /&gt; &lt;GradientStop Color="#FFC4C4C4" /&gt; &lt;/RadialGradientBrush&gt; &lt;/Ellipse.Fill&gt; &lt;/Ellipse&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload