示例#1
0
        private void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            FileExplorerItem item = sender as FileExplorerItem;

            if (item != null && item.IsSelected)
            {
                NotifyPropertyChanged("SelectedItem");
            }
        }
示例#2
0
        private static FileExplorerItem GetSelectedItem(IEnumerable <FileExplorerItem> items)
        {
            //top-level items:
            FileExplorerItem item = items.FirstOrDefault(i => i.IsSelected);

            if (item == null)
            {
                //sub-level items;
                IEnumerable <FileExplorerItem> subItems = items.OfType <Directory>().SelectMany(d => d.SubItems);
                if (items.Any())
                {
                    item = GetSelectedItem(subItems);
                }
            }
            return(item);
        }