TDateTimeView.xaml 13.6 KB
<!--
    ****************************************************************
    * 作    者 :姜  彦
    * 项目名称 :RCS.WinClient.Controls.View
    * 控件名称 :TDateTimeView
    * 命名空间 :RCS.WinClient.Controls.View
    * CLR 版本 :4.0.30319.42000
    * 创建时间 :2017/8/4 9:10:14
    * 当前版本 :1.0.0.1
    * My  Email:771078740@qq.com
    * 描述说明:
    *
    * 修改历史:
    *
    ****************************************************************
    * Copyright @ JiangYan 2018 All rights reserved
    ****************************************************************
-->
<UserControl
    x:Class="RCS.WinClient.Controls.View.TDateTimeView"
    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:my="clr-namespace:RCS.WinClient.Controls.View"
    d:DesignHeight="252"
    d:DesignWidth="235"
    Loaded="UserControl_Loaded"
    mc:Ignorable="d">

    <UserControl.Resources>

        <Style x:Key="CommonDataGridStyle" TargetType="DataGrid">
            <!--  网格线颜色  -->
            <Setter Property="Background" Value="#829db2" />
            <Setter Property="BorderBrush" Value="#00c5d6e6" />
            <Setter Property="HorizontalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#d2d2d2" />
                </Setter.Value>
            </Setter>
            <Setter Property="VerticalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#d2d2d2" />
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="CommonDataGridColumnHeaderStyle" TargetType="DataGridColumnHeader">
            <Setter Property="SnapsToDevicePixels" Value="True" />
            <Setter Property="MinWidth" Value="0" />
            <Setter Property="MinHeight" Value="28" />
            <Setter Property="Foreground" Value="#ffffff" />
            <Setter Property="FontSize" Value="12" />
            <Setter Property="Cursor" Value="Hand" />
            <Setter Property="Height" Value="25" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="DataGridColumnHeader">
                        <Border
                            x:Name="BackgroundBorder"
                            Width="Auto"
                            BorderBrush="#c1d8e8"
                            BorderThickness="0,0,0,1">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <ContentPresenter
                                    Margin="0,0,0,0"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center" />
                                <Path
                                    x:Name="SortArrow"
                                    Grid.Column="2"
                                    Width="8"
                                    Height="6"
                                    Margin="0,0,50,0"
                                    VerticalAlignment="Center"
                                    Data="M0,0 L1,0 0.5,1 z"
                                    Fill="White"
                                    RenderTransformOrigin="1,1"
                                    Stretch="Fill"
                                    Visibility="Collapsed" />
                                <Rectangle
                                    Grid.ColumnSpan="1"
                                    Width="1"
                                    HorizontalAlignment="Right"
                                    Fill="#c1d8e8" />
                                <!--<TextBlock  Background="Red">
                                <ContentPresenter></ContentPresenter></TextBlock>-->
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="CommonDataGridRowStyle" TargetType="DataGridRow">
            <Setter Property="Background" Value="#F2F2F2" />
            <Setter Property="Foreground" Value="Black" />
            <Style.Triggers>
                <!--  隔行换色  -->
                <Trigger Property="AlternationIndex" Value="0">
                    <Setter Property="Background" Value="#ffffff" />
                </Trigger>
                <Trigger Property="AlternationIndex" Value="1">
                    <Setter Property="Background" Value="#ffffff" />
                </Trigger>
                <!--<Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="LightGray"/>
                </Trigger>-->
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="#ffffff" />
                    <Setter Property="Foreground" Value="Black" />
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="CommonButtonStyle" TargetType="{x:Type Button}">
            <Setter Property="FontSize" Value="12" />
            <Setter Property="Foreground" Value="Black" />
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border
                            x:Name="ButtonBorder"
                            Margin="0"
                            Background="#FFFFFF"
                            BorderThickness="1"
                            CornerRadius="3"
                            SnapsToDevicePixels="True">
                            <!--  Background="#FFFFFF"按钮背景颜色 姜彦20180420 0937  -->
                            <Grid>
                                <ContentPresenter
                                    Margin="0,0,0,0"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center" />
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="true">
                                <Setter TargetName="ButtonBorder" Property="Opacity" Value="0.5" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter TargetName="ButtonBorder" Property="Background" Value="#d8d8d8" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="CommonButtonStyle2" TargetType="{x:Type Button}">
            <Setter Property="FontSize" Value="12" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border
                            x:Name="ButtonBorder"
                            Margin="0"
                            Background="{TemplateBinding Background}"
                            BorderThickness="1"
                            CornerRadius="3"
                            SnapsToDevicePixels="True">
                            <!--  Background="#FFFFFF"按钮背景颜色 姜彦20180420 0937  -->
                            <Grid>
                                <ContentPresenter
                                    Margin="0,0,0,0"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center" />
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="true">
                                <Setter TargetName="ButtonBorder" Property="Opacity" Value="0.5" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter TargetName="ButtonBorder" Property="Background" Value="#d8d8d8" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </UserControl.Resources>

    <Border BorderBrush="#FF93C2F8" BorderThickness="1">

        <Grid
            Width="185"
            Height="229"
            Background="White">

            <Grid.RowDefinitions>
                <RowDefinition Height="24" />
                <RowDefinition Height="186*" />
                <RowDefinition Height="39" />

            </Grid.RowDefinitions>

            <Grid Grid.Row="0" Background="#FFAFCCF8">
                <TextBlock
                    x:Name="tbTitle"
                    Margin="70,0,0,0"
                    VerticalAlignment="Center"
                    FontSize="12"
                    Foreground="White"
                    Text="日期时间" />

                <my:IconButton
                    x:Name="iBtnCloseView"
                    Width="18"
                    Height="18"
                    Margin="165,3,0,0"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    Click="iBtnCloseView_Click"
                    Icon="pack://application:,,,/Controls/Image/close.png" />

            </Grid>

            <Grid Grid.Row="1">
                <Calendar
                    Name="calDate"
                    Width="186"
                    Height="165"
                    Margin="0,0,0,0"
                    VerticalAlignment="Top"
                    PreviewMouseUp="calDate_PreviewMouseUp" />

            </Grid>

            <Grid Grid.Row="2" Margin="0,0,0,6">

                <Border
                    x:Name="TDateTime2"
                    Height="23"
                    Margin="35,-1,84,0"
                    BorderBrush="#FFA6D4F8"
                    BorderThickness="1" />


                <Label
                    Name="lblTime"
                    Height="28"
                    Margin="2,0,0,0"
                    HorizontalAlignment="Left"
                    Content="时间" />

                <Button
                    Name="btnhh"
                    Width="18"
                    Height="23"
                    Margin="36,3,0,6"
                    HorizontalAlignment="Left"
                    Click="btnhh_Click"
                    Content="18"
                    Style="{StaticResource CommonButtonStyle}" />



                <TextBlock
                    Name="textBlockh"
                    Height="23"
                    Margin="55,8,0,6"
                    HorizontalAlignment="Left"
                    Text=":" />

                <Button
                    Name="btnmm"
                    Width="18"
                    Height="23"
                    Margin="56,3,0,6"
                    HorizontalAlignment="Left"
                    Click="btnmm_Click"
                    Content="18"
                    Style="{StaticResource CommonButtonStyle}" />

                <TextBlock
                    Name="textBlockm"
                    Height="23"
                    Margin="75,8,0,6"
                    HorizontalAlignment="Left"
                    Text=":" />

                <Button
                    Name="btnss"
                    Width="18"
                    Height="23"
                    Margin="78,3,0,6"
                    HorizontalAlignment="Left"
                    Click="btnss_Click"
                    Content="20"
                    Style="{StaticResource CommonButtonStyle}" />

                <Button
                    Name="btnNow"
                    Width="36"
                    Height="23"
                    Margin="105,0,0,6"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Bottom"
                    Background="LightBlue"
                    Click="btnNow_Click"
                    Content="当前"
                    Foreground="White"
                    Style="{StaticResource CommonButtonStyle2}" />

                <Button
                    Name="btnOK"
                    Width="39"
                    Height="23"
                    Margin="143,0,0,6"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Bottom"
                    Background="#ecc158"
                    Click="btnOK_Click"
                    Content="确定"
                    Foreground="White"
                    Style="{StaticResource CommonButtonStyle2}" />

            </Grid>

            <Grid
                x:Name="girdChioce"
                Margin="5,188,0,40"
                VerticalAlignment="Top"
                Background="Transparent">
                <Popup
                    x:Name="popChioce"
                    AllowsTransparency="True"
                    IsOpen="False"
                    Placement="Top"
                    PlacementTarget="{Binding ElementName=girdChioce}"
                    PopupAnimation="Fade"
                    StaysOpen="False" />
            </Grid>


        </Grid>

    </Border>

</UserControl>