Пример #1
0
        private void UpdateChildren()
        {
            if (lastDataSource != null)
            {
                OnNavigationChildrenCleared();
                items.Clear();
            }

            if (header != null)
            {
                RemoveChildProvider(header);
                header.Terminate();
                header = null;

                SetBehavior(TablePatternIdentifiers.Pattern, null);
            }

            if (lastCurrencyManager == null)
            {
                // First time, otherwise we can't do anything.
                lastCurrencyManager = RequestCurrencyManager();
                if (lastCurrencyManager == null)
                {
                    return;
                }
            }

            // Is showing "+" to expand, this usually happens when DataSource is
            // DataSet and has more than one DataTable.
            if (datagrid.CurrentTableStyle.GridColumnStyles.Count == 0)
            {
                DataGridCustomProvider customProvider
                    = new DataGridCustomProvider(this, 0, string.Empty);
                customProvider.Initialize();
                AddChildProvider(customProvider);
            }
            else
            {
                CreateHeader(datagrid.CurrentTableStyle);

                for (int row = 0; row < lastCurrencyManager.Count; row++)
                {
                    CreateListItem(row, datagrid.CurrentTableStyle);
                }
            }

            lastDataSource = datagrid.DataSource;
        }
Пример #2
0
		private void UpdateChildren ()
		{
			if (lastDataSource != null) {
				OnNavigationChildrenCleared ();
				items.Clear ();
			}

			if (header != null) {
				RemoveChildProvider (header);
				header.Terminate ();
				header = null;

				SetBehavior (TablePatternIdentifiers.Pattern, null);
			}

			if (lastCurrencyManager == null) { 
				// First time, otherwise we can't do anything.
				lastCurrencyManager = RequestCurrencyManager ();
				if (lastCurrencyManager == null)
					return;
			}

			// Is showing "+" to expand, this usually happens when DataSource is
			// DataSet and has more than one DataTable.
			if (datagrid.CurrentTableStyle.GridColumnStyles.Count == 0) {
				DataGridCustomProvider customProvider 
					= new DataGridCustomProvider (this, 0, string.Empty);
				customProvider.Initialize ();
				AddChildProvider (customProvider);
			} else {
				CreateHeader (datagrid.CurrentTableStyle);

				for (int row = 0; row < lastCurrencyManager.Count; row++)
					CreateListItem (row, datagrid.CurrentTableStyle);
			}

			lastDataSource = datagrid.DataSource;
		}