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


C# Collections.ObservableCollection类代码示例

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


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

示例1: ContinuousAxisPanel

 public ContinuousAxisPanel()
 {
     _largestLabelSize = new Size();
     SetValue(ItemsSourceKey, new ObservableCollection<String>());
     YValues = new ObservableCollection<double>();
     SetValue(TickPositionsKey, new ObservableCollection<double>());
 }
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:7,代码来源:ContinuousAxisPanel.cs

示例2: OrderViewModel

        public OrderViewModel()
        {
            this.DisplayName = "Add/Edit Order";

            context = new LittleTravellerDataContext();
            var CanSave = this.Changed.Select(_ => ValidateFields()).StartWith(false);
            SaveCommand = new ReactiveCommand(CanSave);
            SaveCommand.Subscribe(_ => SaveOrder());
            NewOrderNumCommand = new ReactiveCommand();
            NewOrderNumCommand.Subscribe(_ => NewOrderNum());
            CloseTabCommand = new ReactiveCommand();
            CloseTabCommand.Subscribe(_ => TabClosing());
            SaveCommand.Subscribe(_ => SaveOrder());
            var CanAddItem = this.Changed.Select(_ => CanAddItemValidate()).StartWith(false);
            AddItemCommand = new ReactiveCommand(CanAddItem);
            AddItemCommand.Subscribe(_ => AddItem());
            DeleteItemCommand = new ReactiveCommand();
            DeleteItemCommand.OfType<ItemOptionsClass>().Subscribe(item => DeleteItem(item));

            CustomerOptions = (from cs in context.Customers select cs.CompanyName).ToList();
            SeasonOptions = context.Seasons.ToList();
            SizeTypeOptions = context.SizeTypes.ToList();
            ItemOptions = new ReactiveCollection<ItemOptionsClass>();
            _orderItems = new ObservableCollection<ItemOptionsClass>();
            AllSeasonsChecked = true;
            AllSizeTypesChecked = true;

            FillItemOptions();
        }
开发者ID:cab-codespring,项目名称:LitTravMaint,代码行数:29,代码来源:OrderViewModel.cs

示例3: GetAll

        //public static int Insert(string dbFile, string sql,)
        public static ObservableCollection<Jewelry> GetAll()
        {
            ObservableCollection<Jewelry> ob = new ObservableCollection<Jewelry>();

            using (SQLiteConnection conn = new SQLiteConnection(@"Data Source=c:/xhz/ms.db;"))
            //using (SQLiteConnection conn = new SQLiteConnection(@"Data Source=DB/ms.db;"))
            {
                conn.Open();

                string sql = string.Format("select * from detail");

                SQLiteCommand cmd = new SQLiteCommand(sql, conn);

                using (SQLiteDataReader dr1 = cmd.ExecuteReader())
                {
                    while (dr1.Read())
                    {
                        var d = dr1;
                        var dd = dr1.GetValue(0);
                        var data = dr1.GetValue(1);
                        var insert = dr1.GetValue(2);
                        var update = dr1.GetValue(3);
                    }
                }

                conn.Close();
            }

            ob.Add(new Jewelry());

            return ob;
        }
开发者ID:haozhouxu,项目名称:Jewelry,代码行数:33,代码来源:SQLiteService.cs

示例4: ViewsCollection

 /// <summary>
 /// Initializes a new instance of <see cref="ViewsCollection"/>.
 /// </summary>
 /// <param name="list">The list to wrap and filter.</param>
 /// <param name="filter">A predicate to filter the <paramref name="list"/> collection.</param>
 public ViewsCollection(ObservableCollection<ItemMetadata> list, Predicate<ItemMetadata> filter)
 {
     this.subjectCollection = list;
     this.filter = filter;
     Initialize();
     subjectCollection.CollectionChanged += UnderlyingCollection_CollectionChanged;
 }
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:12,代码来源:ViewsCollection.cs

示例5: FinAnalysisVM

 public FinAnalysisVM(DataGrid dataGrid)
 {
     _dataGrid = dataGrid;
     _rowMapping = Rowmapping.EnglishRows();
     _showTable = new ObservableCollection<FinAnalysisData>();
     _columnHeader = new List<string>();
 }
开发者ID:AFFA,项目名称:Project,代码行数:7,代码来源:FinAnalysisVM.cs

