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


C# Controls.ItemCollection类代码示例

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


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

示例1: Pack

 public static List<Rect> Pack(int W, int H, ItemCollection rects)
 {
     var simple = _findSimpleSolutions(W,H,rects);
     if (simple != null)
     {
         return simple;
     }
     Rects = rects;
     string result="";
     result += W.ToString()+" "+H.ToString()+" "+ rects.Count.ToString()+"\r\n";
     foreach (Rect item in rects)
     {
         result += item.Width + " " + item.Height+"\r\n";
     }
     File.WriteAllText("cSharpBridge.txt", result);
     Process p = Process.Start("RectingAlgorithmProcess.exe");
     p.WaitForExit();
     FileStream fs = new FileStream("cPlusPlusBridge.txt", FileMode.Open, FileAccess.Read);
     StreamReader reader = new StreamReader(fs);
     int n = Convert.ToInt32(reader.ReadLine());
     List<Rect> temp = new List<Rect>();
     Rect t = new Rect();
     for (int i = 0; i < n; i++)
     {
         t.X = Convert.ToInt32(reader.ReadLine());
         t.Y = Convert.ToInt32(reader.ReadLine());
         int id = Convert.ToInt32(reader.ReadLine());
         t.Width = ((Rect)Rects[id]).Width;
         t.Height = ((Rect)Rects[id]).Height;
         t.SName = ((Rect)Rects[id]).SName;
         temp.Add(t);
     }
     return temp;
 }
开发者ID:podkolzzzin,项目名称:knapsack,代码行数:34,代码来源:RectangularPacker.cs

