C# 使用交互性绑定TaskbarIcon的事件
当前,我将任务栏图标的事件绑定为附加代码,但不执行任何操作(不要进入TrayBalloonTipClosedCommand属性)。希望大家帮忙。谢谢 看法C# 使用交互性绑定TaskbarIcon的事件,c#,wpf,C#,Wpf,当前,我将任务栏图标的事件绑定为附加代码,但不执行任何操作(不要进入TrayBalloonTipClosedCommand属性)。希望大家帮忙。谢谢 看法 视图模型(TaskBaricControl) public icomand trayballoontipclosedcomand { 得到 { 返回新的RelayCommand((ti)=>{return true;},(ti)=> { MessageBox.Show(“你好,TaskbarIcon”); }); } } <tb:
视图模型(TaskBaricControl)
public icomand trayballoontipclosedcomand
{
得到
{
返回新的RelayCommand((ti)=>{return true;},(ti)=>
{
MessageBox.Show(“你好,TaskbarIcon”);
});
}
}
<tb:TaskbarIcon x:Key="NotifyIcon" x:Name="tbUpdater"
IconSource="/image_app_32.ico"
ToolTipText="{Binding Source={x:Static infor:BeyConsDefault.RevitClosed}}"
DoubleClickCommand="{Binding ShowSettingCommand}" DoubleClickCommandParameter="{Binding ElementName=tbUpdater}"
ContextMenu="{StaticResource SysTrayMenu}">
<tb:TaskbarIcon.DataContext>
<control:TaskbarIconControl/>
</tb:TaskbarIcon.DataContext>
<i:Interaction.Triggers>
<i:EventTrigger EventName="TrayBalloonTipClosed">
<i:InvokeCommandAction
Command="{Binding TrayBalloonTipClosedCommand}"
CommandParameter="{Binding ElementName=tbUpdater}">
</i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</tb:TaskbarIcon>
public ICommand TrayBalloonTipClosedCommand
{
get
{
return new RelayCommand<TaskbarIcon>((ti) => { return true; }, (ti) =>
{
MessageBox.Show("Hello TaskbarIcon.");
});
}
}