示例#1
0
        public static void FillWithEnum <T>(this ComboBoxAdv cb, T defaultValue)
        {
            var enumType = typeof(T);

            cb.DataSource    = Enum.GetValues(enumType);
            cb.SelectedIndex = cb.Items.IndexOf(defaultValue);
        }
示例#2
0
 public static void SetSelectedIndexSafe(this ComboBoxAdv comboBox, int selectedIndex)
 {
     if (selectedIndex >= 0 && selectedIndex < comboBox.Items.Count)
     {
         comboBox.SelectedIndex = selectedIndex;
     }
 }
示例#3
0
        public void PropertyChangedHandler(object param)
        {
            ComboBoxAdv combo = param as ComboBoxAdv;

            if (combo == null || combo.SelectedItem == null)
            {
                return;
            }

            var item = combo.SelectedItem as ComboBoxItemAdv;

            if (item.Content.ToString() == "Linear shape")
            {
                customPath      = new Path();
                customPath.Data = Geometry.Parse("M0,300 L600,300");
                CustomPath      = customPath;
            }
            else if (item.Content.ToString() == "Diagonal shape")
            {
                customPath      = new Path();
                customPath.Data = Geometry.Parse("M600,0 L0,300");
                CustomPath      = customPath;
            }
            else if (item.Content.ToString() == "S shape")
            {
                customPath      = new Path();
                customPath.Data = Geometry.Parse("F1 M 799.443,650.245C 802.926,650.294 806.306,650.444 809.567,650.686C 812.83,650.929 815.974,651.264 818.986,651.685C 822,652.105 824.882,652.611 827.614,653.194C 830.349,653.777 832.935,654.438 835.353,655.168C 837.754,655.906 839.939,656.698 841.882,657.542C 843.83,658.389 845.534,659.286 846.963,660.228C 848.396,661.174 849.554,662.167 850.404,663.199C 851.257,664.236 851.801,665.314 852.004,666.428C 852.192,667.545 852.024,668.627 851.524,669.665C 851.022,670.708 850.189,671.708 849.05,672.66C 847.905,673.614 846.455,674.519 844.723,675.37C 842.985,676.222 840.966,677.018 838.694,677.752C 836.388,678.482 833.874,679.134 831.166,679.7C 828.453,680.267 825.547,680.747 822.469,681.13C 819.386,681.513 816.132,681.799 812.724,681.976C 809.314,682.155 805.754,682.226 802.064,682.179C 785.787,681.965 769.873,682.288 754.454,683.099C 738.976,683.915 723.944,685.225 709.505,686.988C 694.964,688.763 680.979,691.002 667.713,693.665C 654.313,696.353 641.611,699.481 629.785,703.007C 617.784,706.571 606.599,710.568 596.418,714.955C 586.08,719.409 576.754,724.275 568.649,729.505C 560.401,734.829 553.401,740.543 547.882,746.597C 542.254,752.772 538.158,759.31 535.852,766.16C 533.476,773.156 533.071,780.173 534.529,787.123C 536.017,794.219 539.447,801.238 544.697,808.083C 550.051,815.064 557.29,821.851 566.273,828.34C 575.418,834.944 586.349,841.222 598.898,847.058C 611.601,852.995 625.989,858.483 641.848,863.407C 657.907,868.393 675.42,872.785 694.134,876.462C 713.016,880.17 733.044,883.138 753.931,885.247C 774.914,887.366 796.668,888.608 818.872,888.867L 819.022,888.868C 859.785,888.868 877.785,887.853 877.785,887.853");
                CustomPath      = customPath;
            }
        }
        public static void AddRasterBands(this ComboBoxAdv combo, IRasterSource raster, bool withNone = false)
        {
            if (combo == null)
            {
                return;
            }

            combo.Items.Clear();

            if (withNone)
            {
                combo.Items.Add("<none>");
            }

            int bandCount = raster.Bands.Count;

            for (int i = 1; i <= bandCount; i++)
            {
                string bandName = raster.GetBandFullName(i);
                combo.Items.Add(bandName);
            }

            int index = raster.ActiveBandIndex;

            combo.SelectedIndex = index > 0 && index <= bandCount ? index - 1 : 0;
        }
        public void PropertyChangedHandler(object param)
        {
            ComboBoxAdv combo = param as ComboBoxAdv;

            if (combo == null || combo.SelectedItem == null)
            {
                return;
            }

            var item = combo.SelectedItem as ComboBoxItemAdv;

            if (item.Content.ToString() == "Horizontal")
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                VerticalScrollBarVisibility   = ScrollBarVisibility.Hidden;
            }
            else if (item.Content.ToString() == "Vertical")
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
                VerticalScrollBarVisibility   = ScrollBarVisibility.Visible;
            }
            else if (item.Content.ToString() == "Hidden")
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
                VerticalScrollBarVisibility   = ScrollBarVisibility.Hidden;
            }
        }
