WPF导航MVVM [英] Wpf Navigate MVVM

查看:73
本文介绍了WPF导航MVVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我正在尝试使用wpf中的mvvm进行导航,但无法让我对页面进行收费

我该怎么办?

任何建议

Hello

I''m trying to use the navigate from mvvm in wpf but I can not get me to charge the page

what should I do??

any suggestions

推荐答案

我有此框架Window Home.xaml

I have this frame Window Home.xaml

<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
          <StackPanel x:Name="LinksStackPanel" Orientation="Horizontal" >
          </StackPanel>
          <Frame Name="FrameWithinGrid" Source="Views/PricipalPage.xaml" NavigationUIVisibility="Hidden" Margin="0,52,0,0"  />
      </StackPanel>







private void mainMenu_Click(object sender, RoutedEventArgs e)
       {
           MenuItem mi = (MenuItem)e.OriginalSource;
           node a = mi.DataContext as node;
           this.FrameWithinGrid.Navigate(new Uri(a.ruta, UriKind.Relative));
       }





我有一个菜单,到目前为止,所有帖子都可以通过该菜单进行操作

加载页面后,我想将此网站推送到另一个页面,但是此开关已连接到命令viewmodel
这是viewmodel






I have a menu from which the pages of this post so far everything works

When I have loaded a page I want to push this website is directed to another page, but this switch is connected to a command viewmodel
this is the viewmodel


public class RentarInmueblesViewModel : ViewModelBase
    {


public RentarInmueblesViewModel()
       {


}
       //public string txtFiltro { get; set; }
       private ICommand _SelectInmueblesCommand;
       public ICommand SelectInmueblesCommand
       {
           get
           {
               if (_SelectInmueblesCommand == null)
               {
                   _SelectInmueblesCommand = new DelegateCommand(SelectInmuebles);
               }
               return _SelectInmueblesCommand;
           }
       }
      <pre lang="cs">private void SelectInmuebles()


{

在这里,我会将代码地址转到另一页

}
}
}





有关
NavigationService.Navigate(new Uri("/Views/ClientesAgenciasPage.xaml",UriKind.Relative));





{

Here I would go the code addresses to another page

}
}
}




concerned with

NavigationService.Navigate(new Uri("/Views/ClientesAgenciasPage.xaml", UriKind.Relative));




but without any resltado
I asked a lot and did not find any way to do


这个


这篇关于WPF导航MVVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