I have the following domain:
public class FileInformation
{
public String FileName;
public String CreatedBy; // name of user who created the file
public String CreatedComments;
public String CreatedDate;
public String EditedBy; // name of user who last edited the file
public String EditedComments;
public String EditedDate;
}
public class Folder
{
public List<FileInformation> Files {get;set}
}
I want to have a WPF datagrid and bind the list of Files in the "Folder" class to it .....It's pretty easy to if I want to have the data displayed in a standard way..... but I want to have it displaYed in the following way:
Any ideas on what I have to do to have the data displayed in this way ?
Simplest way to do it is :
CollectionView cv = (CollectionView)(CollectionView)CollectionViewSource.GetDefaultView(_grid.ItemsSource);
cv.GroupDescriptions.Add(new PropertyGroupDescription("FileName"));
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True" Header={Binding Name}>
<ItemsPresenter/>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
The presented style will not didsplay the info exactly as presented in the screenshot but based on this tou could customize the content to match your needs...