none
DatePicker / Template / Popup can i add a ContentPresenter? RRS feed

  • Question

  • Hi,

    i search for a way to add open and close Animations to the datepicker popup. My problem is the popup itself, in the standard template: there is no content inside the popup, it get the content only by his Name "Part_Popup" - there is no way to add a ContentPresenter as Content? How can the Binding look like?

    Thanks for ideas.



    • Edited by Jochen Peter Wednesday, May 23, 2012 9:57 AM
    • Moved by Robert Breitenhofer Thursday, May 24, 2012 2:36 PM English instead German (From:Windows Presentation Foundation (WPF))
    Wednesday, May 23, 2012 9:47 AM

All replies

  • Hi Jochen,

    Does the popup of Datepicker is the Calendar that when user pick up date? Then content of a Calendar should not be empty, could you please specific your issue? And it is better to post some relative code here, so that we can better help you.

    Generally speaking, we change the CalendarStyle of Datepicker to Style what you talk about Calendar popup.

    Have a nice day.


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us


    Friday, May 25, 2012 6:41 AM
    Moderator
  • Hi Jochen,

    Any updates?

    In additional, I think you can use property CalendarStyle of DatePicker to change the Calendar's template, to add a contentPresenter into your Calendar to achieve your goal. You can use Blend to easily change the template of Calendar as you want.

    And at the same time I create a little Calendar open and close animation in DatePicker for your reference:

    <Window.Resources>
            <Style TargetType="Calendar" x:Key="myCalendar">
                <Style.Triggers>
                    <EventTrigger RoutedEvent="GotFocus">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation From="0" To="200" Storyboard.TargetProperty="Width" Duration="0:0:5"/>
                                <DoubleAnimation From="0" To="150" Storyboard.TargetProperty="Height" Duration="0:0:5"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                    <EventTrigger RoutedEvent="MouseLeave">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation From="200" To="0" Storyboard.TargetProperty="Width" Duration="0:0:5"/>
                                <DoubleAnimation From="150" To="0" Storyboard.TargetProperty="Height" Duration="0:0:5"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Style.Triggers>
            </Style>
           
        </Window.Resources>
        <Grid>
            <DatePicker Width="150" Height="50"  CalendarStyle="{StaticResource myCalendar}">
            </DatePicker>
             </Grid>

    Hope it helps.

    Have a nice day.


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us

    Monday, June 4, 2012 9:17 AM
    Moderator