zoukankan      html  css  js  c++  java
  • Windows phone7 动态添加控件

    Windows phone7 动态添加控件
    2011-03-29 3:48

    using System;
    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 Microsoft.Phone.Controls;


    namespace testbywgscd
    {
        public partial class MainPage : PhoneApplicationPage
        {
            // Constructor
            public MainPage()
            {
                InitializeComponent();
            }

            private void button1_Click(object sender, RoutedEventArgs e)
            {

                for (int i = 0; i < 5; i++)
                {

                    var checkbox = new CheckBox
                    {

                        Content = "inbox",

                        HorizontalAlignment = HorizontalAlignment.Left,

                        VerticalAlignment = VerticalAlignment.Top,

                        FontFamily = new FontFamily("Calibri"),
                        FontSize = 30,
                        Margin= new Thickness(11,i*101,0,0),
                        Width=101,
                        Height=101,
            

                    };

                checkbox.Checked +=new RoutedEventHandler(checkbox_Checked);
                ContentPanel.Children.Add(checkbox); //ContentPanel is  grid control
              //  FrameworkDispatcher.Update();

                    //  Grid.SetRow(checkbox, i + 10);
                    // Grid.SetRow(checkbox, i + 10);

                }

            }

            void checkbox_Checked(object o, RoutedEventArgs e) {

                MessageBox.Show("hello6");
          
           
            }


        }
    }

  • 相关阅读:
    Jenkins自定义变量共享
    HTML中调用JavaScript的几种情况和规范写法
    [Python] 建 Django 项目
    [Django] Window上通过IIS发布Django网站
    [Python] 怎么把HTML的报告转换为图片,利用无头浏览器
    VMware vSphere Client
    mysql优化
    LINUX 内核的优化
    sed强大的固定替换格式
    nfs以及优化
  • 原文地址:https://www.cnblogs.com/songtzu/p/2434531.html
Copyright © 2011-2022 走看看