コード例 #1
0
        private void SetEnabledState()
        {
            int  nIndexPos = positionCombo.SelectedIndex;
            bool fEnabled  = (positionCombo.IsSet() &&
                              nIndexPos != IDX_POS_STATIC);

            // enabled when position is relative or absolute
            leftUnit.Enabled = fEnabled;
            topUnit.Enabled  = fEnabled;

            // enabled when position is absolute
            zIndexEdit.Enabled = nIndexPos == IDX_POS_ABSOLUTE;
        }
コード例 #2
0
        /// <include file='doc\DataGridGeneralPage.uex' path='docs/doc[@for="DataGridGeneralPage.SaveComponent"]/*' />
        /// <devdoc>
        ///   Saves the component loaded into the page.
        /// </devdoc>
        protected override void SaveComponent()
        {
            DataGrid dataGrid = (DataGrid)GetBaseControl();

            dataGrid.ShowHeader   = showHeaderCheck.Checked;
            dataGrid.ShowFooter   = showFooterCheck.Checked;
            dataGrid.AllowSorting = allowSortingCheck.Checked;

            string dataKeyField = String.Empty;

            if (dataKeyFieldCombo.IsSet())
            {
                dataKeyField = (string)dataKeyFieldCombo.SelectedItem;
            }
            dataGrid.DataKeyField = dataKeyField;

            if (dataSourceDirty)
            {
                // save the datasource as a binding on the control

                DataGridDesigner      dataGridDesigner = (DataGridDesigner)GetBaseDesigner();
                DataBindingCollection dataBindings     = dataGridDesigner.DataBindings;

                if (currentDataSource == null)
                {
                    dataGridDesigner.DataSource = String.Empty;
                    dataGridDesigner.DataMember = String.Empty;
                }
                else
                {
                    dataGridDesigner.DataSource = currentDataSource.ToString();

                    if (dataMemberCombo.IsSet())
                    {
                        dataGridDesigner.DataMember = (string)dataMemberCombo.SelectedItem;
                    }
                    else
                    {
                        dataGridDesigner.DataMember = String.Empty;
                    }
                }

                dataGridDesigner.OnDataSourceChanged();
            }
        }
コード例 #3
0
        /// <include file='doc\DataGridGeneralPage.uex' path='docs/doc[@for="DataGridGeneralPage.OnSelChangedDataSource"]/*' />
        /// <devdoc>
        ///   Handles changes in the datasource selection.
        /// </devdoc>
        private void OnSelChangedDataSource(object source, EventArgs e)
        {
            if (IsLoading())
            {
                return;
            }

            DataSourceItem newDataSource = null;

            if (dataSourceCombo.IsSet())
            {
                newDataSource = (DataSourceItem)dataSourceCombo.SelectedItem;
            }

            if (newDataSource != null)
            {
                if (newDataSource.IsSelectable() == false)
                {
                    EnterLoadingMode();
                    if (currentDataSource == null)
                    {
                        dataSourceCombo.SelectedIndex = -1;
                    }
                    else
                    {
                        dataSourceCombo.SelectedItem = currentDataSource;
                    }
                    ExitLoadingMode();
                    return;
                }
            }

            currentDataSource = newDataSource;
            if (currentDataSource is ListSourceDataSourceItem)
            {
                ((ListSourceDataSourceItem)currentDataSource).CurrentDataMember = null;
            }

            LoadDataMembers();
            LoadDataSourceFields();
            dataSourceDirty = true;

            SetDirty();
            UpdateEnabledVisibleState();
        }
