Exemplo n.º 1
0
        public void FolderExpanded(object sender, RoutedEventArgs e)
        {
            TreeViewItem item = (TreeViewItem)sender;
            string currentPath = item.Tag.ToString();

            if (item.Items.Count == 1 && item.Items[0] == dummyNode)
            {
                item.Items.Clear();
                DirectoryInfo directoryInfo = new DirectoryInfo(item.Tag.ToString());
                
                foreach(DirectoryInfo directory in directoryInfo.GetDirectories())
                {
                    if(directory.Attributes.ToString().Contains("Directory") && !directory.Attributes.ToString().Contains("Hidden"))
                    {
                        TreeViewItem subItem = new TreeViewItem();
                        subItem.Header = directory.Name;
                        subItem.Tag = directory.FullName;
                        subItem.FontWeight = FontWeights.Normal;
                        subItem.Items.Add(dummyNode);
                        subItem.Expanded += new RoutedEventHandler(FolderExpanded);
                        item.Items.Add(subItem);
                    }
                }
                contentControl.SetIcon(currentPath);
                addressControl.SetCurrentPath(currentPath);
            }
        }
Exemplo n.º 2
0
        public void DirectoryButtonDoubleClicked(object sender, MouseButtonEventArgs e)
        {
            Button button = (Button)sender;

            button.Background = System.Windows.Media.Brushes.White;

            addressControl.SetCurrentPath(currentPath + button.Tag.ToString());
            addressControl.backPathStack.Push(currentPath);
            SetIcon(currentPath + button.Tag.ToString());
        }