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

  • Home
  • SEARCH
  • 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 8337985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:27:26+00:00 2026-06-09T04:27:26+00:00

I am trying to make a custom template for datepickers in my program. I

  • 0

I am trying to make a custom template for datepickers in my program. I am basically using this template line for line (changing colors and things):

http://msdn.microsoft.com/en-us/library/cc278067(v=vs.95).aspx

I have tried going through it and getting rid of this white box (the one INSIDE the datepicker textbox), but it is evading me. Here is a screenshot of what I am seeing:

enter image description here

Do I have to add something extra? Or change some existing values? There is also a MouseOver event that highlights the whitebox with the blue windows gradient, if that helps..

For future people with this problem, I did what Brian suggested, just thought I would post exactly my code, so other people can use it 😉 I just added this into app.xaml

<Style x:Key="{x:Type DatePickerTextBox}" TargetType="{x:Type DatePickerTextBox}">        
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type DatePickerTextBox}">

                <Grid>
                    <Border x:Name="watermark_decorator" BorderBrush="{DynamicResource cControlColor}" BorderThickness="1" 
                                Background="{DynamicResource cControlColor}"/>     
                </Grid>
            </ControlTemplate>
         </Setter.Value>
    </Setter>
</Style>
  • 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-09T04:27:27+00:00Added an answer on June 9, 2026 at 4:27 am

    EDIT: Updating since the clarification points to the white rectangle around the ‘Enter text here’.

    For this, you need to create a custom template for the DatePickerTextBox which is defined about 2/3rds of the way down that template, and named TextBox. Your best bet will be to use Blend to create a custom template (since it will generate the default template) and then modify the <Border x:Name="watermark_decorator".../> to change the BorderBrush. For example:

    <Style x:Key="MyDatePickerTextBoxStyle" TargetType="{x:Type DatePickerTextBox}">
        <Setter Property="Template">
           <Setter.Value>
             <ControlTemplate TargetType="{x:Type DatePickerTextBox}">
               <Grid>                 
               <!-- Visual State Manager stuff -->
                 <Border...>
                   <!-- other stuff... -->
                   <Border x:Name="watermark_decorator" BorderBrush="[THE BRUSH YOU WANT]" BorderThickness="1">
                     <!-- And so on and so forth... -->
                   </Border>
                 </Border>
               </Grid>
             </ControlTemplate>
        </Setter>
    </Style>
    

    Then, in the DatePicker template, modify the DatePickerTextBox to use this style:

    <!-- All DatePicker Template stuff -->
    <controlsPrimitives:DatePickerTextBox x:Name="TextBox" Style="{DynamicResource MyDatePickerTextBoxStyle}" ... />
    

    Are you talking about the button with the 15 on it? If so, the look and feel of this part of the DatePicker is defined in the “DropDownButtonTemplate” part of the template. This template includes a large VisualStateManager section, but then defines the template for that button. There are comments that define the beginning and end of the button template:

    <!--Start UI-->
    ... this is the Button Template ...
    <!-- End UI-->
    

    For example, if you want to change the color of the Blue rectangle at the top of the button, the MSDN example uses this:

    <Rectangle Grid.ColumnSpan="4" Grid.RowSpan="1" StrokeThickness="1">
      <Rectangle.Stroke>
        <LinearGradientBrush EndPoint="0.48,-1" StartPoint="0.48,1.25">
           <GradientStop Color="#FF494949" />
           <GradientStop Color="#FF9F9F9F" Offset="1" />
        </LinearGradientBrush>
      </Rectangle.Stroke>
      <Rectangle.Fill>
        <LinearGradientBrush EndPoint="0.3,-1.1" StartPoint="0.46,1.6">
          <GradientStop Color="#FF4084BD" />
          <GradientStop Color="#FFAFCFEA" Offset="1" />
        </LinearGradientBrush>
      </Rectangle.Fill>
    </Rectangle>
    

    And you could change it to a solid color simply by changing it to this:

    <Rectangle Grid.ColumnSpan="4" Grid.RowSpan="1" StrokeThickness="1" Stroke="Black" Fill="Green"/>
    

    The “White Box” is actually the Border inside the template with the x:Name="BackgroundGradient", so if you change the Background of that element, you can get rid of the white.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to make custom radio buttons using HTML, CSS, and JavaScript.
I'm trying to make a custom view in Django admin. I'm reading from this
I am trying to make a custom Flex tooltip a la this tutorial .
I'm trying to make a custom template for a basket item list. I need
I am trying to make my custom template for textbox in MVC 3. How
I'm trying to make custom pages using the new vBulletin 4. My PHP file
i am trying to make a custom login form in drupal-6.22 using Email Registration
I'm trying to make custom suggestion to search dialog. I'm using a urimatcher to
Trying to use this code to render a menu module on a custom template
Using Dojo 1.7.2 Beginner to Dojo, trying to make a simple custom widget. I

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.