示例6: setupLogs

		void setupLogs()
		{
			RosLogs = new ObservableCollection<string>();
			
			_listener = ROS.Utils.Messenger.Client.Listener.CreateListener("prod", "edi-spy", "edi", "vog");
			_listener.MessageReceived += _listener_MessageReceived;
		}
开发者ID:jdugdale,项目名称:leftfork-soup,代码行数:7,代码来源:MainViewModel.cs

示例7: StatementType

 public StatementType() {
     this.statementLineField = new ObservableCollection<StatementLineType>();
     this.taxTotalField = new ObservableCollection<TaxTotalType>();
     this.allowanceChargeField = new ObservableCollection<AllowanceChargeType>();
     this.paymentTermsField = new ObservableCollection<PaymentTermsType>();
     this.paymentMeansField = new ObservableCollection<PaymentMeansType>();
     this.payeePartyField = new PartyType();
     this.originatorCustomerPartyField = new CustomerPartyType();
     this.sellerSupplierPartyField = new SupplierPartyType();
     this.buyerCustomerPartyField = new CustomerPartyType();
     this.accountingCustomerPartyField = new CustomerPartyType();
     this.accountingSupplierPartyField = new SupplierPartyType();
     this.signatureField = new ObservableCollection<SignatureType>();
     this.additionalDocumentReferenceField = new ObservableCollection<DocumentReferenceType>();
     this.statementPeriodField = new PeriodType();
     this.statementTypeCodeField = new StatementTypeCodeType();
     this.lineCountNumericField = new LineCountNumericType();
     this.totalBalanceAmountField = new TotalBalanceAmountType();
     this.totalCreditAmountField = new TotalCreditAmountType();
     this.totalDebitAmountField = new TotalDebitAmountType();
     this.documentCurrencyCodeField = new DocumentCurrencyCodeType();
     this.noteField = new ObservableCollection<NoteType>();
     this.issueTimeField = new IssueTimeType();
     this.issueDateField = new IssueDateType();
     this.uUIDField = new UUIDType();
     this.copyIndicatorField = new CopyIndicatorType();
     this.idField = new IDType();
     this.profileExecutionIDField = new ProfileExecutionIDType();
     this.profileIDField = new ProfileIDType();
     this.customizationIDField = new CustomizationIDType();
     this.uBLVersionIDField = new UBLVersionIDType();
     this.uBLExtensionsField = new ObservableCollection<UBLExtensionType>();
 }
开发者ID:KidFashion,项目名称:UBL.net,代码行数:33,代码来源:UBL-Statement-2.1.designer.cs

