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 8195075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:00:45+00:00 2026-06-07T05:00:45+00:00

Providing design-time data for DataContext is easy with use of d:DataContext but what about

  • 0

Providing design-time data for DataContext is easy with use of d:DataContext but what about control properties referenced with {TemplateBinding} or {RelativeSource TemplatedParent} from Style.Template ?

Should I just populate control with sample data inside constructor/Loaded event when DesignerProperties.GetIsInDesignMode(this) returns true ?
(Can’t do this since it would break normal design experience).

What about third party-controls that I can’t modify ?

  • 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-07T05:00:46+00:00Added an answer on June 7, 2026 at 5:00 am

    For my own controls I usually do something like:

    <Style x:Key="FooStyle>
      <Setter Property="Template>
        <Setter.Value>
          <ControlTemplate TargetType="FooControl">
            <Grid d:DataContext="{d:DesignInstance FooDesignTimeData, IsDesignTimeCreatable=True}">
              ... guts of control template go here ...
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    

    Where “FooDesignTimeData” is a class that provides design time data in the appropriate form (implementing the interface from your runtime view model is a good practice here).

    I don’t see why this wouldn’t work for a 3rd party control as well. You might not even have to retemplate the control — you might be able to get away by just specifying the 3rd party control inside of your style and giving it a design time data context as specified above, but I haven’t tried that scenario. I assume you’re going to all this trouble because you’re forced to use a control that does not have a great design time experience (such as by providing a Vendor.Controls.Design.dll or Vendor.Controls.Expression.Design.dll file).

    To work with the TemplateBindings, I don’t have a great solution. Usually I create a test page that displays my control and allows me to switch templates around. During integration you’ll have an extra view (either within your app or as a separate app) that allows you to create and manipulate instances of the control as necessary. The GoToStateAction targeted trigger action from the Blend SDK is often useful here. For example, create a button for each visual state and then use the Click even to trigger a transition to a particular state. Thus you can easily test all of your states plus transitions while bound to test data. Hacky and not really design time data, but it works.

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

Sidebar

Related Questions

I created a user control, where I am providing design-time support. I expose appropriate
I have read a lot about MVC design pattern, but some of the things
I am trying to design a new application which basically aims at providing biometric
I'm tasked with providing a list of metadata requirements our data warehouse developers might
How are applications providing import / export (or backups) of data in SaaS based
I'm looking into providing several methods of visualizing a large volume of data. This
I find bloomberg providing information about some interesting quotes for example: http://www.bloomberg.com/quote/JPMVXYG7:IND/chart/ The question
I'm trying to find a good, simple introduction to domain driven design, but that
I'm trying to design a MySQL database to store user zipcode preferences for providing
Can you recommend me a web site providing pod-casts focused on OOP & Design?

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.