if (strXapOrXaml == "xaml") { string[] s = { "ClIEntBin" }; //这里控制是相对地址还是绝对地址 string url = ""; if (menuUrl.StartsWith("http://")) { url = menuUrl.ToString().Trim(); } else { url = App.Current.Host.source.OriginalString.ToString().Split(s,StringSplitoptions.RemoveEmptyEntrIEs)[0] + menuUrl.ToString().Trim(new char[] { '.','/' }); } cpt.frmMain.Navigate(new Uri("/AspxContainer.xaml?tourl=" + url,UriKind.relative)); tchA.imgRefresh.Tag = url; //获取页面URL地址并赋值 2013-01-30 }
这里比如url中带多个参数:
./YSQ/page2.aspx?stype=2&sdefault=0
<navigation:Page x:Class="WebMain.AspxContainer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/Expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:navigation="clr-namespace:System.windows.Controls;assembly=System.windows.Controls.Navigation" xmlns:divtools="clr-namespace:divelements.SilverlightTools;assembly=divelements.SilverlightTools" d:DesignWIDth="640" d:DesignHeight="480" title="AspxContainer Page"> <GrID x:name="LayoutRoot"> <divtools:HTMLHost x:name="HTMLPlaceholderHost1" SourceUri="http://www.baIDu.com" margin="0,0"/> </GrID></navigation:Page>
using System;using System.Collections.Generic;using System.linq;using System.Net;using System.windows;using System.windows.Controls;using System.windows.documents;using System.windows.input;using System.windows.Media;using System.windows.Media.Animation;using System.windows.Shapes;using System.windows.Navigation;namespace WebMain{ public partial class AspxContainer : Page { public AspxContainer() { InitializeComponent(); } // 当用户导航到此页面时执行。 protected overrIDe voID OnNavigatedTo(NavigationEventArgs e) { if (this.NavigationContext.queryString.ContainsKey("tourl")) { //加载页面 string url = e.Uri.ToString().Substring(26); //去掉前面的字符串/AspxContainer.xaml?tourl= this.HTMLPlaceholderHost1.sourceUri = new Uri(url,UriKind.relativeOrabsolute); } } protected overrIDe voID OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); } }}
在重构函数OnNavigatedTo函数中使用参数e的Uri属性,是解决这个问题的关键!
总结以上是内存溢出为你收集整理的Silverlight之Frame传递多个参数并获取完整参数全部内容,希望文章能够帮你解决Silverlight之Frame传递多个参数并获取完整参数所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)