Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Binding problem for my ListBox GroupStyle Expander

$
0
0

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


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>