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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:43:28+00:00 2026-06-17T21:43:28+00:00

I am refractoring the code from sample: 24.129.21. Master Detail Binding from C# /

  • 0

I am refractoring the code from sample:

  • 24.129.21. Master Detail Binding
    from C# / CSharp Tutorial » Windows Presentation Foundation » Binding)

I came to the following C# code-behind, running with the same XAML:

namespace WpfApplication1 
{
    public class Skill
      {
        public string Description { get; set; }
      }

      //I'd like to comment out the next line
      public class Skills : ObservableCollection<Skill>{  }

        public class Employee 
      {
        public string Name { get  ; set; }
        public int Age  { get; set; }
        //public Skills Skills { get; set; }
        //instead of line above - works!
        public ObservableCollection<Skill> Skills { get; set; }
      }

      public class Team : ObservableCollection<Employee> { }

      public class Company
      {
        public string CompanyName { get  ; set; }
        public Team Members { get  ; set; }
      }

      public class Companies : ObservableCollection<Company> { }

      public partial class MainWindow : Window
        {
        public MainWindow()
      {
          InitializeComponent();
      }
    }
}

i.e. changed from

  • public Skills Skills { get; set; }

to

  • public ObservableCollection<Skill> Skills { get; set; }

in Employee class

Consequently, I’d like to get rid of, i.e. to comment out the line:

public class Skills : ObservableCollection<Skill>{  }

but I’m getting:

Error 1 The tag ‘Skills’ does not exist in XML namespace
‘clr-namespace:_24_129_21_Master_Detail_Binding’. Line 13 Position 34

in Window1.xaml

<local:Team>
  <local:Employee Name="Larry" Age="21">
    <local:Employee.Skills>
       <local:Skills>

How can I change XAML in order to do it?

How should I change XAML for this?

  • 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-17T21:43:29+00:00Added an answer on June 17, 2026 at 9:43 pm

    In your Window1.xaml class remove the reference to the skills class: (e.g. <local:Skills> ) since you don’t have a Skills class anymore. Instead you want a number of Skill elements inside your ObservableCollection:

    <local:Team>
       <local:Employee Name="Larry" Age="21">
         <local:Employee.Skills>
            <local:Skill />
            <local:Skill />
           ....
    

    Also, you should probably initialize the Skills ObservableCollection inside the Employee’s constructor.

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

Sidebar

Related Questions

I am refactoring the code from sample: 24.129.21. Master Detail Binding from C# /
I'm refactoring a little bit of C# data access code from a previous developer
Oops this happened again. I did some refactoring today when i moved code from
I have a problem with some simple code, I'm refactoring some existing code from
I was refactoring some code in a web application today and came across something
I encountered the following PL/SQL code(variables modified) at work: PROCEDURE test(i_w IN a.w%type,o_result IN
I have the following code in my web app's main JavaScript: // uniq for
I was refactoring some code, and part of it included moving it from VB.Net
I was hoping someone could help clarify my options regarding refactoring methods from code-behinds
I'm refactoring some code I inherited from a long-gone developer, and I find this:

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.