コード例 #4
0
        private string SaveLayoutUI()
        {
            string value;

            if (layoutCombo.IsSet())
            {
                int index = layoutCombo.SelectedIndex;
                Debug.Assert((index >= 1) && (index < LAYOUT_VALUES.Length),
                             "Invalid index for layout");

                value = LAYOUT_VALUES[index];
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #5
0
        private string SaveBordersUI()
        {
            string value;

            if (bordersCombo.IsSet())
            {
                int index = bordersCombo.SelectedIndex;
                Debug.Assert((index >= 1) && (index < BORDERS_VALUES.Length),
                             "Invalid index for borders");

                value = BORDERS_VALUES[index];
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #6
0
        private string SaveCursorUI()
        {
            string value;

            if (cursorCombo.IsSet())
            {
                int index = cursorCombo.SelectedIndex;
                Debug.Assert((index >= 1) && (index < CURSOR_VALUES.Length),
                             "Invalid index for cursor");

                value = CURSOR_VALUES[index];
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #7
0
        private string SavePageBreakUI(UnsettableComboBox cbxPgBr)
        {
            string value;

            if (cbxPgBr.IsSet())
            {
                int index = cbxPgBr.SelectedIndex;
                Debug.Assert((index >= 1) && (index < PAGEBREAK_VALUES.Length),
                             "Invalid index for page break");

                value = PAGEBREAK_VALUES[index];
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #8
0
        private string SaveVisibilityUI()
        {
            string value;

            if (visibilityCombo.IsSet())
            {
                int index = visibilityCombo.SelectedIndex;
                Debug.Assert((index >= 1) && (index < VISIBILITY_VALUES.Length),
                             "Invalid index for visibility");

                value = VISIBILITY_VALUES[index];
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #9
0
        private string SaveOverflowUI()
        {
            string value;

            if (overflowCombo.IsSet())
            {
                int index = overflowCombo.SelectedIndex;
                Debug.Assert((index >= 1) && (index < OVERFLOW_VALUES.Length),
                             "Invalid index for overflow");

                value = OVERFLOW_VALUES[index];
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #10
0
        private string SaveFloatUI()
        {
            string value;

            if (floatCombo.IsSet())
            {
                int index = floatCombo.SelectedIndex;
                Debug.Assert((index >= 1) && (index < FLOAT_VALUES.Length),
                             "Invalid index for floats");

                value = FLOAT_VALUES[index];
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #11
0
        private string SaveDisplayUI()
        {
            string value;

            if (displayCombo.IsSet())
            {
                int index = displayCombo.SelectedIndex;
                Debug.Assert((index >= 1) && (index < DISPLAY_VALUES.Length),
                             "Invalid index for display");

                value = DISPLAY_VALUES[index];
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #12
0
        private string SaveBulletPositionUI()
        {
            string value;

            if ((listTypeCombo.SelectedIndex == IDX_TYPE_BULLETED) &&
                (positionCombo.IsSet()))
            {
                int index = positionCombo.SelectedIndex;
                Debug.Assert((index >= 1) && (index < POSITION_VALUES.Length),
                             "Invalid index for bullet position");

                value = POSITION_VALUES[index];
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #13
0
        private string SaveBulletStyleUI()
        {
            string value;

            if ((listTypeCombo.SelectedIndex == IDX_TYPE_BULLETED) &&
                (styleCombo.IsSet()))
            {
                int index = styleCombo.SelectedIndex;

                Debug.Assert((index >= 1) && (index < STYLE_VALUES.Length),
                             "Invalid index for bullet type");
                value = STYLE_VALUES[index];
            }
            else if (listTypeCombo.SelectedIndex == IDX_TYPE_UNBULLETED)
            {
                value = STYLE_NONE_VALUE;
            }
            else
            {
                value = "";
            }

            return(value);
        }
コード例 #14
0
        /// <include file='doc\DataGridGeneralPage.uex' path='docs/doc[@for="DataGridGeneralPage.LoadComponent"]/*' />
        /// <devdoc>
        ///   Loads the component into the page.
        /// </devdoc>
        protected override void LoadComponent()
        {
            InitPage();

            DataGrid dataGrid = (DataGrid)GetBaseControl();

            LoadDataSourceItems();

            showHeaderCheck.Checked   = dataGrid.ShowHeader;
            showFooterCheck.Checked   = dataGrid.ShowFooter;
            allowSortingCheck.Checked = dataGrid.AllowSorting;

            if (dataSourceCombo.Items.Count > 0)
            {
                DataGridDesigner dataGridDesigner = (DataGridDesigner)GetBaseDesigner();
                string           dataSourceValue  = dataGridDesigner.DataSource;

                if (dataSourceValue != null)
                {
                    int dataSourcesAvailable = dataSourceCombo.Items.Count;
                    for (int j = 1; j < dataSourcesAvailable; j++)
                    {
                        DataSourceItem dataSourceItem =
                            (DataSourceItem)dataSourceCombo.Items[j];

                        if (String.Compare(dataSourceItem.Name, dataSourceValue, true, CultureInfo.InvariantCulture) == 0)
                        {
                            dataSourceCombo.SelectedIndex = j;
                            currentDataSource             = dataSourceItem;
                            LoadDataMembers();

                            if (currentDataSource is ListSourceDataSourceItem)
                            {
                                string dataMember = dataGridDesigner.DataMember;
                                dataMemberCombo.SelectedIndex = dataMemberCombo.FindStringExact(dataMember);

                                if (dataMemberCombo.IsSet())
                                {
                                    ((ListSourceDataSourceItem)currentDataSource).CurrentDataMember = dataMember;
                                }
                            }

                            LoadDataSourceFields();

                            break;
                        }
                    }
                }
            }

            string dataKeyField = dataGrid.DataKeyField;

            if (dataKeyField.Length != 0)
            {
                int fieldIndex = dataKeyFieldCombo.FindStringExact(dataKeyField);
                dataKeyFieldCombo.SelectedIndex = fieldIndex;
            }

            if (dataGrid.AutoGenerateColumns)
            {
                columnInfoLabel.Text = SR.GetString(SR.DGGen_AutoColumnInfo);
            }
            else
            {
                columnInfoLabel.Text = SR.GetString(SR.DGGen_CustomColumnInfo);
            }

            UpdateEnabledVisibleState();
        }
コード例 #15
0
        /// <include file='doc\DataListGeneralPage.uex' path='docs/doc[@for="DataListGeneralPage.SaveComponent"]/*' />
        /// <devdoc>
        ///   Saves the component loaded into the page.
        /// </devdoc>
        protected override void SaveComponent()
        {
            DataList dataList = (DataList)GetBaseControl();

            dataList.ShowHeader = showHeaderCheck.Checked;
            dataList.ShowFooter = showFooterCheck.Checked;

            try {
                int    repeatColumns      = 1;
                string repeatColumnsValue = repeatColumnsEdit.Text.Trim();
                if (repeatColumnsValue.Length != 0)
                {
                    repeatColumns = Int32.Parse(repeatColumnsValue, CultureInfo.InvariantCulture);
                }
                dataList.RepeatColumns = repeatColumns;
            } catch (Exception) {
                repeatColumnsEdit.Text = (dataList.RepeatColumns).ToString();
            }

            switch (repeatDirectionCombo.SelectedIndex)
            {
            case IDX_DIR_HORIZONTAL:
                dataList.RepeatDirection = RepeatDirection.Horizontal;
                break;

            case IDX_DIR_VERTICAL:
                dataList.RepeatDirection = RepeatDirection.Vertical;
                break;
            }

            switch (repeatLayoutCombo.SelectedIndex)
            {
            case IDX_MODE_TABLE:
                dataList.RepeatLayout = RepeatLayout.Table;
                break;

            case IDX_MODE_FLOW:
                dataList.RepeatLayout = RepeatLayout.Flow;
                break;
            }

            dataList.ExtractTemplateRows = extractRowsCheck.Checked;

            string dataKeyField = String.Empty;

            if (dataKeyFieldCombo.IsSet())
            {
                dataKeyField = (string)dataKeyFieldCombo.SelectedItem;
            }
            dataList.DataKeyField = dataKeyField;

            if (dataSourceDirty)
            {
                DataListDesigner dataListDesigner = (DataListDesigner)GetBaseDesigner();

                // save the datasource as a binding on the control
                DataBindingCollection dataBindings = dataListDesigner.DataBindings;

                if (currentDataSource == null)
                {
                    dataListDesigner.DataSource = String.Empty;
                    dataListDesigner.DataMember = String.Empty;
                }
                else
                {
                    dataListDesigner.DataSource = currentDataSource.ToString();
                    if (dataMemberCombo.IsSet())
                    {
                        dataListDesigner.DataMember = (string)dataMemberCombo.SelectedItem;
                    }
                    else
                    {
                        dataListDesigner.DataMember = String.Empty;
                    }
                }

                dataListDesigner.OnDataSourceChanged();
            }
        }
コード例 #16
0
        /// <include file='doc\DataListGeneralPage.uex' path='docs/doc[@for="DataListGeneralPage.LoadComponent"]/*' />
        /// <devdoc>
        ///   Loads the component into the page.
        /// </devdoc>
        protected override void LoadComponent()
        {
            InitPage();

            DataList dataList = (DataList)GetBaseControl();

            LoadDataSourceItems();

            showHeaderCheck.Checked = dataList.ShowHeader;
            showFooterCheck.Checked = dataList.ShowFooter;

            repeatColumnsEdit.Text = (dataList.RepeatColumns).ToString();

            switch (dataList.RepeatDirection)
            {
            case RepeatDirection.Horizontal:
                repeatDirectionCombo.SelectedIndex = IDX_DIR_HORIZONTAL;
                break;

            case RepeatDirection.Vertical:
                repeatDirectionCombo.SelectedIndex = IDX_DIR_VERTICAL;
                break;
            }

            switch (dataList.RepeatLayout)
            {
            case RepeatLayout.Table:
                repeatLayoutCombo.SelectedIndex = IDX_MODE_TABLE;
                break;

            case RepeatLayout.Flow:
                repeatLayoutCombo.SelectedIndex = IDX_MODE_FLOW;
                break;
            }

            extractRowsCheck.Checked = dataList.ExtractTemplateRows;

            if (dataSourceCombo.Items.Count > 0)
            {
                DataListDesigner dataListDesigner = (DataListDesigner)GetBaseDesigner();
                string           dataSourceValue  = dataListDesigner.DataSource;

                if (dataSourceValue != null)
                {
                    int dataSourcesAvailable = dataSourceCombo.Items.Count;
                    for (int j = 1; j < dataSourcesAvailable; j++)
                    {
                        DataSourceItem dataSourceItem =
                            (DataSourceItem)dataSourceCombo.Items[j];

                        if (String.Compare(dataSourceItem.Name, dataSourceValue, true, CultureInfo.InvariantCulture) == 0)
                        {
                            dataSourceCombo.SelectedIndex = j;
                            currentDataSource             = dataSourceItem;
                            LoadDataMembers();

                            if (currentDataSource is ListSourceDataSourceItem)
                            {
                                string dataMember = dataListDesigner.DataMember;
                                dataMemberCombo.SelectedIndex = dataMemberCombo.FindStringExact(dataMember);

                                if (dataMemberCombo.IsSet())
                                {
                                    ((ListSourceDataSourceItem)currentDataSource).CurrentDataMember = dataMember;
                                }
                            }

                            LoadDataSourceFields();

                            break;
                        }
                    }
                }
            }

            string dataKeyField = dataList.DataKeyField;

            if (dataKeyField.Length != 0)
            {
                int fieldIndex = dataKeyFieldCombo.FindStringExact(dataKeyField);
                dataKeyFieldCombo.SelectedIndex = fieldIndex;
            }

            UpdateEnabledVisibleState();
        }