现代用户界面如何去到另一个页面从另一个链接 [英] Modern UI how to go to another page from another link

查看:480
本文介绍了现代用户界面如何去到另一个页面从另一个链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用CodePlex从现代UI。这是伟大的,易于使用,但也有一些课程和活动,我不熟悉。例如:我有一个名为病人和配置两GroupLinks。有在每个GroupLinks几页。我试图从浏览一个网页到另一个使用一个按钮单击事件。有效。但是,当我试图从GroupLink2的第一页浏览到GroupLink1的第一页,它仍然工作,但问题是活跃GroupLink留在GroupLink2而不是GroupLink1就像截图如下显示:







顺便说一句,我使用的代码背后过敏(IrritantPage),以PatientsPage导航:

 私人无效FilterControl_OnToPatientClick (对象发件人,RoutedEventArgs E)
{
NavigationCommands.GoToPage.Execute(/ MainContents / PatientGridPage.xaml,这一点);
}



那么,如何解决这个问题?



下面是我的主窗口,患者的标签页和配置的列表页



现代之窗(主窗口)

 < MUI:ModernWindow X:类=DentalProto.MainWindow
的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/演示
的xmlns:X =http://schemas.microsoft.com/winfx/2006/xaml
的xmlns:MUI =http://firstfloorsoftware.com/ModernUI
标题=牙科IsTitleVisible =真
WindowStartupLocation =中心屏幕
宽度=1200
HEIGHT =720
ContentSource =/页/ MainTabPage.xaml
闭幕=MainWindow_OnClosing
>

< MUI:ModernWindow.MenuLinkGroups>
< MUI:LinkGroup显示名称=用户名>
< MUI:LinkGroup.Links>

< MUI:链接显示名称=病人源=/页/ MainTabPage.xaml/>
< MUI:链接显示名称=配置源=/页/ ConfigurationsListNav.xaml/>

< /梅:LinkGroup.Links>
< /梅:LinkGroup>

< MUI:LinkGroup显示名称=设置GroupKey =设置>
< MUI:LinkGroup.Links>
< MUI:链接显示名称=软件源=/页/ SettingsPage.xaml/>
< /梅:LinkGroup.Links>
< /梅:LinkGroup>
< /梅:ModernWindow.MenuLinkGroups>

< MUI:ModernWindow.TitleLinks>
< MUI:链接显示名称=设置源=/页/ SettingsPage.xaml/>
< MUI:链接显示名称=帮助来源=htt​​ps://www.facebook.com//>
< /梅:ModernWindow.TitleLinks>
< /梅:ModernWindow>



MAINTAB PAGE(病人页)

 <用户控件X:类=DentalProto.Pages.MainTabPage
的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/presentation
的xmlns:X =htt​​p://schemas.microsoft.com/winfx/2006/xaml
的xmlns:MC =htt​​p://schemas.openxmlformats.org/markup-compatibility/2006
的xmlns:D =htt​​p://schemas.microsoft.com/expression/blend/2008
的xmlns:MUI =htt​​p://firstfloorsoftware.com/ModernUI

MC:可忽略=D
D:DesignHeight =300D:DesignWidth =1280>
<网格和GT;
< - TODO:设置@SelectedSource - >
< MUI:ModernTab布局=标签>
< MUI:ModernTab.Links>
< - TODO:设置@Source - >

< MUI:链接显示名称=病人源=/ MainContents / PatientGridPage.xaml/>
< MUI:链接显示名称=处理记录源=/ MainContents / TreatmentFillInPage.xaml/>

< /梅:ModernTab.Links>
< /梅:ModernTab>
< /网格和GT;
< /用户控件>



CONFIGURATIONLISTNAV(配置页)

 <用户控件X:类=DentalProto.Pages.ConfigurationsListNav
的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/presentation
的xmlns:X =htt​​p://schemas.microsoft.com/winfx/2006/xaml
的xmlns:MC =htt​​p://schemas.openxmlformats.org/markup-compatibility/2006
的xmlns:D =htt​​p://schemas.microsoft.com/expression/blend/2008
的xmlns:MUI =htt​​p://firstfloorsoftware.com/ModernUI
MC:可忽略= D
D:DesignHeight =300D:DesignWidth =300>
<网格样式={StaticResource的ContentRoot}>
< - TODO:设置@SelectedSource - >
< MUI:ModernTab布局=列表>
< MUI:ModernTab.Links>
< - TODO:设置@Source - >
< MUI:链接显示名称=过敏源=/ MainContents / IrritantGridPage.xaml/>
< MUI:链接显示名称=健康疾病源=/ MainContents / HealthDiseaseGridPage.xaml/>
< MUI:链接显示名称=口病源=/ MainContents / MouthDiseaseGridPage.xaml/>
< MUI:链接显示名称=办法来源=/ MainContents / ProcedureGridPage.xaml/>
< MUI:链接显示名称=牙医源=/ MainContents / DentistGridPage.xaml/>
< /梅:ModernTab.Links>
< /梅:ModernTab>
< /网格和GT;
< /用户控件>


解决方案

您在混合的页面导航与标签在ModernTab控件中导航。



