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


C# BindableCollection.Contains方法代码示例

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


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

示例1: AfterUpdate

		private void AfterUpdate(NameAndCount[] collectionDocumentsCount)
		{
            // update documents count

		    var nameToCount = collectionDocumentsCount.OrderByDescending(count => count.Count).ToDictionary(i => i.Name, i => i.Count);
		    var collections = Collections.OrderByDescending(model => model.Count).ToList();
            Collections = new BindableCollection<CollectionModel>(model => model.Name);
		    foreach (var collectionModel in collections)
		    {
		        Collections.Add(collectionModel);
		    }
		    
		    foreach (var collectionModel in Collections)
		    {
		        collectionModel.Count = nameToCount[collectionModel.Name];
		    }

			if (initialSelectedDatabaseName != null &&
				(SelectedCollection.Value == null || SelectedCollection.Value.Name != initialSelectedDatabaseName || Collections.Contains(SelectedCollection.Value) == false))
			{
				SelectedCollection.Value = Collections.FirstOrDefault(x => x.Name == initialSelectedDatabaseName);
			}

			if (SelectedCollection.Value == null)
				SelectedCollection.Value = Collections.FirstOrDefault();

            OnPropertyChanged(() => Collections);
		}
开发者ID:arelee,项目名称:ravendb,代码行数:28,代码来源:CollectionsModel.cs

示例2: SetupControls

        private void SetupControls()
        {
            var dataModelProps = _layerEditorViewModel.DataModelProps;
            Name = _property + ":";

            // Populate target combobox
            Targets = new BindableCollection<GeneralHelpers.PropertyCollection>
            {
                new GeneralHelpers.PropertyCollection {Display = "None"}
            };
            Targets.AddRange(dataModelProps.Where(p => (p.Type == "Int32") || (p.Type == "Single")));

            // Populate sources combobox
            Sources = new BindableCollection<GeneralHelpers.PropertyCollection>();
            Sources.AddRange(dataModelProps.Where(p => (p.Type == "Int32") || (p.Type == "Single")));

            // Preselect according to the model
            SelectedTarget = dataModelProps.FirstOrDefault(p => p.Path == Proposed.GameProperty);
            SelectedSource = dataModelProps.FirstOrDefault(p => p.Path == Proposed.PercentageProperty);
            LayerPropertyType = Proposed.LayerPropertyType;

            // Populate the extra options combobox
            switch (_property)
            {
                case "Width":
                    LayerPropertyOptions = new BindableCollection<LayerPropertyOptions>
                    {
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.LeftToRight,
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.RightToLeft
                    };
                    break;
                case "Height":
                    LayerPropertyOptions = new BindableCollection<LayerPropertyOptions>
                    {
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.Downwards,
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.Upwards
                    };
                    break;
                case "Opacity":
                    LayerPropertyOptions = new BindableCollection<LayerPropertyOptions>
                    {
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.Increase,
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.Decrease
                    };
                    break;
            }

            UserSourceIsVisible = LayerPropertyType == LayerPropertyType.PercentageOf;
            SourcesIsVisible = LayerPropertyType == LayerPropertyType.PercentageOfProperty;

            // Set up a default for SelectedTarget if it was null
            if (SelectedTarget.Display == null)
                SelectedTarget = Targets.FirstOrDefault();
            // Set up a default for the extra option if it fell outside the range
            if (!LayerPropertyOptions.Contains(Proposed.LayerPropertyOptions))
                Proposed.LayerPropertyOptions = LayerPropertyOptions.FirstOrDefault();
        }
开发者ID:SpoinkyNL,项目名称:Artemis,代码行数:57,代码来源:LayerDynamicPropertiesViewModel.cs


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