WPF风格的DatePicket Prev&下一步按钮

时间:2017-02-09 11:37:36

标签: c# wpf xaml

这是我的 MainWindow.xaml

<Window x:Class="DatePicker.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:DatePicker"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Styles/FormElements.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Grid>
        <DatePicker HorizontalAlignment="Left" Margin="127,59,0,0" VerticalAlignment="Top" >

        </DatePicker>
    </Grid>
</Window>

我想从 FormElements.xaml

加载样式
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType ="{x:Type DatePicker}">
        <Setter Property="Height" Value="24" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Background" Value="Red"/>
    </Style>

    <Style TargetType="{x:Type DatePickerTextBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <TextBox x:Name="PART_TextBox" IsReadOnly="True" Text="{Binding Path=SelectedDate, TargetNullValue='mm/dd/yyyy', StringFormat={}{0:MM/dd/yyyy}, RelativeSource={RelativeSource AncestorType={x:Type DatePicker}}}" BorderThickness="0"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>

如何控制PREV&amp;日历弹出窗口中的NEXT按钮?我想改变 PREV &amp; NEXT 按钮(仅限那些)

这是项目代码link

0 个答案:

没有答案