示例#6
0
        private void ComboBoxAdv_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItemAdv  item;
            WindowCollection windows = Application.Current.Windows;

            if (windows.Count > 0)
            {
                Window      samplewindow = windows[0];
                ComboBoxAdv combo        = sender as ComboBoxAdv;
                if (combo != null)
                {
                    if (combo.SelectedItem != null)
                    {
                        item = combo.SelectedItem as ComboBoxItemAdv;
                        if (this.viewer != null)
                        {
#if !SyncfusionFramework3_5
                            Syncfusion.SfSkinManager.SfSkinManager.SetVisualStyle(this.viewer, (VisualStyles)Enum.Parse(typeof(VisualStyles), item.Content.ToString()));
#endif
                            Syncfusion.Samples.ViewModel.ReportViewModel viewModel = new ReportViewModel();
                            viewModel.Loaded(samplewindow as object, e);
                        }
                    }
                }
            }
        }
示例#7
0
        /// <summary>
        /// used to change the dashstyle of the pivotchart.
        /// </summary>
        void combo_SelectedValueChanged1(object sender, EventArgs e)
        {
            ComboBoxAdv combo = sender as ComboBoxAdv;

            Syncfusion.Windows.Forms.PivotChart.PivotChartAxisStyles.PivotChartAxis axis;
            axis = (combo == this.comboBox2) ? this.pivotChart1.PrimaryXAxis : this.pivotChart1.PrimaryYAxis;

            if (combo.SelectedItem.ToString() == DashStyle.Dash.ToString())
            {
                axis.GridLineType.DashStyle = DashStyle.Dash;
            }
            else if (combo.SelectedItem.ToString() == DashStyle.DashDot.ToString())
            {
                axis.GridLineType.DashStyle = DashStyle.DashDot;
            }
            else if (combo.SelectedItem.ToString() == DashStyle.DashDotDot.ToString())
            {
                axis.GridLineType.DashStyle = DashStyle.DashDotDot;
            }
            else if (combo.SelectedItem.ToString() == DashStyle.Dot.ToString())
            {
                axis.GridLineType.DashStyle = DashStyle.Dot;
            }
            else if (combo.SelectedItem.ToString() == DashStyle.Solid.ToString())
            {
                axis.GridLineType.DashStyle = DashStyle.Solid;
            }
        }
示例#8
0
        private void cmb18_SelectedValueChanged(object sender, EventArgs e)
        {
            SfDateTimeEdit Dt18 = new SfDateTimeEdit();

            this.Controls.Add(Dt18);

            string task = cmb18.Text;

            int y = cmb18.Location.Y - 6;
            int x = cmb18.Location.X + 192;

            Dt18.Location = new Point(x, y);
            Dt18.Size     = new Size(101, 32);

            foreach (Control C in this.Controls)
            {
                if (C.GetType() == typeof(ComboBoxAdv))
                {
                    ComboBoxAdv cc = C as ComboBoxAdv;
                    cc.Items.Remove(cmb18.Text);
                }
            }

            cmb18.Text = task;
            queryBuilder(task, Dt18);
        }
示例#9
0
        private void dataSource_ComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxAdv comboBox = sender as ComboBoxAdv;

            if (comboBox.SelectedIndex != selectedIndex)
            {
                selectedIndex = comboBox.SelectedIndex;
                switch (comboBox.Text)
                {
                case "Data Table":
                    SetTable();
                    break;

                case "IBinding List":
                    SetIBindingSource();
                    break;

                case "Array List":
                    SetArrayListData();
                    break;

                case "Collection Base":
                    SetCollectionBaseSource();
                    break;

                case "Generic Collection":
                    SetGenericCollectionSource();
                    break;

                case "Observable Collection":
                    SetObservableCollection();
                    break;
                }
            }
        }
示例#10
0
        private void ComboBoxAdv_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItemAdv  item;
            WindowCollection windows = Application.Current.Windows;

            if (windows.Count > 0)
            {
                ComboBoxAdv combo = sender as ComboBoxAdv;
                if (combo != null)
                {
                    if (combo.SelectedItem != null)
                    {
                        item = combo.SelectedItem as ComboBoxItemAdv;
                        VisualStyles selectedStyle = (VisualStyles)Enum.Parse(typeof(VisualStyles), item.Content.ToString());
                        SfSkinManager.SetVisualStyle(this.SmithChart, selectedStyle);
                        SfSkinManager.SetVisualStyle(this.combo, selectedStyle);
                        SfSkinManager.SetVisualStyle(this.VisualStyleTextblock, selectedStyle);

                        if (selectedStyle == VisualStyles.MaterialDark)
                        {
                            this.grid.Background = Brushes.Black;
                        }
                        else
                        {
                            this.grid.Background = Brushes.White;
                        }
                    }
                }
            }
        }
