Possible Duplicate:
How to use nested class in WPF XAML?
I am refractoring the code from sample:
- 24.129.21. Master Detail Binding
from C# / CSharp Tutorial » Windows Presentation Foundation » Binding)
And after excluding Skills class, with corresponding changes in
in MainWindow.xaml
<local:Team>
<local:Employee Name="Larry" Age="21">
<local:Employee.Skills>
<!-- local:Skills -->
<local:Skills>
I am having in MainWindow1.xaml.cs:
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
namespace WpfApplication
{
public class Skill
{//I'd like to remove class Skill having moved property string Description into class Employee
public string Description { get; set; }
}
public class Employee
{
public string Name { get ; set; }
public int Age { get; set; }
//I'd like to change in the next line Skill --> String
public List<Skill> Skills { get; set; }
//public List<String> Skills { get; set; }
public Employee()
{
//I'd like to change in the next line Skill --> String
Skills=new List<Skill>();
//Skills=new List<string>();
}
}
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 Window1 : Window
{
public Window1()
{
InitializeComponent();
}
}
}
How should I change Window1.XAML if to change:
List<Skill>
toList<String>
in Window1.xaml.cs?
Related questions based on the same code:
Update:
Just to note what I tried wrong:
- "A" instead of A (without quotes);
- it should be
String
(but notstring
) in XAML (while in C# eitherstring
orString
) - tried to place A as attribute, according existed code, in one tag
<sys:String />
instead of:<sys:String>A</sys:String>