如何在框架中加载带窗口的页面 [英] HOW to load a page with window in a frame

查看:58
本文介绍了如何在框架中加载带窗口的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







在主窗口中,我有框架,我想在此框架中加载页面,此页面包含用户控制可以指导我或发送片段

 <  窗口    x:class   =  Mydemo.MainWindow    xmlns:x   = #unknown >  
xmlns =http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x =http://schemas.microsoft.com/winfx/2006/xaml
Title =MainWindowHeight =300Width =300>
< grid >
< 框架 名称 = sdkFrame 背景 = WhiteSmoke 来源 = Page1.xaml NavigationUIVisibility = 可见 / >
< span class =code-keyword>< / grid >
< / window >



  public  MainWindow()
{
InitializeComponent ();
.sdkFrame.Navigate( new Uri( Page1.xaml,UriKind.Relative));

}

解决方案

我不明白。你已经加载了page1。你想动态改变吗?如果你想在你的框架中加载其他页面,例如点击事件,你可以使用

 this.sdkFrame.Source = new Uri(Page2.xaml,UriKind 。相对); 


Hi,


In Main Window , I have frame ,i want to load page in this frame ,this page contains user control can u guide me or send snippets

<window x:class="Mydemo.MainWindow" xmlns:x="#unknown">
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="300" Width="300">
    <grid>
        <Frame Name="sdkFrame" Background="WhiteSmoke" Source="Page1.xaml" NavigationUIVisibility="Visible" />
    </grid>
</window>


public MainWindow()
        {
            InitializeComponent();
            this.sdkFrame.Navigate(new Uri("Page1.xaml", UriKind.Relative));

        }

解决方案

I don't get it. You've already loaded the page1. Do you want to dynamically change it? If you want to load other page in your frame, such as by click event, you can use

this.sdkFrame.Source = new Uri("Page2.xaml", UriKind.Relative);


这篇关于如何在框架中加载带窗口的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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