示例#11
0
        private void comboBoxAdv1_Click(object sender, EventArgs e)
        {
            ComboBoxAdv combo = sender as ComboBoxAdv;

            if (combo.SelectedIndex == 0)
            {
                this.rangeSlider1.TickPlacement = TickPlacement.BottomRight;
                this.rangeSlider2.TickPlacement = TickPlacement.BottomRight;
            }
            else if (combo.SelectedIndex == 1)
            {
                this.rangeSlider1.TickPlacement = TickPlacement.TopLeft;
                this.rangeSlider2.TickPlacement = TickPlacement.TopLeft;
            }
            else if (combo.SelectedIndex == 2)
            {
                this.rangeSlider1.TickPlacement = TickPlacement.Inline;
                this.rangeSlider2.TickPlacement = TickPlacement.Inline;
            }
            else if (combo.SelectedIndex == 3)
            {
                this.rangeSlider1.TickPlacement = TickPlacement.Both;
                this.rangeSlider2.TickPlacement = TickPlacement.Both;
            }
        }
示例#12
0
        private void autoComplete_Combo_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxAdv comboBox = sender as ComboBoxAdv;

            autoCompleteMode = comboBox.SelectedItem.ToString();

            setAutoCompleteMode(this.autoComplete1);
        }
        public override void OnInitializeEditElement(DataColumnBase dataColumn, ComboBoxAdv uiElement, object dataContext)
        {
            //To sort the items while the DropDown for filter cell is initialized.
            base.OnInitializeEditElement(dataColumn, uiElement, dataContext);
            SortDescription sd = new SortDescription("DisplayText", ListSortDirection.Ascending);

            uiElement.Items.SortDescriptions.Add(sd);
        }
示例#14
0
        private void InitZoomCombo(ComboBoxAdv combo)
        {
            combo.Items.Clear();

            for (int i = 0; i <= 25; i++)
            {
                combo.Items.Add(i);
            }
        }
示例#15
0
        private RasterBand GetBand(ComboBoxAdv combo)
        {
            if (combo.SelectedIndex == 0)
            {
                return(null);
            }

            return(_raster.Bands[combo.SelectedIndex]);
        }
示例#16
0
 /// <summary>
 /// Load the combobox items.
 /// </summary>
 private void LoadDashStylesComboBoxes(ComboBoxAdv combo)
 {
     combo.Items.Add(DashStyle.Dash);
     combo.Items.Add(DashStyle.DashDot);
     combo.Items.Add(DashStyle.DashDotDot);
     combo.Items.Add(DashStyle.Dot);
     combo.Items.Add(DashStyle.Solid);
     combo.SelectedValueChanged += new EventHandler(combo_SelectedValueChanged1);
 }
示例#17
0
        public static void AddItemsFromEnum <T>(this ComboBoxAdv box) where T : struct, IConvertible
        {
            var t     = new T();
            var items = GetComboItems(Enum.GetValues(t.GetType()).OfType <T>());

            foreach (var item in items)
            {
                box.Items.Add(item);
            }
        }
示例#18
0
 /// <summary>
 /// used to load the combo box color items.
 /// </summary>
 /// <param name="combo"></param>
 private void LoadColorComboBoxes(ComboBoxAdv combo)
 {
     foreach (System.Reflection.PropertyInfo prop in typeof(Color).GetProperties())
     {
         if (prop.PropertyType.FullName == "System.Drawing.Color")
         {
             combo.Items.Add(prop.Name);
         }
     }
     combo.SelectedValueChanged += new EventHandler(combo_SelectedValueChanged);
 }
示例#19
0
        private int GetZoom(ComboBoxAdv combo)
        {
            int zoom;

            if (Int32.TryParse(combo.Text, out zoom))
            {
                return(zoom);
            }

            return(-1);
        }
示例#20
0
 public object Create(PropertyInfo propertyInfo)
 {
     cmb = new ComboBoxAdv();
     cmb.Items.Add("Curren");
     cmb.Items.Add("Currency");
     cmb.Items.Add("Scientific Notation");
     cmb.Items.Add("General Number");
     cmb.Items.Add("Number");
     cmb.Items.Add("Percent");
     cmb.Items.Add("Time");
     cmb.Items.Add("Date");
     return(cmb);
 }
