zoukankan      html  css  js  c++  java
  • 【概念】细说wpf控件

    1、细说wpf控件

    https://www.cnblogs.com/huangxincheng/archive/2012/07/09/2582062.html

    2、用户控件

    (1)创建xaml(选择用户控件WPF)

     1 <UserControl x:Class="WpfApplication8.AddProduct"
     2              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     3              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     4              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     5              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     6              mc:Ignorable="d"
     7              d:DesignHeight="200" d:DesignWidth="300">
     8     <Grid Height="171" Width="262">
     9         <TextBlock Height="20" HorizontalAlignment="Left" Margin="28,57,0,0" Name="textBlock1" Text="名称:" VerticalAlignment="Top" Width="42" />
    10         <TextBlock Height="20" HorizontalAlignment="Left" Margin="28,92,0,0" Name="textBlock2" Text="价格:" VerticalAlignment="Top" Width="42" />
    11         <TextBox Height="23" HorizontalAlignment="Left" Margin="76,54,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" />
    12         <TextBox Height="23" HorizontalAlignment="Left" Margin="76,92,0,0" Name="textBox2" VerticalAlignment="Top" Width="120" />
    13     </Grid>
    14 </UserControl>

    (2)在MainWindow中引用

    1 <Window x:Class="WpfApplication8.MainWindow"
    2         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    3         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    4         xmlns:local="clr-namespace:WpfApplication8"
    5         Title="MainWindow" Height="350" Width="525">
    6     <Grid>
    7         <local:AddProduct x:Name="test"/>
    8     </Grid>
    9 </Window>
    /*******相与枕藉乎舟中,不知东方之既白*******/
  • 相关阅读:
    C#操作EXcel
    ADO.NET 导出 Excel 文件
    基于jQuery的数字键盘插件
    Python爬虫(三)——正则表达式
    python爬虫(二)——第一个爬虫程序
    python爬虫学习(一)——爬虫的工作原理
    斜率优化DP学习笔记
    可持久化线段树学习笔记
    尺取法学习笔记
    分层图学习笔记
  • 原文地址:https://www.cnblogs.com/Mars-0603/p/14382248.html
Copyright © 2011-2022 走看看