コード例 #1
0
        public override void Initialize(
            GridViewDataColumn dataColumn,
            FilterDescriptor filterDescriptor,
            bool useTypedEditors)
        {
            GridViewComboBoxColumn viewComboBoxColumn1 = dataColumn as GridViewComboBoxColumn;

            if (filterDescriptor == null)
            {
                System.Type            dataType            = dataColumn.DataType;
                GridViewComboBoxColumn viewComboBoxColumn2 = dataColumn as GridViewComboBoxColumn;
                if (viewComboBoxColumn2 != null)
                {
                    dataType = viewComboBoxColumn2.FilteringMemberDataType;
                }
                FilterOperator defaultFilterOperator = GridViewHelper.GetDefaultFilterOperator(dataType);
                filterDescriptor = !(dataColumn is GridViewDateTimeColumn) ? new FilterDescriptor(dataColumn.Name, defaultFilterOperator, (object)null) : (FilterDescriptor) new DateFilterDescriptor(dataColumn.Name, defaultFilterOperator, new DateTime?(), false);
            }
            this.dataType = viewComboBoxColumn1 == null ? dataColumn.DataType : viewComboBoxColumn1.FilteringMemberDataType;
            this.column   = dataColumn;
            this.InitialSetFilterDescriptor(filterDescriptor);
            if (useTypedEditors)
            {
                this.CreateEditors((GridViewColumn)this.column);
            }
            else
            {
                this.CreateEditors((GridViewColumn)null);
            }
            this.LocalizeForm();
        }
コード例 #2
0
        private FilterOperator GetDefaultFilterOperator(GridViewDataColumn dataColumn)
        {
            Type dataType = dataColumn.DataType;
            GridViewComboBoxColumn viewComboBoxColumn = dataColumn as GridViewComboBoxColumn;

            if (viewComboBoxColumn != null)
            {
                dataType = viewComboBoxColumn.FilteringMemberDataType;
            }
            return(GridViewHelper.GetDefaultFilterOperator(dataType));
        }
コード例 #3
0
        public override void Initialize(
            GridViewDataColumn dataColumn,
            FilterDescriptor filterDescriptor,
            bool useTypedEditors)
        {
            GridViewDateTimeColumn viewDateTimeColumn = dataColumn as GridViewDateTimeColumn;

            if (viewDateTimeColumn != null)
            {
                this.DataFilter.DataFilterElement.DefaultDateEditorFormat       = viewDateTimeColumn.Format;
                this.DataFilter.DataFilterElement.DefaultCustomDateEditorFormat = viewDateTimeColumn.CustomFormat;
            }
            GridViewComboBoxColumn viewComboBoxColumn = dataColumn as GridViewComboBoxColumn;

            if (filterDescriptor == null)
            {
                System.Type dataType = dataColumn.DataType;
                if (viewComboBoxColumn != null)
                {
                    dataType = viewComboBoxColumn.FilteringMemberDataType;
                }
                FilterOperator defaultFilterOperator = GridViewHelper.GetDefaultFilterOperator(dataType);
                filterDescriptor = viewDateTimeColumn == null ? new FilterDescriptor(dataColumn.Name, defaultFilterOperator, (object)null) : (FilterDescriptor) new DateFilterDescriptor(dataColumn.Name, defaultFilterOperator, new DateTime?(), false);
            }
            this.dataType = viewComboBoxColumn == null ? (!(dataColumn is GridViewCheckBoxColumn) ? dataColumn.DataType : typeof(bool)) : viewComboBoxColumn.FilteringMemberDataType;
            this.column   = dataColumn;
            this.radDataFilter1.Descriptors.Clear();
            if (viewComboBoxColumn != null)
            {
                this.radDataFilter1.Descriptors.Add((RadItem) new DataFilterComboDescriptorItem(this.column.Name, this.DataType, viewComboBoxColumn.DataSource, viewComboBoxColumn.DisplayMember, viewComboBoxColumn.ValueMember));
            }
            else if (useTypedEditors)
            {
                this.radDataFilter1.Descriptors.Add((RadItem) new DataFilterDescriptorItem(this.column.Name, this.DataType));
            }
            else
            {
                this.radDataFilter1.Descriptors.Add((RadItem) new DataFilterDescriptorItem(this.column.Name, typeof(string)));
            }
            this.InitialSetFilterDescriptor(filterDescriptor);
            this.LocalizeForm();
        }