wp7 webbrowser 添加依赖属性content
来源:互联网 发布:php编译安装5.6.31 编辑:程序博客网 时间:2024/06/05 16:36
using Microsoft.Phone.Controls;
using System;
using System.Windows;
namespace CommonUI.AttachedProperty
{
///<summary>
/// Atttached property for WebBrowser control, bind a html string to display as web page in web browser
///</summary>
publicclassWebBrowserContentBinding
{
///<summary>
/// attached property Content
///</summary>
publicstaticreadonlyDependencyProperty ContentProperty = DependencyProperty.RegisterAttached("Content",typeof(string),typeof(WebBrowserContentBinding),newPropertyMetadata(OnContentChanged));
///<summary>
/// Get value of attached property Content
///</summary>
///<param name="obj">WebBrowser object</param>
///<returns>the value of Content property </returns>
publicstaticstring GetContent(WebBrowser obj)
{
return (string)obj.GetValue(ContentProperty);
}
///<summary>
/// Set the value of attached property Content
///</summary>
///<param name="obj">WebBrowser object</param>
///<param name="content">the value that set to property Content</param>
publicstaticvoid SetContent(WebBrowser obj, string content)
{
obj.SetValue(ContentProperty, content);
}
privatestaticvoid OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var webBrowser = d asWebBrowser;
if (webBrowser == null)
{
thrownewInvalidOperationException(string.Format("WebBrowserContentBinding attached property only can be used in WebBrowser, you are using in {0}", d.GetType().Name));
}
webBrowser.LoadCompleted += WebBrowser_LoadCompleted;
webBrowser.NavigateToString(e.NewValue.ToString());
}
privatestaticvoid WebBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
var wb = sender asWebBrowser;
wb.LoadCompleted -= WebBrowser_LoadCompleted;
wb.Visibility =Visibility.Visible;
}
}
}
- wp7 webbrowser 添加依赖属性content
- WP7 - WebBrowser + InvokeScript异常
- Wp7 中 webbrowser 页面跳转
- 解决wp7 WebBrowser 乱码问题
- Inject Javascript for WebBrowser control of WP7
- wp7 web WebBrowser 支持html5问题
- wp7 webbrowser+html5 打造本地应用程序(一)
- 谈谈 wp7 webbrowser+html5 的各种缺陷
- wp7 webbrowser+html5 强大的ScriptNotify事件
- wp7 webbrowser+html5 打造本地应用程序
- content属性
- WebBrowser-Inner/Outer属性
- webbrowser控件属性介绍
- DirectX编程属性需要添加的依赖项
- 自定义Panel中添加依赖属性需要注意的问题
- WPF整理-为User Control添加依赖属性
- WP7 如何禁用WebBrowser 控件缩放和左右移动
- WP7中WebBrowser的NavigateToString中文乱码问题
- 解决IOS7中读取不到通讯录的问题
- mysql时间
- C++虚基类的作用及使用1
- iPhone丢了怎么办-iPhone防盗及找回攻略大全
- 女人的美
- wp7 webbrowser 添加依赖属性content
- 设计模式之命令模式
- android 控件常用属性
- Android 02 Started Service--之被启动的服务
- 浮动(2)
- Ubuntu Linux系统的启动过程
- 使用MyEclipse2014从项目中删除东西时出现“Problems encountered while deleting resources”的解决办法。
- #Pragma 指令
- 对ViewPager的初次认识P