Items in the listbox are nicely grouped but I don't see the title for the expander:
<ListBox Name="Files1" ItemsSource="{Binding FileCollection}"><ItemsControl.GroupStyle><GroupStyle ><GroupStyle.ContainerStyle><Style TargetType="{x:Type GroupItem}"><Setter Property="Margin" Value="0,0,0,5"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type GroupItem}"><Expander IsExpanded="True" Background="#FFEEEEEE" BorderBrush="#FFEEEEEE" Foreground="#FF000000" BorderThickness="2" ><Expander.Header> <DockPanel ><TextBlock FontWeight="Bold" Text="{Binding Path=FileType}" Margin="5,0,0,0" Width="100"/></DockPanel></Expander.Header><Expander.Content><ItemsPresenter /></Expander.Content></Expander></ControlTemplate></Setter.Value></Setter></Style></GroupStyle.ContainerStyle></GroupStyle></ItemsControl.GroupStyle>
If you are interested in the details:
ObservableCollection<object> _fileCollection = new ObservableCollection<object>(); public ObservableCollection<object> FileCollection { get { return _fileCollection; } } //I am adding files like this _fileCollection.Add(new FileData(file.FullName, _fileName, _fileDateTime, _fileSize, _fileExt)); //My Class public class FileData { private string fileType;
...
public string FileType { get { return fileType; } set { fileType = value; } } ... }
So everything works, except the binding for the header is wrong (bolded in code)
What am I missing