首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TextBlock的路由事件

TextBlock的路由事件
EN

Stack Overflow用户
提问于 2011-09-21 16:40:19
回答 1查看 1.4K关注 0票数 1

如何从wpf的后台代码中激发ViewModel中TextBlock的RoutedEvents。请让我知道,我可以如何在wpf代码后面绑定路由事件。谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-27 01:37:46

好吧,我使用这个(你需要在Silverlight中使用System.Windows.Interactivity,但我怀疑它在WPF中是类似的):

代码语言:javascript
复制
xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"   
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"


 <TextBlock Text="{Binding InputValue, Mode=TwoWay}">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="GotFocus">
                <GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding InputValueGotFocusCommand}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </TextBlock>

您可以在Blend中轻松完成此操作

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7496908

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档