Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 使用键绑定命令进行帧导航?_Wpf_Wpf Controls_Binding - Fatal编程技术网

Wpf 使用键绑定命令进行帧导航?

Wpf 使用键绑定命令进行帧导航?,wpf,wpf-controls,binding,Wpf,Wpf Controls,Binding,我想使用键盘上的“Ctrl”和“H”键将页面加载到带有键绑定的框架中。我可以加载页面。它现在正在工作。我想知道我是否可以用现在的URI源链接覆盖到框架中。我用XML分配URI源,我需要覆盖一个实例,而不是引入新的URI源,以保持索引不变。有什么想法吗?提前谢谢你 public partial class MainWindow : Window { public static RoutedUICommand LoadShareSelectedCommand = new RoutedUICo

我想使用键盘上的“Ctrl”和“H”键将页面加载到带有键绑定的框架中。我可以加载页面。它现在正在工作。我想知道我是否可以用现在的URI源链接覆盖到框架中。我用XML分配URI源,我需要覆盖一个实例,而不是引入新的URI源,以保持索引不变。有什么想法吗?提前谢谢你

public partial class MainWindow : Window
{
    public static RoutedUICommand LoadShareSelectedCommand = new RoutedUICommand();
    public MainWindow()
    {
        InitializeComponent();
        this.CommandBindings.Add(new CommandBinding(LoadShareSelectedCommand, LoadShareSelectedCommandExecuted));
        KeyGesture kg = new KeyGesture(Key.H, ModifierKeys.Control);
        InputBinding ib = new InputBinding(LoadShareSelectedCommand, kg);
        this.InputBindings.Add(ib);
    }

    private void LoadShareSelectedCommandExecuted(object sender, ExecutedRoutedEventArgs e)
    {
        this.ContentFrame.NavigationService.Navigate(new Uri("Pages/SharesSelected.xaml", UriKind.Relative));

    }

    private void LoadShareSelectedCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)
    {
        e.CanExecute = true;
    }


    private void NavShareSelected(object sender, RoutedEventArgs e)
    {
        this.ContentFrame.NavigationService.Navigate(new Uri("Pages/SharesSelected.xaml", UriKind.Relative));
    }
}