Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > WPF и Silverlight > проблема с UserControl (в VisualStateManager)


Автор: Glen 4.3.2010, 21:45
У меня проблема с UserControl; она происходит на  Silverlight 2 но НЕ происходит на  Silverlight 3.

The XAML code is:
<vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="CommonStates">
                        <vsm:VisualState x:Name="Normal" />
                        <vsm:VisualState x:Name="MouseOver">
                            <Storyboard>
                                <DoubleAnimation 
                                        Storyboard.TargetName="hotRect" 
                                        Storyboard.TargetProperty="Opacity"
                                        Duration="0"
                                        To="1" />
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="TopicItemHost" 
                                    Storyboard.TargetProperty="Cursor" 
                                    Duration="0">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Cursors>Hand</Cursors>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                    <vsm:VisualStateGroup x:Name="FocusStates">
                        <vsm:VisualState x:Name="Unfocused" />
                        <vsm:VisualState x:Name="Focused">
                            <Storyboard>
                                <DoubleAnimation 
                                        Storyboard.TargetName="focusRect" 
                                        Storyboard.TargetProperty="Opacity"
                                        Duration="0"
                                        To="1" />
                            </Storyboard>
                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                    <vsm:VisualStateGroup x:Name="ReadUnreadStates">
                        <vsm:VisualState x:Name="Read" />
                        <vsm:VisualState x:Name="Unread">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="TopicTitle" 
                                    Storyboard.TargetProperty="FontWeight" 
                                    Duration="0">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <FontWeight>Bold</FontWeight>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
  
  Для упомянтуого выше контрола TopicTitle я вызываю:
  
    VisualStateManager.GoToState(ctrlTopicTitle, "Unread", false);
  
И в этот момент происходит вот такое исключение:
  
  MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.Storyboard_SeekAlignedToLastTick(Storyboard storyboard, Single seekTime)
   at System.Windows.Media.Animation.Storyboard.SeekAlignedToLastTick(TimeSpan offset)
   at System.Windows.VisualStateGroup.StartNewThenStopOld(FrameworkElement element, Storyboard[] newStoryboards)
   at System.Windows.VisualStateManager.GoToStateInternal(Control control, FrameworkElement element, VisualStateGroup group, VisualState state, Boolean useTransitions)
   at System.Windows.VisualStateManager.GoToState(Control control, String stateName, Boolean useTransitions)
   
 Это какой-то баг Silverlight 2 исправленный в Silverlight 3? Если так - что можно сделат для Silverlight 2 (не все мои заказчики перешли на Silverlight 3 ещё)

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)