示例#21
0
        protected override void OnAttached()
        {
            var window = this.AssociatedObject;

            this.SfDataGrid       = window.FindName("datagrid") as SfDataGrid;
            this.CopyCombobox     = window.FindName("CopyOptionComboBox") as ComboBoxAdv;
            this.PasteCombobox    = window.FindName("PasteOptionComboBox") as ComboBoxAdv;
            this.Clipboardtextbox = window.FindName("Clipboardcontent") as TextBox;

            this.SfDataGrid.GridCopyContent     += SfDataGrid_GridCopyContent;
            this.CopyCombobox.SelectionChanged  += CopyCombobox_SelectionChanged;
            this.PasteCombobox.SelectionChanged += PasteCombobox_SelectionChanged;
        }
示例#22
0
        public static bool SetValue(this ComboBoxAdv box, string value)
        {
            foreach (var item in box.Items)
            {
                if (item.ToString().EqualsIgnoreCase(value))
                {
                    box.SelectedItem = item;
                    return(true);
                }
            }

            return(false);
        }
 private void AttachListeners(ComboBoxAdv combo)
 {
     combo.SelectedIndexChanged += (s, e) =>
     {
         UpdatePicture();
         FireValueChanged();
     };
     combo.TextChanged += (s, e) =>
     {
         UpdatePicture();
         FireValueChanged();
     };
 }
示例#24
0
        public static void AddItemsFromEnum <T>(this ComboBoxAdv box, IEnumerable <T> items) where T : struct, IConvertible
        {
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }

            var comboItems = GetComboItems(items);

            foreach (var item in comboItems)
            {
                box.Items.Add(item);
            }
        }
示例#25
0
        private void ComboBoxAdv_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItemAdv item;
            MainWindow      samplewindow = VisualUtils.FindAncestor((Visual)this, typeof(MainWindow)) as MainWindow;
            ComboBoxAdv     combo        = sender as ComboBoxAdv;

            if (combo != null && samplewindow != null)
            {
                if (combo.SelectedItem != null)
                {
                    item = combo.SelectedItem as ComboBoxItemAdv;
                    SkinStorage.SetVisualStyle(samplewindow, item.Content.ToString());
                }
            }
        }
示例#26
0
        private void Combo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItemAdv item;
            ComboBoxAdv     combo = sender as ComboBoxAdv;

            if (combo != null)
            {
                if (combo.SelectedItem != null)
                {
                    item = combo.SelectedItem as ComboBoxItemAdv;
                    //SkinStorage.SetVisualStyle(dockingManager, item.Content.ToString());
                    //SfSkinManager.SetVisualStyle(this, VisualStyles.SystemTheme);
                }
            }
        }
示例#27
0
        public static T GetValue <T>(this ComboBoxAdv box) where T : struct, IConvertible
        {
            if (box.SelectedItem == null)
            {
                return(default(T));
            }

            var item = box.SelectedItem as ComboBoxEnumItem <T>;

            if (item == null)
            {
                throw new InvalidCastException("ComboBoxEnumItem was expected");
            }
            return(item.GetValue());
        }
示例#28
0
        private void ComboBoxAdv_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItemAdv  item;
            WindowCollection windows      = Application.Current.Windows;
            Window           samplewindow = windows[0];
            ComboBoxAdv      combo        = sender as ComboBoxAdv;

            if (combo != null)
            {
                if (combo.SelectedItem != null)
                {
                    item = combo.SelectedItem as ComboBoxItemAdv;
                    SkinStorage.SetVisualStyle(samplewindow, item.Content.ToString());
                }
            }
        }
示例#29
0
 public static void SetValue <T>(this ComboBoxAdv box, T value) where T : struct, IConvertible
 {
     foreach (var item in box.Items)
     {
         var enumItem = item as ComboBoxEnumItem <T>;
         if (enumItem == null)
         {
             throw new InvalidCastException("ComboBoxEnumItem was expected");
         }
         if (enumItem.GetValue().Equals(value))
         {
             box.SelectedItem = item;
             break;
         }
     }
 }
示例#30
0
        public void PropertyChangedHandler(object param)
        {
            WindowCollection windows = Application.Current.Windows;

            if (windows.Count > 0)
            {
                Window      samplewindow = windows[0];
                ComboBoxAdv combo        = param as ComboBoxAdv;
                if (combo != null)
                {
                    if (combo.SelectedValue != null)
                    {
                        SfSkinManager.SetVisualStyle(samplewindow, (VisualStyles)Enum.Parse(typeof(VisualStyles), combo.SelectedValue.ToString()));
                    }
                }
            }
        }