示例8: AddTest

 public static void AddTest()
 {
     string[] anArray = { "one", "two", "three" };
     ObservableCollection<string> col = new ObservableCollection<string>(anArray);
     CollectionAndPropertyChangedTester helper = new CollectionAndPropertyChangedTester();
     helper.AddOrInsertItemTest(col, "four");
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:7,代码来源:ObservableCollection_MethodsTest.cs

示例9: RemoveTest

        public static void RemoveTest()
        {
            // trying to remove item in collection.
            string[] anArray = { "one", "two", "three", "four" };
            ObservableCollection<string> col = new ObservableCollection<string>(anArray);
            CollectionAndPropertyChangedTester helper = new CollectionAndPropertyChangedTester();
            helper.RemoveItemTest(col, 2, "three", true, hasDuplicates: false);

            // trying to remove item not in collection.
            anArray = new string[] { "one", "two", "three", "four" };
            col = new ObservableCollection<string>(anArray);
            helper = new CollectionAndPropertyChangedTester();
            helper.RemoveItemTest(col, -1, "three2", false, hasDuplicates: false);

            // removing null
            anArray = new string[] { "one", "two", "three", "four" };
            col = new ObservableCollection<string>(anArray);
            helper = new CollectionAndPropertyChangedTester();
            helper.RemoveItemTest(col, -1, null, false, hasDuplicates: false);

            // trying to remove item in collection that has duplicates.
            anArray = new string[] { "one", "three", "two", "three", "four" };
            col = new ObservableCollection<string>(anArray);
            helper = new CollectionAndPropertyChangedTester();
            helper.RemoveItemTest(col, 1, "three", true, hasDuplicates: true);
            // want to ensure that there is one "three" left in collection and not both were removed.
            int occurancesThree = 0;
            foreach (var item in col)
            {
                if (item.Equals("three"))
                    occurancesThree++;
            }
            Assert.Equal(1, occurancesThree);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:34,代码来源:ObservableCollection_MethodsTest.cs

示例10: TemplatePanel

        /// <summary>
        /// Initializes an instance of a TemplatePanel.
        /// </summary>
        public TemplatePanel()
        {
            _contentList = new ObservableCollection<UIElement>();
            _contentList.CollectionChanged += OnContentListCollectionChanged;

            Loaded += OnLoaded;
        }
开发者ID:nikhilk,项目名称:silverlightfx,代码行数:10,代码来源:TemplatePanel.cs

示例11: GuaranteeCertificateType

 public GuaranteeCertificateType() {
     this.beneficiaryPartyField = new PartyType();
     this.interestedPartyField = new PartyType();
     this.guarantorPartyField = new PartyType();
     this.signatureField = new ObservableCollection<SignatureType>();
     this.immobilizedSecurityField = new ObservableCollection<ImmobilizedSecurityType>();
     this.guaranteeDocumentReferenceField = new ObservableCollection<DocumentReferenceType>();
     this.applicableRegulationField = new ObservableCollection<RegulationType>();
     this.applicablePeriodField = new PeriodType();
     this.noteField = new ObservableCollection<NoteType>();
     this.constitutionCodeField = new ConstitutionCodeType();
     this.liabilityAmountField = new LiabilityAmountType();
     this.purposeField = new ObservableCollection<PurposeType>();
     this.guaranteeTypeCodeField = new GuaranteeTypeCodeType();
     this.issueTimeField = new IssueTimeType();
     this.issueDateField = new IssueDateType();
     this.contractFolderIDField = new ContractFolderIDType();
     this.uUIDField = new UUIDType();
     this.copyIndicatorField = new CopyIndicatorType();
     this.idField = new IDType();
     this.profileExecutionIDField = new ProfileExecutionIDType();
     this.profileIDField = new ProfileIDType();
     this.customizationIDField = new CustomizationIDType();
     this.uBLVersionIDField = new UBLVersionIDType();
     this.uBLExtensionsField = new ObservableCollection<UBLExtensionType>();
 }
开发者ID:KidFashion,项目名称:UBL.net,代码行数:26,代码来源:UBL-GuaranteeCertificate-2.1.designer.cs

示例12: TestDataEditor

        public TestDataEditor()
        {
            InitializeComponent();

            //retrieve dat
            //            string strSelect = "SELECT ID,Name,Email,Desc FROM Customer ORDER BY ID ASC";
            //            _customerEntries = (Application.Current as App).db.SelectObservableCollection<Customer>(strSelect);
            string strSelect = "SELECT id FROM label";
            _labelEntries = (Application.Current as App).db.SelectObservableCollection<TableLable>(strSelect);
            int i = 0;
            foreach (TableLable data in _labelEntries)
            {
                if (i >= 10)
                    break;
                TextBlockID.Text += data.id + Environment.NewLine;
                i++;
            }
            //foreach (Customer data in _customerEntries)
            //{
            //    TextBlockID.Text += data.ID + Environment.NewLine;
            //    TextBlockName.Text +=data.Name + Environment.NewLine;
            //    TextBlockEmail.Text +=data.Email + Environment.NewLine;
            //    TextBlockDesc.Text +=data.Desc + Environment.NewLine;
            //}
        }
开发者ID:ackratos,项目名称:USTCMap,代码行数:25,代码来源:DBHelperSampleCode.cs

示例13: MainViewModel

        public MainViewModel(IEventAggregator eventAggregator, ISignalRClient signalRClient, IAuthStore authStore,
            IProductsRepository productsRepository)
        {
            this.eventAggregator = eventAggregator;
            this.signalRClient = signalRClient;
            this.productsRepository = productsRepository;

            deleteRequest = new InteractionRequest<Confirmation>();
            CreateProductCommand = new DelegateCommand(CreateProduct);
            OpenProductCommand = new DelegateCommand<Product>(EditProduct);
            changePriceCommand = new DelegateCommand(ChangePrice, HasSelectedProducts);
            deleteCommand = new DelegateCommand(PromtDelete, HasSelectedProducts);

            cvs = new CollectionViewSource();
            items = new ObservableCollection<Product>();
            cvs.Source = items;
            cvs.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            cvs.SortDescriptions.Add(new SortDescription("Size", ListSortDirection.Ascending));

            var token = authStore.LoadToken();
            if (token != null)
            {
                IsEditor = token.IsEditor();
                IsAdmin = token.IsAdmin();
            }
        }
开发者ID:hva,项目名称:warehouse.net,代码行数:26,代码来源:MainViewModel.cs

示例14: RemittanceAdviceType

 public RemittanceAdviceType() {
     this.remittanceAdviceLineField = new ObservableCollection<RemittanceAdviceLineType>();
     this.taxTotalField = new ObservableCollection<TaxTotalType>();
     this.paymentMeansField = new PaymentMeansType();
     this.payeePartyField = new PartyType();
     this.accountingSupplierPartyField = new SupplierPartyType();
     this.accountingCustomerPartyField = new CustomerPartyType();
     this.signatureField = new ObservableCollection<SignatureType>();
     this.additionalDocumentReferenceField = new ObservableCollection<DocumentReferenceType>();
     this.billingReferenceField = new BillingReferenceType();
     this.invoicePeriodField = new ObservableCollection<PeriodType>();
     this.lineCountNumericField = new LineCountNumericType();
     this.invoicingPartyReferenceField = new InvoicingPartyReferenceType();
     this.payerReferenceField = new PayerReferenceType();
     this.paymentOrderReferenceField = new PaymentOrderReferenceType();
     this.totalPaymentAmountField = new TotalPaymentAmountType();
     this.totalCreditAmountField = new TotalCreditAmountType();
     this.totalDebitAmountField = new TotalDebitAmountType();
     this.documentCurrencyCodeField = new DocumentCurrencyCodeType();
     this.noteField = new ObservableCollection<NoteType>();
     this.issueTimeField = new IssueTimeType();
     this.issueDateField = new IssueDateType();
     this.uUIDField = new UUIDType();
     this.copyIndicatorField = new CopyIndicatorType();
     this.idField = new IDType();
     this.profileExecutionIDField = new ProfileExecutionIDType();
     this.profileIDField = new ProfileIDType();
     this.customizationIDField = new CustomizationIDType();
     this.uBLVersionIDField = new UBLVersionIDType();
     this.uBLExtensionsField = new ObservableCollection<UBLExtensionType>();
 }
开发者ID:KidFashion,项目名称:UBL.net,代码行数:31,代码来源:UBL-RemittanceAdvice-2.1.designer.cs

示例15: CatalogueType

 public CatalogueType() {
     this.catalogueLineField = new ObservableCollection<CatalogueLineType>();
     this.tradingTermsField = new ObservableCollection<TradingTermsType>();
     this.contractorCustomerPartyField = new CustomerPartyType();
     this.sellerSupplierPartyField = new SupplierPartyType();
     this.receiverPartyField = new PartyType();
     this.providerPartyField = new PartyType();
     this.signatureField = new ObservableCollection<SignatureType>();
     this.documentReferenceField = new ObservableCollection<DocumentReferenceType>();
     this.sourceCatalogueReferenceField = new CatalogueReferenceType();
     this.referencedContractField = new ObservableCollection<ContractType>();
     this.validityPeriodField = new ObservableCollection<PeriodType>();
     this.lineCountNumericField = new LineCountNumericType();
     this.previousVersionIDField = new PreviousVersionIDType();
     this.versionIDField = new VersionIDType();
     this.descriptionField = new ObservableCollection<DescriptionType>();
     this.noteField = new ObservableCollection<NoteType>();
     this.revisionTimeField = new RevisionTimeType();
     this.revisionDateField = new RevisionDateType();
     this.issueTimeField = new IssueTimeType();
     this.issueDateField = new IssueDateType();
     this.nameField = new NameType1();
     this.actionCodeField = new ActionCodeType();
     this.uUIDField = new UUIDType();
     this.idField = new IDType();
     this.profileExecutionIDField = new ProfileExecutionIDType();
     this.profileIDField = new ProfileIDType();
     this.customizationIDField = new CustomizationIDType();
     this.uBLVersionIDField = new UBLVersionIDType();
     this.uBLExtensionsField = new ObservableCollection<UBLExtensionType>();
 }
开发者ID:KidFashion,项目名称:UBL.net,代码行数:31,代码来源:UBL-Catalogue-2.1.designer.cs


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