Silverlight 触发器在按钮模板中?
有谁有关于如何使用 Microsoft.Expression.Interactivity dll 在 Silverlight 按钮模板中使用触发器的功能示例吗?
我想通过触发动画来响应样式中定义的按钮模板中的单击事件。
Does anyone have a functioning example of how to use triggers in a Silverlight Button Template using the Microsoft.Expression.Interactivity dlls?
I want to respond to the click event in a Button's template defined in a style, by triggering an animation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您想要使用触发
GoToStateAction
的EventTrigger
要在 Blend 中执行此操作,您需要将
GoToStateAction
拖到按钮上,然后设置 TargetName 属性将 StateName 属性设置为目标 UIElement 并将 StateName 属性设置为所需状态。You want to use an
EventTrigger
that fires aGoToStateAction
To do this in Blend you would drag a
GoToStateAction
onto the button and then set the TargetName property to the target UIElement and the StateName property to the desired state.您始终可以使用 VisualStateManager 并通过处理 Button 的单击事件来更改为“单击”状态。
您还需要在 XAML 代码中定义样式和状态。
另外,请记住 Button 对象有许多预定义状态,例如“禁用”、“按下”(单击?)、“鼠标悬停”和“正常”。
You can always use the VisualStateManager and change to the "Click" state by handling the click event of a Button.
You will also need to define a style and state in the XAML code.
Also, remember that Button objects have a bunch of predefine states like Disabled, Pressed (Click?), MouseOver, and Normal.
看起来当时是不可能的。
looks like it wasn't possible at that time.