zoukankan      html  css  js  c++  java
  • xamarin.forms 主明细界面

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Reflection.Emit;
    using System.Text;
    
    using Xamarin.Forms;
    
    namespace PageApp
    {
        public class MainMasterPage : MasterDetailPage
        {
            public MainMasterPage()
            {
                Label header = new Label
                {
                    Text = "MasterDetailPage",
                    Font = Font.BoldSystemFontOfSize(30),
                    HorizontalOptions = LayoutOptions.Center
                };
                int[] a = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 11, 11, 22, 112 };
                ListView listView = new ListView
                {
                    ItemsSource = a
                };
                listView.ItemSelected += ListView_ItemSelected;
                Master = new ContentPage
                {
                    Title = header.Text,
                    Content = new StackLayout
                    {
                        Children =
                        {
                            header,
                            listView
                        }
                    }
                };
                Detail = new ContentPage() { Content = new Label() { Text = "测试" } };
            }
    
            private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
            {
                this.Detail = new ContentPage() { Content = new Label() { Text =  e.SelectedItem.ToString() } };
                //if (Device.OS == TargetPlatform.Android)
                //{
                //    this.Navigation.PopAsync();
                    
                //}
            }
        }
    }
    

      

  • 相关阅读:
    poj2828 Buy Tickets
    bzoj2724: [Violet 6]蒲公英
    0x41 并查集
    poj1733 Parity game
    poj2976 Dropping tests
    poj1704 Georgia and Bob
    bzoj4517: [Sdoi2016]排列计数
    poj2947Widget Factory
    0x3A 博弈论之SG函数
    我国已累计招收培养14万余名博士后
  • 原文地址:https://www.cnblogs.com/iaisoft/p/6530717.html
Copyright © 2011-2022 走看看