示例2: CreateItemCollectionAndGenerator

        private void CreateItemCollectionAndGenerator()
        { 
            _items = new ItemCollection(this);
 
            // the generator must attach its collection change handler before 
            // the control itself, so that the generator is up-to-date by the
            // time the control tries to use it (bug 892806 et al.) 
            _itemContainerGenerator = new ItemContainerGenerator(this);

            _itemContainerGenerator.ChangeAlternationCount();
 
            ((INotifyCollectionChanged)_items).CollectionChanged += new NotifyCollectionChangedEventHandler(OnItemCollectionChanged);
 
            if (IsInitPending) 
            {
                _items.BeginInit(); 
            }
            else if (IsInitialized)
            {
                _items.BeginInit(); 
                _items.EndInit();
            } 
 
            ((INotifyCollectionChanged)_groupStyle).CollectionChanged += new NotifyCollectionChangedEventHandler(OnGroupStyleChanged);
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:25,代码来源:ItemsControl.cs

示例3: FindNode

        private TreeViewItem FindNode(TreeViewItem parentNode, ItemCollection nodes, string directory, int attemptNumber = 1)
        {
            if (attemptNumber < 1)
                throw new ArgumentOutOfRangeException("attemptNumber", attemptNumber, "attemptNumber must be >= 1");

            if (attemptNumber > 2)
            {
                return parentNode;
            }

            List<TreeViewItem> childNodes = new List<TreeViewItem>();
            foreach (TreeViewItem childNode in nodes)
            {
                childNodes.Add(childNode);
                DirectoryTreeNode dirNode = childNode as DirectoryTreeNode;
                if (dirNode == null)
                    continue;

                if (string.Compare(dirNode.Directory, directory, true) == 0)
                {
                    return dirNode;
                }
            }

            UpdateNodeChildren((DirectoryTreeNode)parentNode);

            TreeViewItem node = FindNode(parentNode, parentNode.Items, directory, attemptNumber + 1);
            return node;
        }
开发者ID:judwhite,项目名称:CD-Tag,代码行数:29,代码来源:FolderTreeView.xaml.cs

示例4: InnerItemCollectionView

 // InnerItemCollectionView will return itself as SourceCollection (SourceCollection property is overridden); 
 // shouldProcessCollectionChanged is turned off because this class will handle its own events.
 public InnerItemCollectionView(int capacity, ItemCollection itemCollection)
     : base(EmptyEnumerable.Instance, false)
 { 
     // This list is cloned and diverged when Sort/Filter is applied.
     _rawList = _viewList = new ArrayList(capacity); 
     _itemCollection = itemCollection; 
 }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:9,代码来源:InnerItemCollectionView.cs

示例5: AddMenuItem

        MenuItem AddMenuItem(ItemCollection items, string header, MyMenuInfo menuInfo)
        {
            var menuItem = menuInfo.CreateMenuItem(header);
            items.Add(menuItem);

            return menuItem;
        }
开发者ID:RookieOne,项目名称:JBsWpfExamples,代码行数:7,代码来源:WpfMenu.cs

示例6: ExtractScope

 private IList<Document> ExtractScope(ItemCollection items)
 {
     IList<Document> docs = new List<Document>();
     foreach (SearchResultListItem2 item in items)
         docs.Add(item.Source);
     return docs;
 }
开发者ID:hmehart,项目名称:Notepad,代码行数:7,代码来源:Search.xaml.cs

示例7: ChangeCheckedState

 private static void ChangeCheckedState(bool isChecked, ItemCollection ic)
 {
     foreach (var obj in ic) {
         var dir = obj as DirectoryEntry;
         if (dir != null)
             ChangeState(isChecked, dir);
     }
 }
开发者ID:elerch,项目名称:PortableShortcuts,代码行数:8,代码来源:MainWindow.xaml.cs

示例8: 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

示例9: AddMenuItem

        MenuItem AddMenuItem(ItemCollection items, string header, ICommand command)
        {
            var menuItem = new MenuItem();
            menuItem.Header = header;
            menuItem.Command = command;

            items.Add(menuItem);

            return menuItem;
        }
开发者ID:RookieOne,项目名称:Chimera,代码行数:10,代码来源:WpfMenu.cs

示例10: AddTreeViewItem

        private void AddTreeViewItem(ItemCollection items, WorkItem workItem)
        {
            bool firstChild = (items.Count == 0);
            WorkItemTreeViewItem item = new WorkItemTreeViewItem(workItem);
            items.Add(item);

            if (firstChild && (item.Parent is WorkItemTreeViewItem))
            {
                (item.Parent as WorkItemTreeViewItem).IsExpanded = true;
            }
        }
开发者ID:BackupTheBerlios,项目名称:sofia-svn,代码行数:11,代码来源:WorkItemVisualizer.xaml.cs

示例11: _itemSerializer

 private static string _itemSerializer(ItemCollection items, int maxWeight,int alg)
 {
     string result = alg.ToString()+"\r\n";
     result += maxWeight + "\r\n";
     result += items.Count.ToString() + "\r\n";
     foreach (KnapsackObject obj in items)
     {
         result += obj.Name + " " + obj.Weight + " " + obj.Price + "\r\n";
     }
     return result;
 }
开发者ID:podkolzzzin,项目名称:knapsack,代码行数:11,代码来源:Knapsack.cs

示例12: ItemCollectionDefaultViewTest

        public void ItemCollectionDefaultViewTest()
        {
            ItemCollection itemCollection = new ItemCollection();

            NotifyCollectionChangedEventArgs lastChangeArgs = null;
            itemCollection.CollectionChanged += (sender, e) => lastChangeArgs = e;

            itemCollection.Add("default1");

            Assert.AreEqual(NotifyCollectionChangedAction.Add, lastChangeArgs.Action);
            CollectionAssert.AreEqual(new[] { "default1" }, lastChangeArgs.NewItems.Cast<string>().ToArray());
        }
开发者ID:highzion,项目名称:Granular,代码行数:12,代码来源:ItemCollectionTest.cs

示例13: OrdersRootViewModel

        public OrdersRootViewModel(ItemCollection tabs)
        {
            Instance = this;
            this.Tabs = tabs;
            FillTabs();

            LoadContent = new DelegateCommand(
                () =>
                {

                    //this.SelectedItem = Node.GetSelectedItem(this.Projects);
                },
                () => { return true; }
                );

            BackgroundWorker worker = new BackgroundWorker();

            ProjectsRingVisibility = true;
            PersonsRingVisibility = true;
            InfoProjectsRingVisibility = true;
            InfoUsersRingVisibility = true;

            worker.DoWork += new DoWorkEventHandler((sender, e) =>
                {
                   /* var comm = new Command(DatabaseManager.Instance.Connection);
                    Cache.CacheManager.Instance.Freelancers = DatabaseLoader.ComputeFreelansers(comm);
                    Cache.CacheManager.Instance.Costumers = DatabaseLoader.ComputeCostumers(comm);
                    Cache.CacheManager.Instance.Tasks = DatabaseLoader.ComputeTasks(comm);
                    Cache.CacheManager.Instance.Projects = DatabaseLoader.ComputeProjects(comm);
                    var nodes = new ObservableCollection<MVVM.Node>(Cache.CacheManager.Instance.Projects.Select(x => x as Node).ToList());*/

                    Random rand = new Random();
                    rand.Next(0, 1500);

                    //System.Threading.Thread.Sleep(2000);

                    Projects = FillProjects();
                    Peoples = FillCostumers();

                    ProjectsRingVisibility = false;
                    PersonsRingVisibility = false;
                    InfoProjectsRingVisibility = false;
                    InfoUsersRingVisibility = false;
                });

            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler((sender,e) =>
                {

                });

            worker.RunWorkerAsync();
        }
开发者ID:justdude,项目名称:OrdersManager,代码行数:52,代码来源:OrdersRootViewModel.cs

示例14: add_children

 private void add_children(ItemCollection group, int? id)
 {
     foreach (KeyValuePair<int,MarketGroup> mg in market_groups) {
         if (mg.Value.parent_id == id) {
             TreeViewItem item = new TreeViewItem();
             item.Header = mg.Value.name;
             item.Tag = mg.Key;
             if (!mg.Value.has_types)
                 add_children(item.Items, mg.Key);
             group.Add(item);
         }
     }
 }
开发者ID:raylu,项目名称:emb,代码行数:13,代码来源:MainWindow.xaml.cs

示例15: Remove

        void Remove(ItemCollection items, Stack<string> headers)
        {
            var header = headers.Pop();

            if (headers.Count == 0)
            {
                RemoveMenuItem(items, header);
            }
            else
            {
                var m = Find(items, header);
                Remove(m.Items, headers);
            }
        }
开发者ID:RookieOne,项目名称:JBsWpfExamples,代码行数:14,代码来源:WpfMenu.cs


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