Пример #1
0
        private void c1DataFilter1_FilterAutoGenerating(object sender, C1.DataFilter.FilterAutoGeneratingEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Model":
                var modelFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                modelFilter.ShowSearchBox = true;
                modelFilter.SelectAll();
                break;

            case "Brand":
                var brandFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                brandFilter.SelectAll();
                break;

            case "Liter":
                var literFilter = (C1.Win.DataFilter.RangeFilter)e.Filter;
                literFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Liter"));
                literFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Liter"));
                literFilter.Increment = 0.01;
                break;

            case "TransmissSpeedCount":
                var tskFilter = new C1.Win.DataFilter.ChecklistFilter("TransmissSpeedCount");
                tskFilter.HeaderText    = "Transmiss speed count";
                tskFilter.ShowSelectAll = false;
                tskFilter.SelectAll();
                e.Filter = tskFilter;
                break;

            case "Category":
                var categoryFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                categoryFilter.ShowSelectAll = false;
                categoryFilter.SelectAll();
                break;

            case "Price":
                var priceFilter = (C1.Win.DataFilter.RangeFilter)e.Filter;
                priceFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Price"));
                priceFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Price"));
                priceFilter.Increment = 1000;
                priceFilter.Digits    = 0;
                break;

            default:
                e.Cancel = true;
                break;
            }
        }
        private void c1DataFilter1_FilterAutoGenerating(object sender, C1.DataFilter.FilterAutoGeneratingEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "PostId":
                var postFilter = new C1.Win.DataFilter.ChecklistFilter("PostId")
                {
                    DisplayMemberPath = "Title",
                    ValueMemberPath   = "Id",
                    SelectionMode     = C1.DataFilter.SelectionMode.Single,
                    ShowSearchBox     = false,
                    LayoutType        = C1.DataFilter.LayoutType.List,
                    MaxHeight         = 200,
                    HeaderText        = e.Filter.HeaderText,
                    ItemsSource       = Employee.Posts
                };
                postFilter.Items[0].Selected = true;
                e.Filter = postFilter;
                break;

            case "EmploymentDate":
                var eDate = (C1.Win.DataFilter.DateRangeFilter)e.Filter;
                var data  = (List <Employee>)c1DataFilter1.DataSource;
                eDate.Minimum = data.Min(x => x.EmploymentDate);
                eDate.Maximum = data.Max(x => x.EmploymentDate);
                break;

            case "CountryId":
                var cntFilter = new C1.Win.DataFilter.ChecklistFilter("CountryId")
                {
                    DisplayMemberPath = "Name",
                    ValueMemberPath   = "Id",
                    SelectionMode     = C1.DataFilter.SelectionMode.Multiple,
                    ShowSearchBox     = false,
                    ShowSelectAll     = true,
                    HeaderText        = e.Filter.HeaderText,
                    ItemsSource       = Employee.Countries
                };
                cntFilter.SelectAll();
                e.Filter = cntFilter;
                break;

            default:
                e.Cancel = true;
                break;
            }
        }
        private void c1DataFilter1_FilterAutoGenerating(object sender, C1.DataFilter.FilterAutoGeneratingEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Model":
                var modelFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                modelFilter.ShowSearchBox = true;
                modelFilter.SelectAll();
                break;

            case "Brand":
                var brandFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                brandFilter.SelectAll();
                break;

            case "Liter":
                var literFilter = (C1.Win.DataFilter.RangeFilter)e.Filter;
                literFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Liter"));
                literFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Liter"));
                literFilter.Increment = 0.01;
                break;

            case "TransmissSpeedCount":
                var tskFilter = new C1.Win.DataFilter.ChecklistFilter("TransmissSpeedCount");
                tskFilter.HeaderText    = "Transmiss speed count";
                tskFilter.ShowSelectAll = false;
                tskFilter.SelectAll();
                e.Filter = tskFilter;
                break;

            case "Category":
                var categoryFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                categoryFilter.ShowSelectAll = false;
                categoryFilter.SelectAll();
                break;

            case "TransmissAutomatic":
                var taFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                taFilter.ItemsSource = new List <TransmissAutomatic>()
                {
                    new TransmissAutomatic()
                    {
                        DisplayValue = "Yes", Value = "Yes"
                    },
                    new TransmissAutomatic()
                    {
                        DisplayValue = "No", Value = "No"
                    },
                    new TransmissAutomatic()
                    {
                        DisplayValue = "No information", Value = DBNull.Value
                    }
                };
                taFilter.DisplayMemberPath = "DisplayValue";
                taFilter.ValueMemberPath   = "Value";
                taFilter.ShowSelectAll     = false;
                taFilter.LayoutType        = C1.DataFilter.LayoutType.List;
                taFilter.SelectAll();
                break;

            case "Price":
                var priceFilter = (C1.Win.DataFilter.RangeFilter)e.Filter;
                priceFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Price"));
                priceFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Price"));
                priceFilter.Increment = 1000;
                priceFilter.Digits    = 0;
                break;

            default:
                e.Cancel = true;
                break;
            }
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     C1.Win.DataFilter.ChecklistFilter checklistFilter3       = new C1.Win.DataFilter.ChecklistFilter();
     C1.Win.DataFilter.ChecklistFilter checklistFilter4       = new C1.Win.DataFilter.ChecklistFilter();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
     this.c1Ribbon1 = new C1.Win.Ribbon.C1Ribbon();
     this.ribbonApplicationMenu1 = new C1.Win.Ribbon.RibbonApplicationMenu();
     this.ribbonBottomToolBar1   = new C1.Win.Ribbon.RibbonBottomToolBar();
     this.ribbonConfigToolBar1   = new C1.Win.Ribbon.RibbonConfigToolBar();
     this.ribbonQat1             = new C1.Win.Ribbon.RibbonQat();
     this.ribbonTab1             = new C1.Win.Ribbon.RibbonTab();
     this.ribbonGroup1           = new C1.Win.Ribbon.RibbonGroup();
     this.btnApply           = new C1.Win.Ribbon.RibbonButton();
     this.cbAutoApply        = new C1.Win.Ribbon.RibbonCheckBox();
     this.ribbonGroup2       = new C1.Win.Ribbon.RibbonGroup();
     this.cmbTheme           = new C1.Win.Ribbon.RibbonComboBox();
     this.ribbonButton1      = new C1.Win.Ribbon.RibbonButton();
     this.ribbonButton2      = new C1.Win.Ribbon.RibbonButton();
     this.ribbonButton4      = new C1.Win.Ribbon.RibbonButton();
     this.ribbonButton3      = new C1.Win.Ribbon.RibbonButton();
     this.ribbonButton5      = new C1.Win.Ribbon.RibbonButton();
     this.ribbonTopToolBar1  = new C1.Win.Ribbon.RibbonTopToolBar();
     this.splitContainer1    = new System.Windows.Forms.SplitContainer();
     this.c1DataFilter1      = new C1.Win.DataFilter.C1DataFilter();
     this.c1FlexGrid1        = new C1.Win.C1FlexGrid.C1FlexGrid();
     this.c1ThemeController1 = new C1.Win.C1Themes.C1ThemeController();
     ((System.ComponentModel.ISupportInitialize)(this.c1Ribbon1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     this.splitContainer1.Panel1.SuspendLayout();
     this.splitContainer1.Panel2.SuspendLayout();
     this.splitContainer1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.c1DataFilter1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.c1FlexGrid1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.c1ThemeController1)).BeginInit();
     this.SuspendLayout();
     //
     // c1Ribbon1
     //
     this.c1Ribbon1.ApplicationMenuHolder = this.ribbonApplicationMenu1;
     this.c1Ribbon1.AutoSizeElement       = C1.Framework.AutoSizeElement.Width;
     this.c1Ribbon1.BottomToolBarHolder   = this.ribbonBottomToolBar1;
     this.c1Ribbon1.ConfigToolBarHolder   = this.ribbonConfigToolBar1;
     this.c1Ribbon1.HideTabHeaderRow      = true;
     this.c1Ribbon1.Location  = new System.Drawing.Point(0, 0);
     this.c1Ribbon1.Name      = "c1Ribbon1";
     this.c1Ribbon1.QatHolder = this.ribbonQat1;
     this.c1Ribbon1.Size      = new System.Drawing.Size(1149, 77);
     this.c1Ribbon1.Tabs.Add(this.ribbonTab1);
     this.c1ThemeController1.SetTheme(this.c1Ribbon1, "(default)");
     this.c1Ribbon1.TopToolBarHolder = this.ribbonTopToolBar1;
     this.c1Ribbon1.ViewMode         = C1.Win.Ribbon.ViewMode.Simplified;
     //
     // ribbonApplicationMenu1
     //
     this.ribbonApplicationMenu1.Name    = "ribbonApplicationMenu1";
     this.ribbonApplicationMenu1.Visible = false;
     //
     // ribbonBottomToolBar1
     //
     this.ribbonBottomToolBar1.Name = "ribbonBottomToolBar1";
     //
     // ribbonConfigToolBar1
     //
     this.ribbonConfigToolBar1.Name = "ribbonConfigToolBar1";
     //
     // ribbonQat1
     //
     this.ribbonQat1.Name    = "ribbonQat1";
     this.ribbonQat1.Visible = false;
     //
     // ribbonTab1
     //
     this.ribbonTab1.Groups.Add(this.ribbonGroup1);
     this.ribbonTab1.Groups.Add(this.ribbonGroup2);
     this.ribbonTab1.Name = "ribbonTab1";
     this.ribbonTab1.Text = "Tab";
     //
     // ribbonGroup1
     //
     this.ribbonGroup1.Items.Add(this.btnApply);
     this.ribbonGroup1.Items.Add(this.cbAutoApply);
     this.ribbonGroup1.Name = "ribbonGroup1";
     this.ribbonGroup1.Text = "Filter options";
     //
     // btnApply
     //
     this.btnApply.IconSet.Add(new C1.Framework.C1BitmapIcon("RunFilter", new System.Drawing.Size(20, 20), System.Drawing.Color.Transparent, "Preset_MediumImages", 371));
     this.btnApply.Name    = "btnApply";
     this.btnApply.ToolTip = "Apply filter";
     this.btnApply.Click  += new System.EventHandler(this.btnApply_Click);
     //
     // cbAutoApply
     //
     this.cbAutoApply.Checked         = true;
     this.cbAutoApply.Name            = "cbAutoApply";
     this.cbAutoApply.Text            = "Auto apply filter";
     this.cbAutoApply.CheckedChanged += new System.EventHandler(this.CbAutoApply_CheckedChanged);
     //
     // ribbonGroup2
     //
     this.ribbonGroup2.Items.Add(this.cmbTheme);
     this.ribbonGroup2.Name = "ribbonGroup2";
     this.ribbonGroup2.Text = "Theme";
     //
     // cmbTheme
     //
     this.cmbTheme.DropDownStyle = C1.Win.Ribbon.RibbonComboBoxStyle.DropDownList;
     this.cmbTheme.Items.Add(this.ribbonButton1);
     this.cmbTheme.Items.Add(this.ribbonButton2);
     this.cmbTheme.Items.Add(this.ribbonButton4);
     this.cmbTheme.Items.Add(this.ribbonButton3);
     this.cmbTheme.Items.Add(this.ribbonButton5);
     this.cmbTheme.Label                 = "Theme";
     this.cmbTheme.Name                  = "cmbTheme";
     this.cmbTheme.TextAreaWidth         = 140;
     this.cmbTheme.SelectedIndexChanged += new System.EventHandler(this.CmbTheme_SelectedIndexChanged);
     //
     // ribbonButton1
     //
     this.ribbonButton1.Name = "ribbonButton1";
     this.ribbonButton1.Text = "Office2016Black";
     //
     // ribbonButton2
     //
     this.ribbonButton2.Name = "ribbonButton2";
     this.ribbonButton2.Text = "Office2016DarkGray";
     //
     // ribbonButton4
     //
     this.ribbonButton4.Name = "ribbonButton4";
     this.ribbonButton4.Text = "Office2016Green";
     //
     // ribbonButton3
     //
     this.ribbonButton3.Name = "ribbonButton3";
     this.ribbonButton3.Text = "Office2016Colorful";
     //
     // ribbonButton5
     //
     this.ribbonButton5.Name = "ribbonButton5";
     this.ribbonButton5.Text = "Office2016White";
     //
     // ribbonTopToolBar1
     //
     this.ribbonTopToolBar1.Name = "ribbonTopToolBar1";
     //
     // splitContainer1
     //
     this.splitContainer1.BackColor = System.Drawing.Color.White;
     this.splitContainer1.Dock      = System.Windows.Forms.DockStyle.Fill;
     this.splitContainer1.Font      = new System.Drawing.Font("Segoe UI", 9.75F);
     this.splitContainer1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
     this.splitContainer1.Location  = new System.Drawing.Point(0, 77);
     this.splitContainer1.Name      = "splitContainer1";
     //
     // splitContainer1.Panel1
     //
     this.splitContainer1.Panel1.Controls.Add(this.c1DataFilter1);
     //
     // splitContainer1.Panel2
     //
     this.splitContainer1.Panel2.Controls.Add(this.c1FlexGrid1);
     this.splitContainer1.Size             = new System.Drawing.Size(1149, 643);
     this.splitContainer1.SplitterDistance = 371;
     this.splitContainer1.TabIndex         = 1;
     this.c1ThemeController1.SetTheme(this.splitContainer1, "(default)");
     //
     // c1DataFilter1
     //
     this.c1DataFilter1.Dock                      = System.Windows.Forms.DockStyle.Fill;
     checklistFilter3.DisplayedItems              = 15;
     checklistFilter3.DisplayMemberPath           = "Brand";
     checklistFilter3.FilterSummary.AggregateType = C1.DataFilter.AggregateType.Count;
     checklistFilter3.FilterSummary.Label         = "Models:";
     checklistFilter3.FilterSummary.PropertyName  = "Brand";
     checklistFilter3.HeaderText                  = "Brand";
     checklistFilter3.LayoutType                  = C1.DataFilter.LayoutType.List;
     checklistFilter3.MaxHeight                   = 220;
     checklistFilter3.PropertyName                = "Brand";
     checklistFilter3.ValueMemberPath             = "Brand";
     checklistFilter4.DisplayedItems              = 15;
     checklistFilter4.DisplayMemberPath           = "Model";
     checklistFilter4.FilterSummary.AggregateType = C1.DataFilter.AggregateType.Max;
     checklistFilter4.FilterSummary.CustomFormat  = "C0";
     checklistFilter4.FilterSummary.Label         = "Max price:";
     checklistFilter4.FilterSummary.PropertyName  = "Price";
     checklistFilter4.HeaderText                  = "Model";
     checklistFilter4.LayoutType                  = C1.DataFilter.LayoutType.List;
     checklistFilter4.MaxHeight                   = 220;
     checklistFilter4.PropertyName                = "Model";
     checklistFilter4.ValueMemberPath             = "Model";
     this.c1DataFilter1.Filters.Add(checklistFilter3);
     this.c1DataFilter1.Filters.Add(checklistFilter4);
     this.c1DataFilter1.Location = new System.Drawing.Point(0, 0);
     this.c1DataFilter1.Name     = "c1DataFilter1";
     this.c1DataFilter1.ShowClearFilterButtons = true;
     this.c1DataFilter1.Size     = new System.Drawing.Size(371, 643);
     this.c1DataFilter1.TabIndex = 0;
     this.c1DataFilter1.Text     = "c1DataFilter1";
     this.c1ThemeController1.SetTheme(this.c1DataFilter1, "(default)");
     //
     // c1FlexGrid1
     //
     this.c1FlexGrid1.BackColor         = System.Drawing.Color.White;
     this.c1FlexGrid1.BorderStyle       = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.FixedSingle;
     this.c1FlexGrid1.ColumnInfo        = "10,1,0,0,0,-1,Columns:";
     this.c1FlexGrid1.Dock              = System.Windows.Forms.DockStyle.Fill;
     this.c1FlexGrid1.ForeColor         = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
     this.c1FlexGrid1.Location          = new System.Drawing.Point(0, 0);
     this.c1FlexGrid1.Name              = "c1FlexGrid1";
     this.c1FlexGrid1.ShowThemedHeaders = C1.Win.C1FlexGrid.ShowThemedHeadersEnum.None;
     this.c1FlexGrid1.Size              = new System.Drawing.Size(774, 643);
     this.c1FlexGrid1.StyleInfo         = resources.GetString("c1FlexGrid1.StyleInfo");
     this.c1FlexGrid1.TabIndex          = 0;
     this.c1ThemeController1.SetTheme(this.c1FlexGrid1, "(default)");
     this.c1FlexGrid1.Tree.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(153)))), ((int)(((byte)(153)))));
     //
     // c1ThemeController1
     //
     this.c1ThemeController1.Theme = "Office2016Green";
     //
     // MainForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(1149, 720);
     this.Controls.Add(this.splitContainer1);
     this.Controls.Add(this.c1Ribbon1);
     this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name = "MainForm";
     this.Text = "Car list";
     this.c1ThemeController1.SetTheme(this, "(default)");
     this.Load += new System.EventHandler(this.MainForm_Load);
     ((System.ComponentModel.ISupportInitialize)(this.c1Ribbon1)).EndInit();
     this.splitContainer1.Panel1.ResumeLayout(false);
     this.splitContainer1.Panel2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
     this.splitContainer1.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.c1DataFilter1)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.c1FlexGrid1)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.c1ThemeController1)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }