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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:53:06+00:00 2026-06-15T12:53:06+00:00

Situation: I have a DataGrid where the items can belong to different categories, say

  • 0

Situation:

I have a DataGrid where the items can belong to different categories, say A, B and Custom. Each Category has its own RowDetails template. The category of an item can be changed, and when this happens I want to change the template as well, if necessary. The ViewModel behind is the same, I just change the interface elements (for example, in template A I have a TextBlock, while in template B I have a TextBox, both with a Binding to the same property in the VM).

What I have done so far:

<DataGrid.RowDetailsTemplate>
    <DataTemplate>
        <Control x:Name="RowDetails" Focusable="False" />
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding TemplateID, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Value="0">
                    <Setter TargetName="RowDetails" Property="Template" Value="{StaticResource TemplateA}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding TemplateID, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Value="1">
                <Setter TargetName="RowDetails" Property="Template" Value="{StaticResource TemplateB}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding TemplateID, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Value="2">
                <Setter TargetName="RowDetails" Property="Template" Value="{StaticResource TemplateCustom}" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
</DataGrid.RowDetailsTemplate>

The problem:

When I change the category of an item, I can see that the template changes, but the entire row gets the ValidationErrorTemplate (the red border, with exclamation mark). This happens even if the templates are empty! Seems to me that just changing the template makes the whole thing to explode.

What am I doing wrong? Thanks!

  • 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-15T12:53:06+00:00Added an answer on June 15, 2026 at 12:53 pm

    After a lot of try-and-retry, I found the problem to be on a ComboBox inside my templates: as stated here, order in the properties of a ComboBox matters. Putting SelectedValue before ItemsSource did the trick for me, and the approach using the Triggers works like charm.

    Nevertheless, I’m still shocked by such solution. I’ll mark this as the answer, but I’m still open to suggesions.

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

Sidebar

Related Questions

Pseudo-situation: have a class (let's say BackgroundMagic ), and it has Start() and Stop()
Situation: I have some persons with certain skills and they can/might belong to more
The situation is simple. I have a datagrid that gets its data from a
I have a situation where I'm using a datagrid to display two different sets
Situation: I have a database that contains sales records, each record has a ID
Situation I have a QList<QVariant> where each QVariant item should be a QList<QVariant> of
[Situation] I have a custom item control which I add to a stack panel
Situation: I have a DAY structure. The DAY structure has three variables or attributes:
Here's the situation: I have a populated datagrid and I want to move a
I have this situation: I've an enum and I'm creating a datagrid composed of

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.