如果你调用 NavigationCommands.GoToPage.Execute A ModernTab控件内您要改变当前的标签,而不是。目前的页面



要更改顶层页面,您可以使用:

  IInputElement目标= NavigationHelper.FindFrame(_顶,本); 
NavigationCommands.GoToPage.Execute(/页/ BasicPage1.xaml,目标);

如果新的页面是另一个ModernTab并且要选择不同的选项卡,然后默认的,那么你要到位一些额外的代码。
在例如,你可以将参数传递给新的一页。
SE这 SO 答案。


I am currently using Modern UI from CodePlex. It is great and easy to use but there are some classes and events that I am not familiar with. Example: I have two GroupLinks named "Patients" and "Configurations". There are several pages in each of the GroupLinks. I tried to navigate from one page to another using a button click event. It worked. But when I tried navigating from Page1 of GroupLink2 to Page1 of GroupLink1, it still worked, but the problem was the active GroupLink remained in GroupLink2 instead of GroupLink1 just like the screenshots show below:

Btw, I used the code behind to navigate from Allergies(IrritantPage) to PatientsPage:

private void FilterControl_OnToPatientClick(object sender, RoutedEventArgs e)
    {            
        NavigationCommands.GoToPage.Execute("/MainContents/PatientGridPage.xaml", this);
    }

So how do I solve this?

here are my MainWindow, Patient's Tab Page and Configuration's List Page

MODERN WINDOW (Main Window)

<mui:ModernWindow x:Class="DentalProto.MainWindow"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                  xmlns:mui="http://firstfloorsoftware.com/ModernUI"
                  Title="Dental" IsTitleVisible="True"
                  WindowStartupLocation="CenterScreen"
                  Width="1200"
                  Height="720"                       
                  ContentSource="/Pages/MainTabPage.xaml"
                  Closing="MainWindow_OnClosing"
                  >

    <mui:ModernWindow.MenuLinkGroups>
        <mui:LinkGroup DisplayName="User Name">
            <mui:LinkGroup.Links>

                <mui:Link DisplayName="Patients" Source="/Pages/MainTabPage.xaml" />
                <mui:Link DisplayName="Configurations" Source="/Pages/ConfigurationsListNav.xaml" />

            </mui:LinkGroup.Links>
        </mui:LinkGroup>

        <mui:LinkGroup DisplayName="settings" GroupKey="settings">
            <mui:LinkGroup.Links>
                <mui:Link DisplayName="software" Source="/Pages/SettingsPage.xaml" />
            </mui:LinkGroup.Links>
        </mui:LinkGroup>
    </mui:ModernWindow.MenuLinkGroups>

    <mui:ModernWindow.TitleLinks>
        <mui:Link DisplayName="settings" Source="/Pages/SettingsPage.xaml" />
        <mui:Link DisplayName="help" Source="https://www.facebook.com/" />
    </mui:ModernWindow.TitleLinks>
</mui:ModernWindow>

MAINTAB PAGE (Patient Page)

<UserControl x:Class="DentalProto.Pages.MainTabPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"

             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="1280">
    <Grid >
        <!-- TODO: set @SelectedSource -->
        <mui:ModernTab Layout="Tab">
            <mui:ModernTab.Links>
                <!-- TODO: set @Source -->

                <mui:Link DisplayName="Patient" Source="/MainContents/PatientGridPage.xaml" />
                <mui:Link DisplayName="Treatment Record" Source="/MainContents/TreatmentFillInPage.xaml"/>

            </mui:ModernTab.Links>
        </mui:ModernTab>
    </Grid>
</UserControl>

CONFIGURATIONLISTNAV (Configurations' Page)

<UserControl x:Class="DentalProto.Pages.ConfigurationsListNav"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid Style="{StaticResource ContentRoot}">
        <!-- TODO: set @SelectedSource -->
        <mui:ModernTab Layout="List">
            <mui:ModernTab.Links>
                <!-- TODO: set @Source -->
                <mui:Link DisplayName="Allergies" Source="/MainContents/IrritantGridPage.xaml"/>
                <mui:Link DisplayName="Health Diseases" Source="/MainContents/HealthDiseaseGridPage.xaml"/>
                <mui:Link DisplayName="Mouth Diseases" Source="/MainContents/MouthDiseaseGridPage.xaml"/>
                <mui:Link DisplayName="Procedures"  Source="/MainContents/ProcedureGridPage.xaml"/>
                <mui:Link DisplayName="Dentists" Source="/MainContents/DentistGridPage.xaml"/>
            </mui:ModernTab.Links>
        </mui:ModernTab>
    </Grid>
</UserControl>

解决方案

You are mixing "page" navigation with "tab" navigation inside the ModernTab control.

If you call NavigationCommands.GoToPage.Execute inside a ModernTab control you are changing the current "tab", not the current "page".

To change the top level page you can use:

IInputElement target = NavigationHelper.FindFrame("_top", this);
NavigationCommands.GoToPage.Execute("/Pages/BasicPage1.xaml", target);

If the new page is another ModernTab and you want to select a different tab then the default one, then you have to put in place some extra code. In example you could pass parameters to the new page. Se this SO answer.

这篇关于现代用户界面如何去到另一个页面从另一个链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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