<UserControl 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:c="clr-namespace:System.Collections;assembly=mscorlib"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:cm="http://www.caliburnproject.org"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:my="clr-namespace:SimpleCRM" 
    x:Class="SimpleCRM.ViewModels.CustomerFormView" Height="500" Width="800">

    <UserControl.Resources>

        <Style x:Key="calendarStyle" TargetType="telerik:RadCalendar">
            <Setter Property="AreWeekNumbersVisible" Value="False" />
        </Style>

        <DataTemplate x:Key="MyTemplate">
            <Grid Margin="0" Width="760">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition MinHeight= "40" />
                    <RowDefinition MinHeight= "40"/>
                    <RowDefinition MinHeight= "40"/>
                    <RowDefinition MinHeight= "40"/>
                    <RowDefinition MinHeight= "40"/>
                </Grid.RowDefinitions>
                <my:MyDataFormDataField Grid.Column="0" Grid.Row="0" LabelWidth="100" Label="客户名称:" DataMemberBinding="{Binding Name, Mode=TwoWay}" />
                <my:MyDataFormDataField Grid.Column="0" Grid.Row="1" LabelWidth="100" Label="首次拜访:">
                    <telerik:RadDateTimePicker x:Name="datePicker" SelectedValue="{Binding CreateTime, Mode=TwoWay}"  InputMode="DatePicker"  CalendarStyle="{StaticResource calendarStyle}" />
                </my:MyDataFormDataField>
                <my:MyDataFormDataField Grid.Column="0" Grid.Row="2" LabelWidth="100" Label="客户地址:" DataMemberBinding="{Binding Address, Mode=TwoWay}" />
                <my:MyDataFormDataField Grid.Column="0" Grid.Row="3" LabelWidth="100" Label="客户电话:" DataMemberBinding="{Binding Tel, Mode=TwoWay}" />
                <my:MyDataFormDataField Grid.Column="0" Grid.Row="4" LabelWidth="100"  Label="备   注:" DataMemberBinding="{Binding Remark, Mode=TwoWay}" />

            </Grid>
        </DataTemplate>
    </UserControl.Resources>

    <telerik:RadDataForm  AutoEdit="True"  
                          AutoGenerateFields="False"                          
                          Margin="4" 
                          Header="添加客户"                         
                          ItemsSource="{Binding Items}" 
                          ReadOnlyTemplate="{StaticResource MyTemplate}" 
                          EditTemplate="{StaticResource MyTemplate}" 
                          NewItemTemplate="{StaticResource MyTemplate}" 
                          CancelButtonContent="取消" 
                          CommitButtonContent="确定" 
                          CommandButtonsVisibility="Commit,Cancel"  
                          Height="490">
    </telerik:RadDataForm>
</UserControl>