Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7771429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:39:03+00:00 2026-06-01T16:39:03+00:00

I have the following DatePicker Control: <DatePicker SelectedDate={Binding DateFor} Style={StaticResource ButtonDatePicker}/> The ButtonDatePicker style

  • 0

I have the following DatePicker Control:

<DatePicker SelectedDate="{Binding DateFor}" Style="{StaticResource ButtonDatePicker}"/>

The ButtonDatePicker style is defined as below:

<Style x:Key="ButtonDatePicker" TargetType="{x:Type DatePicker}">
    <Setter Property="IsTodayHighlighted" Value="True"/>
    <Setter Property="SelectedDateFormat" Value="Short"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type DatePicker}">
                <Grid>
                    <Button x:Name="PART_Button" Content="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DatePicker}}, Path=SelectedDate.Date}"/>

                    <Grid IsHitTestVisible="False" Opacity="0">
                        <Popup x:Name="PART_Popup" AllowsTransparency="True" Placement="Bottom" StaysOpen="False"/>
                    </Grid>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

I want to bind the Content property of the PART_Button Button to the SelectedDate.Date property of the DatePicker itself. I tried like this:

Content="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DatePicker}}, Path=SelectedDate.Date}"

but it doesn’t work. The content of the Button is “Show calendar” (I didn’t set this) all the time like in the picture below.

enter image description here

Do you have any suggestions on this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:39:04+00:00Added an answer on June 1, 2026 at 4:39 pm

    Change the Button to use a TextBlock for its Content:

    <Button x:Name="PART_Button">
        <TextBlock Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DatePicker}}, Path=SelectedDate.Date}"/>
    </Button>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the object type returned by Datepicker? Supposing I have the following: $(#txtbox).datepicker({ onClose:
I have the two following datepicker objects but I can't get what I want
I have the following code datePicker.change(function(){ dateSet = datePicker.val(); dateMinimum = dateChange(); dateSetD =
I have the following init code for the datepicker, but the default 'Choose Date'
I have the following code: $(document).ready(function(){ $(.datepicker).each(function() { $(this).datepicker({ beforeShowDay: function(date){ return [$(this).parent().find(span.days).html(), ]
I have the following *code below, every time I refresh the page it asks
I have a custom user control DatePicker.cs. Inside of another piece of code I
I have the following code $(.datePicker).datepicker({ dateFormat: 'dd/mm/yy', autoSize: true, changeYear: true, changeMonth: true,
I have following function in my asp.net MVC view: $(function() { $('#datepicker').datepicker({ changeMonth: true,
I have the following scenario: In my masterpage I have: $(".datepicker").datepicker({ changeYear: true, changeMonth:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.