我尝试了无处不在的解决方案,但我无处可去 这是你的代码
namespace Elysium.MetroWindow
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Elysium.Controls.Window
{
public MainWindow() {}
}
}
这是右键菜单部分(如果有人想看到完整的应用程序,它就是Elysium.Demo程序)
<Controls:Window.ApplicationBar>
<Controls:ApplicationBar>
<!-- Right Click on the UI to open Application Bar -->
<Controls:DropDownCommandButton Header="Google Chrome"
ClickMode="Press" />
<Controls:DropDownCommandButton Header="Skype"
ClickMode="Press" />
<Controls:DropDownCommandButton Header="Microsoft Visual 2012"
ClickMode="Press" />
<Controls:DropDownCommandButton Header="Minecraft"
ClickMode="Press" />
<Controls:DropDownCommandButton Header="Cinema 4D"
ClickMode="Press" />
<Controls:DropDownCommandButton Header="Counter Strike 1.6"
ClickMode="Press" />
</Controls:ApplicationBar>
</Controls:Window.ApplicationBar>
那么,如何添加右键菜单来打开我尝试过的程序 Process.start("C:\AppPath\Appname.exe") 和按钮
private void button1_Click(object sender, RoutedEventArgs e)
{
Process Chrome = new Process();
Chrome.StartInfo.FileName = "C:\Program Files\Google\Chrome\Application\chrome.exe"; // Needs to be full path
Chrome.StartInfo.Arguments = ""; // If you have any arguments
bool result = Chrome.Start();
}
}
}