C#WPF页面-加载页面的最佳方式

C#WPF页面-加载页面的最佳方式,c#,wpf,C#,Wpf,我正在尝试制作一个WPF UI来跟踪发货/收货和库存等 我有多个页面,这将有许多辅助页面 我不想一行一行地做,让它们像这样可用: static public class Remote { static List<IPage> Pages = new List<IPage>(); static Remote() { Pages.Add(new pShipping()); Pages.Add(new pReceivin

我正在尝试制作一个WPF UI来跟踪发货/收货和库存等

我有多个页面,这将有许多辅助页面

我不想一行一行地做,让它们像这样可用:

static public class Remote
{
    static List<IPage> Pages = new List<IPage>();

    static Remote()
    {
        Pages.Add(new pShipping());
        Pages.Add(new pReceiving());
        Pages.Add(new pInventory());
        Pages.Add(new pCustomers());
        Pages.Add(new pAdmin());
    }
}
静态公共类远程
{
静态列表页=新列表();
静态远程()
{
添加(新的pShipping());
Pages.Add(新的previving());
Pages.Add(new pInventory());
添加(新的pccustomers());
Pages.Add(新pAdmin());
}
}

正如我说的,我真的不想这样做。有没有更好的方法在不预先加载的情况下导航页面,或者单独将页面添加到数组/列表中?

看看这是否有帮助:我之前也问过同样的问题。我发现这个方法很好。您仍然需要为页面声明数据模板,但这是一种稍微更干净、更具MVVM风格的方法。通过超链接导航可以避免页面的双重声明,但这与我的情况无关,我也不知道它是否在你的情况下。谢谢…看起来比我现在做的更糟哈哈。它仍在逐行执行:public NavigationViewModel(){EmpCommand=new BaseCommand(openep);DeptCommand=new BaseCommand(OpenDept);}