예제 #1
0
        private void InitFilters()
        {
            // Map filter
            var mf = new MapFilter()
            {
                HeaderText   = "Store",
                PropertyName = "Store.ID"
            };

            mf.SetStores(_dataProvider.GetStores());
            c1DataFilter.Filters.Add(mf);

            //Model filter
            var mdf = new ModelFilter()
            {
                HeaderText   = "Model",
                PropertyName = "Car.Model"
            };

            mdf.SetTagList(_data.GroupBy(x => x.Car).Select(g => g.Key));
            c1DataFilter.Filters.Add(mdf);

            // Price filter
            var pf = new PriceFilter()
            {
                HeaderText    = "Price",
                PropertyName  = "Car.Price",
                ShowSelectAll = false,
                ShowSearchBox = false
            };
            var intervals = new List <PriceInterval>
            {
                new PriceInterval {
                    MaxPrice = 20000
                },
                new PriceInterval {
                    MinPrice = 20000, MaxPrice = 40000
                },
                new PriceInterval {
                    MinPrice = 40000, MaxPrice = 70000
                },
                new PriceInterval {
                    MinPrice = 70000, MaxPrice = 100000
                },
                new PriceInterval {
                    MinPrice = 100000
                }
            };

            pf.SetPriceIntervals(intervals);
            c1DataFilter.Filters.Add(pf);

            // Transmiss filter
            var tf = new TransmissionFilter
            {
                PropertyName = "Car.TransmissAutomatic",
                HeaderText   = "Automatic transmission"
            };

            c1DataFilter.Filters.Add(tf);

            // Color filter
            var cf = new ColorFilter()
            {
                HeaderText   = "Color",
                PropertyName = "Color"
            };

            cf.SetColors(_dataProvider.Colors.Select(x => new SolidColorBrush((Color)ColorConverter.ConvertFromString(x))));
            c1DataFilter.Filters.Add(cf);
        }
        private void InitFilters()
        {
            // Map filter
            var mf = new MapFilter()
            {
                HeaderText   = "Store",
                PropertyName = "Store.ID"
            };

            mf.SetStores(_dataProvider.GetStores());
            c1DataFilter1.Filters.Add(mf);

            // Model filter
            var mdf = new ModelFilter()
            {
                HeaderText   = "Model",
                PropertyName = "Car.Model"
            };

            mdf.SetTagList(_dataProvider.GetCars().ToList());
            c1ThemeController1.SetTheme(mdf.MultiSelect, "(default)");
            c1DataFilter1.Filters.Add(mdf);

            // Price filter
            var pf = new PriceFilter()
            {
                HeaderText    = "Price",
                PropertyName  = "Car.Price",
                LayoutType    = LayoutType.List,
                ShowSelectAll = false,
                ShowSearchBox = false
            };
            var intervals = new List <PriceInterval>
            {
                new PriceInterval {
                    MaxPrice = 20000
                },
                new PriceInterval {
                    MinPrice = 20000, MaxPrice = 40000
                },
                new PriceInterval {
                    MinPrice = 40000, MaxPrice = 70000
                },
                new PriceInterval {
                    MinPrice = 70000, MaxPrice = 100000
                },
                new PriceInterval {
                    MinPrice = 100000
                }
            };

            pf.SetPriceIntervals(intervals);
            c1DataFilter1.Filters.Add(pf);

            // Transmiss filter
            var tf = new ChecklistFilter
            {
                PropertyName  = "Car.TransmissAutomatic",
                HeaderText    = "Automatic transmission",
                ShowSelectAll = true,
                ShowSearchBox = false,
                SelectionMode = SelectionMode.Single,
                LayoutType    = LayoutType.List
            };

            tf.Items.Add(new ChecklistItem()
            {
                DisplayValue = "Yes", Value = "Yes"
            });
            tf.Items.Add(new ChecklistItem()
            {
                DisplayValue = "No", Value = "no"
            });
            c1DataFilter1.Filters.Add(tf);

            // Color filter
            var cf = new ColorFilter
            {
                HeaderText   = "Color",
                PropertyName = "Color"
            };

            cf.SetColors(_dataProvider.Colors.Select(x => Color.FromName(x)));
            c1DataFilter1.Filters.Add(cf);
        }