Padding inside Controls

3 posts, 0 answers
  1. steffen
    steffen avatar
    4 posts
    Member since:
    Mar 2013

    Posted 19 Mar 2013 Link to this post


    how can I set the Padding inside of a DatePicker or TextBox control to 0.
    Please see attached picture (padding in red) the blur border is the selected datePicker control.
    Seems to be inside the control template.

    regards steffen
  2. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 19 Mar 2013 Link to this post

    Hi Seffen,

    You have two choices to bring those edges out. The first is the easiest and provides the same effect as the second.

    1- Add a negative margin to that edge.
    2- Extract the control template.

    Extracting the template can be done in Visual Studio 2012 or in Blend for Visual Studio. Here are the steps:

    Locate the instance of the control in the Objects and Timeline (Blend) or the Document Outline (VS2012) panel.
    Right click on the control, locate and expand the option named "Edit Template"
    Select "Edit a copy"

    The control template will be extracted and then you can edit its parts. This will create a resource that the control will use for its Style property.

    Good luck!
  3. DevCraft banner
  4. Jini
    Jini avatar
    4 posts
    Member since:
    May 2013

    Posted 02 Jul 2013 Link to this post

    GetTemplateChild can only be used from "your control" to get a control defined in it's [control]template. 
Back to Top