当前位置: 首页>>代码示例>>C#>>正文


C# ItemCollection.Clear方法代码示例

本文整理汇总了C#中System.Windows.Controls.ItemCollection.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# ItemCollection.Clear方法的具体用法?C# ItemCollection.Clear怎么用?C# ItemCollection.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.ItemCollection的用法示例。


在下文中一共展示了ItemCollection.Clear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateView

 private void UpdateView(ItemCollection itemCollection, IEnumerable<String> items)
 {
     itemCollection.Clear();
     foreach (var item in items)
     {
         var description = String.IsNullOrEmpty(item) ? "Unknown" : item;
         itemCollection.Add(description);
     }
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:9,代码来源:UndoHistoryVisualiserWindow.xaml.cs

示例2: LoadFilesAndFolders

        public void LoadFilesAndFolders(ItemCollection items)
        {
            items.Clear();
            String folderPath = "";
            //Get path to the current users files
            if (Session.GetInstance().UserID != -1)
                folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\sliceofpie\\" + Session.GetInstance().Email;
            else
                folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\sliceofpie\\";
            //Create a DirectoryInfo for that folder
            DirectoryInfo dir = new DirectoryInfo(folderPath);

            //Insert dictionaries and files from the folder as items in treeview
            GetInstance().InsertDirectoriesIntoDirectory(items, dir);
            GetInstance().InsertFilesIntoDirectory(items, dir);
        }
开发者ID:MikkelFunch,项目名称:sliceofpie,代码行数:16,代码来源:TreeViewModel.cs

示例3: PopulateFileSystemTree

    private async Task<bool> PopulateFileSystemTree(ItemCollection items, string path)
    {
      items.Clear();
      MpdDirectoryListing list = null;
      try{
        list = await Task.Factory.StartNew(() => m_Mpc.LsInfo(path));
      }catch (Exception ex){
        ShowException(ex);
        return false;
      }

      foreach (string dir in list.DirectoryList) {
        TreeViewItem item = new TreeViewItem();
        item.Header = path != null ? dir.Remove(0, path.Length + 1) : dir;
        item.Tag = dir;
        if (await HasSubdirectories(item.Tag.ToString())) {
          item.Items.Add(null);
          item.Expanded += TreeItemExpanded;
        }
        items.Add(item);
      }
      return true;
    }
开发者ID:sakya,项目名称:wpfmpdclient,代码行数:23,代码来源:MainWindow.xaml.cs

示例4: CtxmConvertToMenuItems

        private void CtxmConvertToMenuItems(List<CtxmItemData> src, ItemCollection dest, CtxmCode code, bool shortcutTextforListType)
        {
            dest.Clear();

            src.ForEach(data =>
            {
                Control item;
                if (data.Command == EpgCmdsEx.Separator)
                {
                    item = new Separator();
                }
                else
                {
                    var menu = new MenuItem();
                    menu.Header = data.Header;
                    menu.Command = (EpgCmdsEx.IsDummyCmd(data.Command) ? null : data.Command);
                    if (menu.Command != null)
                    {
                        if ((shortcutTextforListType == true || (MC.WorkCmdOptions[data.Command].GesTrg & MenuCmds.GestureTrg.ToView) == MenuCmds.GestureTrg.ToView)
                            && (MC.WorkCmdOptions.ContainsKey(data.Command) == false || MC.WorkCmdOptions[data.Command].IsGestureEnabled == true)
                            && data.ID == 0)
                        {
                            menu.InputGestureText = MenuBinds.GetInputGestureText(data.Command);
                        }
                    }
                    menu.CommandParameter = new EpgCmdParam(typeof(MenuItem), code, data.ID);
                    CtxmConvertToMenuItems(data.Items, menu.Items, code, shortcutTextforListType);
                    item = menu;
                }
                item.Name = data.Name;
                item.Tag = data.Command;
                item.ToolTip = GetCtxmTooltip(data.Command);
                ToolTipService.SetShowOnDisabled(item, true);

                dest.Add(item);
            });
        }
开发者ID:xceza7,项目名称:EDCB,代码行数:37,代码来源:MenuManager.cs

示例5: LoadFilesAndFolders

        /// <summary>
        /// Creates the tree view with the specified files and folders.
        /// </summary>
        /// <param name="items">The UI componenets the tree view shall consist of</param>
        /// <param name="foldersAndFiles">The files and folders to be displayed in the tree view</param>
        public void LoadFilesAndFolders(ItemCollection items, string[][][] foldersAndFiles)
        {
            items.Clear();
            string[][] folders = foldersAndFiles[0];
            string[][] files = foldersAndFiles[1];

            foreach (string[] folder in folders)
            {
                InsertFolder(folder, items);
            }
            foreach (string[] file in files)
            {
                InsertDocument(file, items);
            }
        }
开发者ID:MikkelFunch,项目名称:sliceofpie,代码行数:20,代码来源:TreeViewModel.cs

示例6: PopulateFileSystemTree

 private void PopulateFileSystemTree(ItemCollection items, string path)
 {
     items.Clear();
       MpdDirectoryListing list = m_Mpc.LsInfo(path);
       foreach (string dir in list.DirectoryList){
     TreeViewItem item = new TreeViewItem();
     item.Header = path != null ? dir.Remove(0, path.Length + 1) : dir;
     item.Tag = dir;
     if (HasSubdirectories(item.Tag.ToString())){
       item.Items.Add(null);
       item.Expanded += TreeItemExpanded;
     }
     items.Add(item);
       }
 }
开发者ID:TheCapsLock,项目名称:wpfmpdclient,代码行数:15,代码来源:MainWindow.xaml.cs

示例7: DeleteDuplicateProjects

        /// <summary>
        /// Program mi při této metodě zhavaroval na PC kde nebylo VS, proto jsem to nemohl ladit ale patrně to bylo proto že bylo asi 4 stejně pojmenované projekty a program se pokusil odstranit projekt podle objektu na jiný projekt - ani nestihl odstranit všechny
        /// Prochází projekty v A1(měli by to být všechny projetky aktuálně zobrazené v ListBoxu) a vypíše odstraněné projekty klasicky v ListBoxu
        /// </summary>
        /// <param name="objectCollection"></param>
        private void DeleteDuplicateProjects(ItemCollection objectCollection)
        {
            List<SolutionFolder> vr = new List<SolutionFolder>();
            Dictionary<SolutionFolder, string> g = new Dictionary<SolutionFolder, string>();
            foreach (object var in objectCollection)
            {
                g.Add(var as SolutionFolder, System.IO.Path.GetFileName(var.ToString()));
            }

            foreach (object var in objectCollection)
            {
                if (ContainsValueTwoTimes(g, System.IO.Path.GetFileName(var.ToString())))
                {
                    //-Zjistim si dalsi duplikatni polozku
                    SolutionFolder sf = (var as SolutionFolder);
                    string fullPath = sf.fullPathFolder;
                    SolutionFolder dex = FindIndexOfValue(g, System.IO.Path.GetFileName(fullPath), sf);

                    SolutionFolder s = ((SolutionFolder)var);
                    SolutionFolder n = dex;

                    Directory.Delete(dex.fullPathFolder, true);

                    vr.Add(s);
                    vr.Add(n);
                }
            }
            objectCollection.Clear();
            var ds = vr.ToArray();
            foreach (var item in ds)
            {
                //lbResults.Items.Add(item);
                AddToLbResult(item);
            }
        }
开发者ID:sunamo,项目名称:AllProjectsSearch,代码行数:40,代码来源:MainWindow.xaml.cs


注:本文中的System.Windows.Controls.ItemCollection.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。