RoutedEvent设定

soonstart14 2013-01-18 02:07:25
<Border x:Name="bb" Background="Transparent">
<Border.Triggers>
<EventTrigger RoutedEvent="Button.Click" >
<BeginStoryboard>
<Storyboard x:Name="stb">
.........


<Button Content="botton1" Height="28" Name="botton1"/>

<Button Content="botton1" Height="28" Name="botton2" />


看以上代码,在border上加了一个eventtrigger,routedevent='Button.Click

但我窗口上有多个button ,
我想在botton1单击时才让border 触发动画,应该怎么改?
谢谢!
...全文
146 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jv9 2013-01-23
  • 打赏
  • 举报
回复
Silverlight使用RoutedEvent需要注意,Silverlight仅支持冒泡事件,也就是bubble routed event,触发事先控件需存在父控件控件树下,这样才能正常激活RoutedEvent。例如:

<UserControl>
    <Grid>
        <StackPanel>
            <TextBlock />
            <TextBox />
            <Button />
        </StackPanel>
    </Grid>
</UserControl>
需要Button在布局控件内,才可进行事件冒泡传递。 详细请看:http://silverlightchina.net/html/developer/silverlight/2013/0122/21582.html 实例代码下载:http://www.silverlightshow.net/Storage/Sources/SilverlightRoutedEvents.zip
在路上20130607 2013-01-18
  • 打赏
  • 举报
回复
silverlight

<i:Interaction.Triggers>
				<i:EventTrigger  EventName="MouseLeftButtonDown" SourceName="button">
					<ei:ControlStoryboardAction/>
				</i:EventTrigger>
			</i:Interaction.Triggers>

8,757

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