public static class LibraryCommands
{
public static RoutedCommand OpenLibraryFolder = new RoutedCommand();
}
public partial class MainWindow
{
public void OpenLibraryFolderCanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = true;
}
public void OpenLibraryFolderExecute(object sender, ExecutedRoutedEventArgs e)
{
Process.Start(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),"explorer.exe"), "/root,"+App.Environment.Settings.PrimaryLibraryPath);
}
<Window xmlns:local="clr-namespace:CoolProject" ...>
<Window.CommandBindings>
<CommandBinding Command="{x:Static local:LibraryCommands.OpenLibraryFolder}" CanExecute="OpenLibraryFolderCanExecute" Executed="OpenLibraryFolderExecute" />
</Window.CommandBindings>