I have a class that describes the level of subordination of departments:
And implemented binding:
At the output I get the following oddity
the main elements of the tree are displayed correctly, and the child elements are displayed character-by-character. How can I fix this?
C#:
public class SeniorPosition : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string managementPositionName;
private string whoReportsToTheDepartment;
public string ManagementPositionName
{
get
{
return managementPositionName;
}
set
{
managementPositionName = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(managementPositionName)));
}
}
public string WhoReportsToTheDepartment
{
get
{
return whoReportsToTheDepartment;
}
set
{
whoReportsToTheDepartment = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(WhoReportsToTheDepartment)));
}
}
public SeniorPosition(string formalManagePositionName, string formalWhoReportsToTheDepartment)
{
ManagementPositionName = formalManagePositionName;
WhoReportsToTheDepartment = formalWhoReportsToTheDepartment;
}
}
And implemented binding:
XML:
<TreeView Grid.Row="1" Name="DepartamentHierarchy">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:SeniorPosition}" ItemsSource="{Binding ManagementPositionName}">
<TextBlock Text="{Binding WhoReportsToTheDepartment}"/>
</HierarchicalDataTemplate>
</TreeView.Resources>
</TreeView>
At the output I get the following oddity
the main elements of the tree are displayed correctly, and the child elements are displayed character-by-character. How can I fix this?