本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例5: AddMenuItem
MenuItem AddMenuItem(ItemCollection items, string header, MyMenuInfo menuInfo)
{
var menuItem = menuInfo.CreateMenuItem(header);
items.Add(menuItem);
return menuItem;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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());
}
示例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();
}
示例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);
}
}
}
示例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);
}
}