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

The Archive Base Latest Questions

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

The default Windows 8 project template has a CollectionViewSource in the template. <CollectionViewSource x:Name=itemsViewSource

  • 0

The default Windows 8 project template has a CollectionViewSource in the template.

<CollectionViewSource
       x:Name="itemsViewSource"
       Source="{Binding Model.Invitations}"
       d:Source="{Binding Invitations, Source={d:DesignInstance Type=vm:DesignerFilteredInvitations, IsDesignTimeCreatable=True}}" />

Obviously not all pages have a collection as their model, you can define a DataContext like this:

<vm:MySingleItemViewModel x:Key="Model" />

How do you define the design instance for this kind of model?

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

    Okay, using this works fine:

    <Page 
    d:DataContext="{d:DesignInstance Type=Models:ViewModel, IsDesignTimeCreatable=True}"
    

    And using this works fine:

    <d:Page.DataContext>
        <Models:ViewModel/>
    </d:Page.DataContext>
    

    I must tell you the latter is an easier approach, too. It is also what Visual Studio will generate when you setup a data source in the designer. It also gives you fully-typed bindings. But either is acceptable.

    Another note. I can see no good reason to set an object directly to the source of a CollectionViewSource. Normally you would be binding the CVS’s Source property to a property inside your ViewModel. But, given your question: Here’s how:

    <CollectionViewSource 
        x:Name="TestCVS" Source="{Binding}"
        d:DataContext="{Binding Source={d:DesignInstance Type=Models:ViewModel, IsDesignTimeCreatable=True}}"/>
    

    Binding to the Source in the designer caused me endless trouble. But it irritated me more because I knew I would never do it this way. This is what I wanted to do:

    <d:Page.DataContext>
        <Models:ViewModel/>
    </d:Page.DataContext>
    
    <Page.Resources>
        <CollectionViewSource x:Name="TestCVS" Source="{Binding}" />
    </Page.Resources>
    

    You better have a great reason for your approach!

    Best of luck!

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

Sidebar

Related Questions

The project holding the code has all default MSVS2008 settings. Consider the following code
1, Create and build a default Windows Forms project and look at the project
MSDTC is disabled by default (windows 2003 - onwards) and I want to have
I want to get Default Windows Forms Unhandled-Exception Dialog whenever my C# application encounters
By default in windows application setting are saved in this directory: %USERPROFILE%\Local Settings\Application Data\<Company
I am attempting to open the the registry hive of the windows default user.
So I've been using the Windows Workflow default SQL persistence service that handles everything
I'm using wxWidgets 2.8.9, built with the default settings under Windows XP, VC9. And
In Windows Forms the default behaviour of a TabControl is to have the tabs
SQLCMD uses windows authentication by default. According to the MSDN documentation , you can

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.