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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:21:27+00:00 2026-06-04T14:21:27+00:00

I have the following constellation in my XAML: <ListBox x:Uid=attributesListBox DataContext={Binding Source={StaticResource EditFeatureWithForeignKeyAttributesViewModel}} ItemsSource={Binding

  • 0

I have the following constellation in my XAML:

<ListBox x:Uid="attributesListBox" 
    DataContext="{Binding Source={StaticResource EditFeatureWithForeignKeyAttributesViewModel}}" ItemsSource="{Binding Path=Attributes}" 
    d:DataContext="{d:DesignData /SampleData/BlendableAttributesSampleData.xaml}">
</ListBox>

The following DataTemplate is applied via the DataType:

<DataTemplate x:Uid="dataColumnFeatureAttributeDataTemplate" DataType="{x:Type DataColumnFeatureAttribute}">
    <!-- ... opens a button and a grid ... -->
            <TextBlock Text="{Binding EditCaption}" />
    <!-- ... closes button and grid ... -->
</DataTemplate>

As explained here in the “Remarks” section, an x:Key is generated implicitly and “the DataTemplate gets applied automatically to data objects of that type”.

Inside the DataTemplate, several simple properties of the list item are bound. In this excerpt from my SampleData, you will find the EditCaption property referenced above – it’s a simple string, and the DataContext and ItemsSource of the ListBox should fit:

<SampleData:BlendableAttributes xmlns:SampleData="clr-namespace:Commons.Mobile.SampleData">
    <SampleData:BlendableAttributes.Attributes>
        <Mobile_Client:FeatureAttribute DisplayCaption="Vestibulum adipiscing curabitur" DisplayString="Class maecenas parturient" ErrorMessage="Nunc amet aliquam nam sed" EditCaption="Cras phasellus duis" IsEditable="True" IsSearchable="False" IsViewable="True" Modified="False">
            <Mobile_Client:FeatureAttribute.Feature>
                <!-- ... Feature with a lot of properties ...  -->
            </Mobile_Client:FeatureAttribute.Feature>
        </Mobile_Client:FeatureAttribute>
        <!-- ... more FeatureAttributes ... -->
    </SampleData:BlendableAttributes.Attributes>
</SampleData:BlendableAttributes>

The DataTemplate is applied correctly in the preview, if I reference it via x:Key. This is not possible in this case, because the list contains different types of objects, so I have to use the implicit x:Key to apply a specific DataTemplate according to the object type.

So there’s no problem at runtime with the data from my VM, but at design time

  • Expression Blend shows the SampleData, but without applying the DataTemplate when I look at the whole page
  • On the other hand, when I go to Resources and edit the DataTemplate, I see the layout without the SampleData.

I’ve tried some things out and looked for a solution in the forum, but no one seems to have had this special constellation. Can someone help me please?

  • 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-04T14:21:28+00:00Added an answer on June 4, 2026 at 2:21 pm

    Did you configure the build action DesignData for the file “/SampleData/BlendableAttributesSampleData.xaml”? If yes, the Visual Studio designer does not create an object of type DataColumnFeatureAttribute for your sample data, but instead a proxy object of type _.di0.DataColumnFeatureAttribute (or something similar). Therefore, your DataTemplate is not used, because the DataType property of your DataTemplate refers to another type than the proxy type.

    You might change the build action to DesignDataWithDesignTimeCreatableTypes to fix that problem (this requires that the DataColumnFeatureAttribute class has a default constructor).

    Alternatively, if you cannot use DesignDataWithDesignTimeCreatableTypes, then set the property d:IsDesignTimeCreatable to False in your DataTemplate, like this:

    <DataTemplate x:Uid="dataColumnFeatureAttributeDataTemplate" 
                  DataType="{x:Type DataColumnFeatureAttribute}" 
                  d:IsDesignTimeCreatable="False"> 
        <!-- ... opens a button and a grid ... --> 
                <TextBlock Text="{Binding EditCaption}" /> 
        <!-- ... closes button and grid ... --> 
    </DataTemplate> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following constellation here: I have running a VMware Linux Ubuntu image
I have following code for opening files programatically: Uri path = Uri.fromFile(file); Intent intent
I have following source. In insertMessage(..), it calls selectMessage to check whether duplicate record
I have following class. In this, Iris is another class with some attributes. public
have following problem with validate checkbox array. The validation is bypassed, have taken the
i have following route in route.php in codeigniter $route['^(?!login|signup|autos|jobs|jobwanted|admin).*'] = pages/bpages; it is redirecting
I have following relation. A company has several employees. Each employee is defined by
I have following Html file with javascript. This gives me error that testCircle is
I have following simple HTML and JS code. When User selects Italian Language option
I have following class which reads and writes an array of objects from/to a

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.