Silverlight 焦点疑云

焦点,还是焦点。silverlight 在不同的Style下,竟然失去了焦点,所以,当你的界面,子窗口突然没了焦点,可以去查一查你的Style做了哪些改动。

在作一个ChildWindow的显示时,以前使用的Style是可以在子窗口内获得键盘输入,但是为了某个效果,复制了一个stlye,去掉了一些动画效果,

结果回来发现,键盘输入功能失效了,所有的键盘事件都不响应了。

 

                                <VisualState x:Name="Open">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Overlay">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX" Storyboard.TargetName="ContentRoot">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1"/>
                                            <SplineDoubleKeyFrame KeySpline="0,0,0.5,1" KeyTime="00:00:00.45" Value="1.05"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1"/-->
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY" Storyboard.TargetName="ContentRoot">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1"/>
                                            <!--SplineDoubleKeyFrame KeySpline="0,0,0.5,1" KeyTime="00:00:00.45" Value="1.05"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

 

当时就想,要是有一个焦点的跟踪列表就好了。但是好像从古至今,没有这个东西啊。

焦点问题在silverlight中这是一个比较困惑的问题。

比如,控件的KeyUp,KeyDown事件,应该截获所有的键盘,但是偏偏缺省按钮的事件不能截获。

 

 

posted on 2010-07-21 15:49  haio  阅读(980)  评论(0编辑  收藏  举报