zoukankan      html  css  js  c++  java
  • WPF控件开发的入门引导

    如果动态创建WPF控件,动态捕捉控件的事件,以及定义属性等,上图是我学习后的一个效果图,后续会把实现的代码直接贴上来,我相信看代码是众网友的强项。

    以下是我的工程文件预览:

    App.xaml没动过,是系统生成的。

    MainWindow.xaml

    [xaml代码]

    <Window x:Class="WpfMainApp.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
        <Grid Name="grdParent">
            <Button Content="Dynamic Load Wpf Control" Height="36" HorizontalAlignment="Left" Margin="12,263,0,0" Name="button1" VerticalAlignment="Top" Width="228" Click="button1_Click" />
            <Button Content="Set Wpf Control Content" Height="29" HorizontalAlignment="Left" Margin="254,12,0,0" Name="button2" VerticalAlignment="Top" Width="213" Click="button2_Click" />
            <TextBox Height="29" HorizontalAlignment="Left" Margin="12,12,0,0" Name="textBox1" VerticalAlignment="Top" Width="147" />
        </Grid>
    </Window>
    [CS代码]

    下面是控件的代码:

    EditPlus.xaml

    [xaml代码]

    <UserControl x:Class="WpfComctl.EditPlus"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 mc:Ignorable="d"
                 d:DesignHeight="300" d:DesignWidth="300" Name="EditPlusControl">
        <Grid Name="grdRoot"></Grid>
    </UserControl>

    [CS代码]

  • 相关阅读:
    ExtJS 开发总结 子曰
    解决讨厌的VS2008不能打开vs2010所创建的项目问题 子曰
    提高网站页面加载速度的黄金守则 子曰
    更新网站注意事项 子曰
    dhl:SQL_游标.sql
    jQuery 中插件的使用与开发启用Visual Studio 对jQuery的智能感知(含 jQuery1.3.2 for VS 的智能提示js文件)
    用jQuery在IFRAME里取得父窗口的某个元素的值
    图片上传预览是一种在图片上传之前对图片进行本地预览的技术。
    dhl:ajax无法跨域改用getJSON(解决服务器返回json数据中文为乱码的问题$.ajaxSetup({ scriptCharset: "utf8" , contentType: "application/json; chars)
    dhl: URL的编码问题。
  • 原文地址:https://www.cnblogs.com/yulinlover/p/1911851.html
Copyright © 2011-2022 走看看