Example #1
0
        private void AddItem2ComboBox(RadComboBoxElement cbb, CSDataRow dr)
        {
            DataTable dt = dr.EmbeddedCtlPara.ComBoCtlDataSource;

            if (cbb.GetType().Equals(typeof(RadComboBoxElement)))
            {
                cbb.ValueChanged -= ctlComboBoxElement_ValueChanged;
                cbb.SelectedIndex = -1;
                cbb.DataSource    = dt;
                cbb.DisplayMember = dr.EmbeddedCtlPara.DisplayMember;
                cbb.ValueMember   = dr.EmbeddedCtlPara.ValueMember;
                cbb.ValueChanged += new EventHandler(ctlComboBoxElement_ValueChanged);
            }
            else if (cbb.GetType().Equals(typeof(CSCheckComboBoxElement)))
            {
                CSCheckComboBoxElement chkcbb = cbb as CSCheckComboBoxElement;
                chkcbb.Items.Clear();
                foreach (DataRow row in dt.Rows)
                {
                    chkcbb.AddItem(row["LocalName"].ToString());
                }
            }
            else if (cbb.GetType().Equals(typeof(CSComboBoxExxElement)))
            {
                cbb.ValueChanged -= ctlComboBoxExxElement_ValueChanged;
                cbb.SelectedIndex = -1;
                cbb.DataSource    = dt;
                cbb.DisplayMember = dr.EmbeddedCtlPara.DisplayMember;
                cbb.ValueMember   = dr.EmbeddedCtlPara.ValueMember;
                cbb.ValueChanged += ctlComboBoxExxElement_ValueChanged;
            }
        }
Example #2
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();

            ctlChk = new RadCheckBoxElement();
            ctlChk.ToggleStateChanged += new StateChangedEventHandler(ctlChk_ToggleStateChanged);
            this.Children.Add(ctlChk);

            ctlComboBoxElement = new RadComboBoxElement();
            ctlComboBoxElement.DropDownStyle = RadDropDownStyle.DropDownList;
            ctlComboBoxElement.ValueChanged += new EventHandler(ctlComboBoxElement_ValueChanged);
            this.Children.Add(ctlComboBoxElement);

            ctlCheckComboBoxElement              = new CSCheckComboBoxElement();
            ctlCheckComboBoxElement.PopupClosed += new RadPopupClosedEventHandler(ctlCheckComboBoxElement_PopupClosed);
            this.Children.Add(ctlCheckComboBoxElement);

            ctlComboBoxExxElement = new CSComboBoxExxElement();
            ctlComboBoxExxElement.ValueChanged += new EventHandler(ctlComboBoxExxElement_ValueChanged);
            this.Children.Add(ctlComboBoxExxElement);

            ctlTextBox              = new RadTextBoxElement();
            ctlTextBox.TextChanged += new EventHandler(ctlTextBox_TextChanged);
            this.Children.Add(ctlTextBox);

            ctlDataTimePickerElement = new RadDateTimePickerElement();
            ctlDataTimePickerElement.ValueChanged += new EventHandler(ctlDataTimePickerElement_ValueChanged);
            this.Children.Add(ctlDataTimePickerElement);

            ctlColorSelectorElement              = new CSColorSelectorElement();
            ctlColorSelectorElement.TextChanged += new EventHandler(ctlColorSelectorElement_TextChanged);
            this.Children.Add(ctlColorSelectorElement);


            ctlSpin              = new RadSpinElement();
            ctlSpin.MinValue     = 0;
            ctlSpin.MaxValue     = 100000;
            ctlSpin.TextChanged += new EventHandler(ctlSpin_TextChanged);
            this.Children.Add(ctlSpin);


            ctlNumericTextBox              = new CSNumericTextBoxElement();
            ctlNumericTextBox.TextChanged += new EventHandler(ctlNumericTextBox_TextChanged);
            this.Children.Add(ctlNumericTextBox);


            ctlIntTextBox              = new CSIntegerTextBoxElement();
            ctlIntTextBox.TextChanged += new EventHandler(ctlIntTextBox_TextChanged);
            this.Children.Add(ctlIntTextBox);



            foreach (RadElement element in this.Children)
            {
                element.Visibility = ElementVisibility.Collapsed;
            }
        }
