I have this class:
<code>public class Team
{
public int Id { get; set; }
public string Name { get; set; }
public ObservableCollection<Competency> Competencies { get; set; } = new ObservableCollection<Competency>();
public ObservableCollection<Employee> Employees { get; set; } = new ObservableCollection<Employee>();
}
</code>
<code>public class Team
{
public int Id { get; set; }
public string Name { get; set; }
public ObservableCollection<Competency> Competencies { get; set; } = new ObservableCollection<Competency>();
public ObservableCollection<Employee> Employees { get; set; } = new ObservableCollection<Employee>();
}
</code>
public class Team
{
public int Id { get; set; }
public string Name { get; set; }
public ObservableCollection<Competency> Competencies { get; set; } = new ObservableCollection<Competency>();
public ObservableCollection<Employee> Employees { get; set; } = new ObservableCollection<Employee>();
}
And this code works for me:
<code><Page>
<Page.Resources>
<model:Employee x:Key="employees" />
<HierarchicalDataTemplate DataType="{x:Type model:Team}" ItemsSource="{Binding Employees}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Row.Name}" FontWeight="Bold" Margin="3,0,0,0" />
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type model:Employee}">
<StackPanel Orientation="Vertical">
<Border Padding="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" BorderBrush="#FFC3CEDC" BorderThickness="0,1,0,0">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0">
<TextBlock Text="{Binding Row.FirstName}" FontWeight="Bold" Margin="3,0,0,0" />
<TextBlock Text="{Binding Row.LastName}" Margin="3,0,0,0" />
</StackPanel>
</Grid>
</Border>
</StackPanel>
</DataTemplate>
</Page.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- TreeListControl for Teams -->
<dxg:TreeListControl x:Name="teamEmployeesTree" Grid.Column="0" ItemsSource="{Binding TeamsItems}">
<dxg:TreeListControl.View>
<dxg:TreeListView
TreeDerivationMode="HierarchicalDataTemplate"
AutoExpandAllNodes="True"
ShowCheckboxes="True"
AllowRecursiveNodeChecking="False"
NewItemRowPosition="Top"
AllowPerPixelScrolling="True"
TreeColumnFieldName="Name"
NavigationStyle="Cell"
AllowDragDrop="True"
ShowDragDropHint="False"
ShowNodeImages="True"
UseEvenRowBackground="True"
EnterMoveNextColumn="False"/>
</dxg:TreeListControl.View>
<dxg:TreeListColumn FieldName="Name" />
<dxg:TreeListColumn FieldName="Competencies"/>
</dxg:TreeListControl>
</Grid>
</Page>
</code>
<code><Page>
<Page.Resources>
<model:Employee x:Key="employees" />
<HierarchicalDataTemplate DataType="{x:Type model:Team}" ItemsSource="{Binding Employees}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Row.Name}" FontWeight="Bold" Margin="3,0,0,0" />
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type model:Employee}">
<StackPanel Orientation="Vertical">
<Border Padding="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" BorderBrush="#FFC3CEDC" BorderThickness="0,1,0,0">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0">
<TextBlock Text="{Binding Row.FirstName}" FontWeight="Bold" Margin="3,0,0,0" />
<TextBlock Text="{Binding Row.LastName}" Margin="3,0,0,0" />
</StackPanel>
</Grid>
</Border>
</StackPanel>
</DataTemplate>
</Page.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- TreeListControl for Teams -->
<dxg:TreeListControl x:Name="teamEmployeesTree" Grid.Column="0" ItemsSource="{Binding TeamsItems}">
<dxg:TreeListControl.View>
<dxg:TreeListView
TreeDerivationMode="HierarchicalDataTemplate"
AutoExpandAllNodes="True"
ShowCheckboxes="True"
AllowRecursiveNodeChecking="False"
NewItemRowPosition="Top"
AllowPerPixelScrolling="True"
TreeColumnFieldName="Name"
NavigationStyle="Cell"
AllowDragDrop="True"
ShowDragDropHint="False"
ShowNodeImages="True"
UseEvenRowBackground="True"
EnterMoveNextColumn="False"/>
</dxg:TreeListControl.View>
<dxg:TreeListColumn FieldName="Name" />
<dxg:TreeListColumn FieldName="Competencies"/>
</dxg:TreeListControl>
</Grid>
</Page>
</code>
<Page>
<Page.Resources>
<model:Employee x:Key="employees" />
<HierarchicalDataTemplate DataType="{x:Type model:Team}" ItemsSource="{Binding Employees}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Row.Name}" FontWeight="Bold" Margin="3,0,0,0" />
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type model:Employee}">
<StackPanel Orientation="Vertical">
<Border Padding="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" BorderBrush="#FFC3CEDC" BorderThickness="0,1,0,0">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0">
<TextBlock Text="{Binding Row.FirstName}" FontWeight="Bold" Margin="3,0,0,0" />
<TextBlock Text="{Binding Row.LastName}" Margin="3,0,0,0" />
</StackPanel>
</Grid>
</Border>
</StackPanel>
</DataTemplate>
</Page.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- TreeListControl for Teams -->
<dxg:TreeListControl x:Name="teamEmployeesTree" Grid.Column="0" ItemsSource="{Binding TeamsItems}">
<dxg:TreeListControl.View>
<dxg:TreeListView
TreeDerivationMode="HierarchicalDataTemplate"
AutoExpandAllNodes="True"
ShowCheckboxes="True"
AllowRecursiveNodeChecking="False"
NewItemRowPosition="Top"
AllowPerPixelScrolling="True"
TreeColumnFieldName="Name"
NavigationStyle="Cell"
AllowDragDrop="True"
ShowDragDropHint="False"
ShowNodeImages="True"
UseEvenRowBackground="True"
EnterMoveNextColumn="False"/>
</dxg:TreeListControl.View>
<dxg:TreeListColumn FieldName="Name" />
<dxg:TreeListColumn FieldName="Competencies"/>
</dxg:TreeListControl>
</Grid>
</Page>
Now what I want is to have another type of child node, so I need some kind group by thing here:
<code>Team (root)
- "Employees" (fixed node text, and when I click on this to present all employees for that team)
--Emp1
--Emp2
- "Competencies" - (fixed node text, and when I click on this to present all employees for that team)
-- Competency1
-- Competency2
</code>
<code>Team (root)
- "Employees" (fixed node text, and when I click on this to present all employees for that team)
--Emp1
--Emp2
- "Competencies" - (fixed node text, and when I click on this to present all employees for that team)
-- Competency1
-- Competency2
</code>
Team (root)
- "Employees" (fixed node text, and when I click on this to present all employees for that team)
--Emp1
--Emp2
- "Competencies" - (fixed node text, and when I click on this to present all employees for that team)
-- Competency1
-- Competency2
Also I need checkbox “Is TeamLead” but only for employees.
Is this possible and to have different columns inside each nodes group?