public ChooseImageDialog()
        {
            InitializeComponent();

            // Get image file with allowed extensions
            AddImages(ProjectTools.RetrieveFiles(ChooseImageDialog.Extension));

            CollectionViewSource cvs = new CollectionViewSource();

            cvs.Source = _data;
            cvs.GroupDescriptions.Add(new PropertyGroupDescription("Directory"));
            cvs.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            imgDisplay.ItemsSource = cvs.View;
        }
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);
            List <KeyValuePair <string, string> > images = new List <KeyValuePair <string, string> >();

            /* Get image file with allowed extensions and group them with their directory */
            images = ProjectTools.RetrieveFiles(ChooseImageDialog.Extension);
            IEnumerable <IGrouping <string, string> > grouping = images.GroupBy(image => image.Key, image => image.Value);

            /* Set values for _data and bind to the ListBox */
            foreach (IGrouping <string, string> group in grouping)
            {
                List <string> temp = new List <string>();
                foreach (var name in group)
                {
                    temp.Add(name);
                }
                _data.Add(new ImageData(group.Key + Path.DirectorySeparatorChar, temp));
            }

            Display.ItemsSource       = _data;
            Display.SelectionChanged += delegate { Display.SelectedItem = null; };
        }