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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:00:15+00:00 2026-05-22T01:00:15+00:00

In Josh Smith’s article, WPF Apps With The Model-View-ViewModel Design Pattern In the code

  • 0

In Josh Smith’s article,“WPF Apps With The Model-View-ViewModel Design Pattern”

In the code from AllCustomersView.xaml:

  <DataTrigger Binding="{Binding Path=Name}" Value="True">
      <Setter TargetName="txt" Property="Text" Value="Company" />
  </DataTrigger>

I couldn’t find out where the property–Name is.
I thought it was in the CustomerViewModel.cs.
But indeed it wasn’t. How could I know the path of Name?

  • 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-05-22T01:00:16+00:00Added an answer on May 22, 2026 at 1:00 am

    It comes from the CollectionViewSource:

    <CollectionViewSource
      x:Key="CustomerGroups" 
      Source="{Binding Path=AllCustomers}">
      <CollectionViewSource.GroupDescriptions>
        <PropertyGroupDescription PropertyName="IsCompany" />
      </CollectionViewSource.GroupDescriptions>
      <CollectionViewSource.SortDescriptions>
        <scm:SortDescription PropertyName="IsCompany" Direction="Descending" />
        <scm:SortDescription PropertyName="DisplayName" Direction="Ascending" />
      </CollectionViewSource.SortDescriptions>
    </CollectionViewSource>
    

    When you use a CVS, it takes your data (in this case, a collection of CustomerViewModel instances), and splits them into groups (in this case, based on the property IsCompany).

    Each group is placed in a CollectionViewGroup. A collection of these groups is then bound to the control that will be showing the groups. So the Name property is actually found on the CollectionViewGroup, and is the value of IsCompany (that’s the PropertyGroupDescription), or the string value of a boolean.

    If you change the binding to something invalid

    <DataTrigger Binding="{Binding Path=Derp}" Value="True">
        <Setter TargetName="txt" Property="Text" Value="Companies" />
    </DataTrigger>
    

    you’ll see it stop working, and the following message show up in your output window:

    System.Windows.Data Error: 39 :
    BindingExpression path error: ‘Derp’
    property not found on ‘object’
    ”CollectionViewGroupInternal‘
    (HashCode=41413147)’.
    BindingExpression:Path=Derp;
    DataItem=’CollectionViewGroupInternal‘
    (HashCode=41413147); target element is
    ‘ContentPresenter’ (Name=”); target
    property is ‘NoTarget’ (type ‘Object’)

    CollectionViewGroupInternal is the internal implementation of CollectionViewGroup that the CollectionViewSource uses to group your collection on the property IsCompany

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

Sidebar

Related Questions

I am reading Josh Smith' WPF Apps With The Model-View-ViewModel Design Pattern tutorial i
I've just been reading Josh Smith's MVVM article and am working on a WPF
Being new to both WPF and MVVM, I'm studying Josh Smith's article on the
I speak about josh smith article. can anyone show me please how the CustomerView.xaml
I'm writing some WPF code involving Adorners. I'm using Josh Smith's UIElementAdorner.cs (found in
The following code is from the MVVM sample by Josh Smith: /// <summary> ///
I'm working through Josh Smith's code and article on CommandSink which is a solution
I've been learning the MVVM pattern with Josh Smith's article and I want to
I hope someone can help me... Josh Smith did a great article on WPF
I use this in XAML to load the treeview children from a view model

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.