自定义控件.调用DateTimePickerZ

1、新建WPF应用程序:

  

 

2、在界面中 使用 自定义的WPF控件DateTimePickerZ

 2.1、在项目的"引用"中 加入 "E:\Project_vs2017\WpfCustomControlLibrary_DateTimePicker\WpfCustomControlLibrary_DateTimePicker\bin\Debug\WpfCustomControlLibrary_DateTimePicker.dll"

 2.2、在 界面中输入:"<DateTimePickerZ/>",然后自动fix 就会 解决问题问题:

  (1) 变成"<wpfcustomcontrollibrary_datetimepicker:DateTimePickerZ/>"

  (2) <Window>节点中加入 “ xmlns:wpfcustomcontrollibrary_datetimepicker="clr-namespace:WpfCustomControlLibrary_DateTimePicker;assembly=WpfCustomControlLibrary_DateTimePicker" ”

  ZC:上面 2步的 "wpfcustomcontrollibrary_datetimepicker" 可以改成别的字符串,如 "zz"

 2.3、修改后的 MainWIndow.xaml如下所示

<Window x:Class="WpfApp_Call_DateTimePickerZ.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp_Call_DateTimePickerZ"
        xmlns:zz="clr-namespace:WpfCustomControlLibrary_DateTimePicker;assembly=WpfCustomControlLibrary_DateTimePicker"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="220"/>
            <RowDefinition Height="100*"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0">
            <Border BorderBrush="Black" BorderThickness="2">
                <zz:DateTimePickerZ/>
            </Border>
            
        </Grid>
        <Grid Grid.Row="1"></Grid>
    </Grid>
</Window>

 

3、

4、

5、

 

posted @ 2019-09-26 21:00  csskill  阅读(581)  评论(0编辑  收藏  举报