Example #3
0
        protected override void CreateChildItems(RadElement parent)
        {
            this.comboBoxElement = new RadComboBoxElement();
            this.comboBoxElement.ArrowButton.Arrow.AutoSize = true;
            this.comboBoxElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            this.comboBoxElement.BindProperty(RadElement.BindingContextProperty, this.RootElement, RadElement.BindingContextProperty, PropertyBindingOptions.OneWay);

            this.RootElement.Children.Add(this.comboBoxElement);

            base.CreateChildItems(parent);
            //p.p. 28.07.09 moved after CreateChildItems()
            this.WireEvents();
        }
        private RadItem CreateFakeItem(RadItem item)
        {
            if (item as RadButtonElement != null)
            {
                RadButtonElement element = new RadButtonElement();
                element.Text       = item.Text;
                element.Font       = item.Font;
                element.Image      = (item as RadButtonElement).Image;
                element.ImageIndex = (item as RadButtonElement).ImageIndex;
                element.ImageKey   = (item as RadButtonElement).ImageKey;

                return(element);
            }

            if (item as RadComboBoxElement != null)
            {
                RadComboBoxElement element = new RadComboBoxElement();
                element.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
                element.Text         = item.Text;
                element.Font         = item.Font;
                return(element);
            }

            if (item as RadTextBoxElement != null)
            {
                RadTextBoxElement element = new RadTextBoxElement();
                element.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
                element.Text         = item.Text;
                element.Font         = item.Font;
                return(element);
            }

            if (item as RadDropDownButtonElement != null)
            {
                RadDropDownButtonElement element = new RadDropDownButtonElement();
                element.Text       = item.Text;
                element.Image      = (item as RadDropDownButtonElement).Image;
                element.ImageIndex = (item as RadDropDownButtonElement).ImageIndex;
                element.ImageKey   = (item as RadDropDownButtonElement).ImageKey;
                return(element);
            }

            return(null);
        }
Example #5
0
        protected override void CreateChildElements()
        {
            // fill
            this.fillPrimitive               = new FillPrimitive();
            this.fillPrimitive.Class         = "RadMenuItemFillPrimitive";
            this.fillPrimitive.Name          = "MenuComboItemFill";
            this.fillPrimitive.BackColor     = Color.Empty;
            this.fillPrimitive.GradientStyle = GradientStyles.Solid;
            this.Children.Add(this.fillPrimitive);

            // border
            this.borderPrimitive            = new BorderPrimitive();
            this.borderPrimitive.Visibility = ElementVisibility.Collapsed;
            this.borderPrimitive.Class      = "RadMenuComboItemBorderPrimitive";
            this.borderPrimitive.Name       = "MenuComboItemBorder";
            this.Children.Add(this.borderPrimitive);

            // image
            this.imagePrimitive = new ImagePrimitive();
            this.imagePrimitive.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, true);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageIndexProperty, this, RadButtonItem.ImageIndexProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageProperty, this, RadButtonItem.ImageProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageKeyProperty, this, RadButtonItem.ImageKeyProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.Class = "RadMenuComboItemImagePrimitive";
            this.Children.Add(this.imagePrimitive);

            // combo box
            this.comboBoxElement = new RadComboBoxElement();
            this.comboBoxElement.ArrowButton.Arrow.AutoSize = true;
            this.comboBoxElement.MinSize = new Size(100, 20);
            this.Children.Add(this.comboBoxElement);

            // Disable the showing of the ComboBox's popup in design-time
            if (this.DesignMode)
            {
                this.comboBoxElement.ArrowButton.RoutedEventBehaviors.Add(new CancelMouseBehavior());
            }
        }
Example #6
0
        /// <summary>
        /// Adauga unltimul sir de caractere cautat, in dropdown-ul de la comboBox
        /// </summary>
        /// <param name="comboBox">ComboBox-ul</param>
        private void AddSearchedBeforeItems(RadComboBoxElement comboBox)
        {
            if (comboBox.Text == null)
                return;

            foreach (RadComboBoxItem item in comboCautaProblema.Items)
                if (item.Text.Equals(comboBox.Text))
                    return;

            comboBox.Items.Add(new RadComboBoxItem(comboBox.Text));
        }
