zoukankan      html  css  js  c++  java
  • xamarin学习之路 例一、嵌入网页

    用Xamarin嵌入网页

     1、新建一个页面如下图

         

    相对应当页面代码如下:

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

    x:Class="App_ERP.View.Core.Views.UseWebView">

     
    <ContentPage.ToolbarItems>
    <ToolbarItem Text="刷新" Command="{Binding RefreshCmd}" />
    </ContentPage.ToolbarItems>
    <StackLayout>

    <Label Text="{Binding MainText}" />

    <WebView Source="{Binding DataSource}"
    HeightRequest="1000"
    WidthRequest="1000" />
    </StackLayout>

    </ContentPage>

    2、后台对应的model 代码

      

    [MasterItem]
    public class UseWebViewModel 
    {
    public string MainText { get; set; }
    public string DataSource { get; set; }

    //刷新事件

    public ICommand RefreshCmd { get; set; } 


     
    public UseWebViewModel(SimpleContainer container)
    {

    DisplayName = "嵌入网页";
    Icon = "icon_setting.png";
    MainText = "holle word";
    DataSource = "https://www.baidu.com";

    //刷新事件

    this.RefreshCmd = new Command(() => this.LoadData());
    }

    public async void LoadData()
    {
    NotifyOfPropertyChange(() => this.DataSource);
    }

    个人做的小例子,后续继续加油,

  • 相关阅读:
    Shell编程笔记
    Git学习笔记
    JavaScript+jQuery实现简单的动态菜单
    JSON表单提交(ajax异步刷新)
    Json简单实例
    jsp分页
    浅谈this关键字
    Servlet+Javabean+Html实现简单的查询.删除.修改.添加四个功能
    Tomcat的安装与在myeclips中的配置
    jsp页面实现增删修改和查询
  • 原文地址:https://www.cnblogs.com/fmcn/p/6049158.html
Copyright © 2011-2022 走看看