【发布时间】:2014-01-29 06:46:10
【问题描述】:
我在使用 caliburn 将 TextboxHelper.ButtonCommand(来自 mahapps.metro)绑定到我的视图模型时遇到问题。
目前我正在使用委托命令进行这项工作。
查看:
<TextBox Name="TextBoxContent"
mui:TextboxHelper.ButtonContent="s"
mui:TextboxHelper.ButtonCommand="{Binding DelCommand, Mode=OneWay}"
Style="{DynamicResource ButtonCommandMuiTextBox}" />
查看模式:
ICommand DelCommand
{
get {return new Command();}
}
void Command() { //Handle press here }
但是我真的很想使用 caliburn 而不是委托命令来实现这一点。我试过使用文本框上的事件触发器无济于事,就像这样......
<TextBox Name="TextBoxContent" mui:TextboxHelper.ButtonContent="s"
Style="{DynamicResource ButtonCommandMuiTextBox}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="mui:TextboxHelper.ButtonCommand">
<i:EventTrigger.Actions>
<cal:ActionMessage MethodName="Command"/>
</i:EventTrigger.Actions>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
这有什么不能做到的原因吗?
谢谢
【问题讨论】:
标签: c# wpf mvvm caliburn.micro mahapps.metro