Example #7
0
        public override ControlStyleBuilderInfoList GetThemeDesignedControls(Control previewSurface)
        {
            RadToolStripElement element = new RadToolStripElement();

            element.Size         = new Size(600, element.Size.Height);
            element.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            RadToolStripItem item = new RadToolStripItem();

            item.Size         = new Size(600, item.Size.Height);
            item.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            element.Items.Add(item);
            item.Items.Add(new RadButtonElement("one"));
            item.Items.Add(new RadDropDownButtonElement());
            item.Items.Add(new RadToolStripSeparatorItem());
            item.Items.Add(new RadToggleButtonElement());
            item.Items.Add(new RadRepeatButtonElement());
            item.Items.Add(new RadImageButtonElement());
            item.Items.Add(new RadRadioButtonElement());
            item.Items.Add(new RadCheckBoxElement());
            item.Items.Add(new RadTextBoxElement());
            item.Items.Add(new RadMaskedEditBoxElement());
            item.Items.Add(new RadSplitButtonElement());
            item.Items.Add(new RadApplicationMenuButtonElement());

            RadComboBoxElement combo = new RadComboBoxElement();

            combo.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            item.Items.Add(combo);

            RadTextBoxElement textBoxElement = new RadTextBoxElement();

            textBoxElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            item.Items.Add(textBoxElement);

            RadToolStrip toolStrip = new RadToolStrip();

            toolStrip.BeginInit();
            toolStrip.AutoSize = false;

            toolStrip.Bounds = new Rectangle(30, 30, 400, 50);
            toolStrip.Items.Add(element);
            toolStrip.AllowFloating = false;
            toolStrip.AllowDragging = false;
            toolStrip.EndInit();

            RadToolStrip toolStripStructure = new RadToolStrip();

            toolStripStructure.BeginInit();
            toolStripStructure.AllowDragging = false;
            toolStripStructure.AllowFloating = false;
            toolStripStructure.AutoSize      = false;

            RadToolStripElement structureElement = new RadToolStripElement();

            structureElement.Size         = new Size(600, structureElement.Size.Height);
            structureElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            RadToolStripItem structureItem = new RadToolStripItem();

            structureItem.Size         = new Size(600, structureItem.Size.Height);
            structureItem.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;

            structureElement.Items.Add(structureItem);
            structureItem.Items.Add(new RadButtonElement("one"));
            structureItem.Items.Add(new RadDropDownButtonElement());
            structureItem.Items.Add(new RadToolStripSeparatorItem());
            structureItem.Items.Add(new RadToggleButtonElement());
            structureItem.Items.Add(new RadRepeatButtonElement());
            structureItem.Items.Add(new RadImageButtonElement());
            structureItem.Items.Add(new RadRadioButtonElement());
            structureItem.Items.Add(new RadCheckBoxElement());
            structureItem.Items.Add(new RadTextBoxElement());
            structureItem.Items.Add(new RadMaskedEditBoxElement());
            structureItem.Items.Add(new RadSplitButtonElement());
            structureItem.Items.Add(new RadApplicationMenuButtonElement());
            combo = new RadComboBoxElement();
            combo.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            structureItem.Items.Add(combo);

            textBoxElement = new RadTextBoxElement();
            textBoxElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            structureItem.Items.Add(textBoxElement);

            toolStripStructure.Bounds = new Rectangle(30, 30, 450, 50);

            toolStripStructure.Items.Add(structureElement);

            toolStripStructure.EndInit();

            ControlStyleBuilderInfo designed = new ControlStyleBuilderInfo(toolStrip, toolStripStructure.RootElement);

            designed.MainElementClassName = typeof(RadToolStripElement).FullName;
            ControlStyleBuilderInfoList res = new ControlStyleBuilderInfoList();

            res.Add(designed);

            return(res);
        }
		protected override void SetVisibleCore(bool value)
		{
			base.SetVisibleCore(value);

            if (value)
			{
				if (Opened != null)
				{
					Opened(this, EventArgs.Empty);
				}
				closing = false;

				activeHwnd = NativeMethods.GetActiveWindow();
				if (activeHwnd == IntPtr.Zero)
				{
					return;
				}
                RadComboBoxElement ownerComboElement = this.OwnerElement as RadComboBoxElement;
                if (ownerComboElement != null)
                   ownerComboElement.IsDropDownShown = true;
               
                this.Capture = true;

				NativeMethods.SetWindowPos(
					new HandleRef(this, this.Handle),
					NativeMethods.HWND_TOPMOST, 0, 0, 0, 0,
					NativeMethods.SWP_DEFERERASE |
					NativeMethods.SWP_NOACTIVATE |
					NativeMethods.SWP_NOMOVE |
					NativeMethods.SWP_NOSIZE);

				Application.AddMessageFilter(this);

				if (this.EditorToFocus != null && (!this.EditorToFocus.Focused || !this.EditorToFocus.ContainsFocus))
				{
					this.EditorToFocus.Focus();
				}

				if (this.OwnerControl != null && !string.IsNullOrEmpty(this.OwnerControl.ThemeName))
				{
                    ThemeName = this.OwnerControl.ThemeName;
				}
				else
				{
					ThemeName = "ControlDefault";
				}
			}
			else
			{
				closing = true;
				this.Capture = false;
				Application.RemoveMessageFilter(this);
				if (activeHwnd != IntPtr.Zero)
					NativeMethods.SetActiveWindow(new HandleRef(this, activeHwnd));
				if (Closed != null)
				{
					RadPopupClosedEventArgs args = new RadPopupClosedEventArgs(this.closeReason);
					Closed(this, args);
				}
			}
		}