My usercontrol contains 3000 NewDotControls in an itemscontrol. The ControlTemplate for NewDotControl is specified in a style that defines the visualstates and there is an eventtrigger that invokes a GotoStateAction on Loaded event.
<Controls:NewDotControl Style="{StaticResource MyDotStyle}"/>
Only around 445 of the 3000 NewDotControls go to the "Selected" state as defined by the EventTrigger whereas the rest of the NewDotControls do not. Same happens when I use DataTriggers that are bound to the ViewModel. The same xaml/code/app work in WPF.
<Style x:Key="MyDotStyle" TargetType="Control">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Viewbox x:Name="viewbox" RenderTransformOrigin="0.5,0.5"
>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="UnSelected">
</VisualState>
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.StrokeThickness)" Storyboard.TargetName="InnerEllipse" d:IsOptimized="True">
<EasingDoubleKeyFrame KeyTime="0" Value="2"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<ei:GoToStateAction StateName="Selected"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Ellipse x:Name="InnerEllipse" Stroke="Red" StrokeThickness="0" RenderTransformOrigin="0.5,0.5"/>
</Viewbox>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Why do DataTriggers/EventTriggers/GotoStateAction not work for all the controls in the ItemsControl?
If I remove the initial Loaded EventTrigger, around 775 to 800 NewDotControls respond to DataTriggers/GotoStateAction. If I hook up Commands to the control, the commands execute and modify the ViewModel Properties and fire PropertyChanged events, but still the DataTrigger/GotoStateAction does not happen.
What could I be missing? Is there a limit on the number of items in the itemscontrol that can be databound? Or is there an issue because this is in a ControlTemplate? Why does this work in WPF but not Silverlight?
Thanks!!! Rajesh