public override void InitializeEditor(IInputEditor editor) { RadDropDownListEditor dropDownListEditor = editor as RadDropDownListEditor; if (dropDownListEditor == null) { return; } RadDropDownListElement editorElement = (RadDropDownListElement)dropDownListEditor.EditorElement; if (this.OwnerTemplate != null) { editorElement.ListElement.BindingContext = this.OwnerTemplate.BindingContext; } editorElement.DataSource = (object)null; editorElement.FilterExpression = string.Empty; editorElement.SyncSelectionWithText = this.SyncSelectionWithText; if (editorElement.Parent is GridFilterCellElement && this.FilteringMode == GridViewFilteringMode.DisplayMember) { string str = this.DisplayMember != null ? this.DisplayMember : this.ValueMember; editorElement.ValueMember = str; editorElement.DisplayMember = str; } else { editorElement.ValueMember = this.ValueMember != null ? this.ValueMember : this.DisplayMember; editorElement.DisplayMember = this.DisplayMember != null ? this.DisplayMember : this.ValueMember; } editorElement.DataSource = this.DataSource; editorElement.SelectedIndex = -1; editorElement.AutoCompleteMode = this.AutoCompleteMode; editorElement.DropDownStyle = this.DropDownStyle; }
private void DropDownListElement_SelectedIndexChanging( object sender, PositionChangingCancelEventArgs e) { if (e.Cancel || e.Position < 0) { return; } RadDropDownListElement editorElement = (RadDropDownListElement)this.EditorElement; if (this.IsInitalizing || !this.EditorElement.IsInValidState(true)) { return; } object newValue = editorElement.Items[e.Position].Value; object oldValue = (object)null; if (editorElement.SelectedItem != null) { oldValue = editorElement.SelectedItem.Value; } ValueChangingEventArgs e1 = new ValueChangingEventArgs(newValue, oldValue); this.OnValueChanging(e1); e.Cancel = e1.Cancel; this.cancelValueChanging = e1.Cancel; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (this.AssociatedRichTextEditor != null) { this.AssociatedRichTextEditor.ScaleFactorChanged += AssociatedRichTextEditor_ScaleFactorChanged; this.printLayout.ToggleStateChanged += this.printLayout_ToggleStateChanged; this.webLayout.ToggleStateChanged += this.webLayout_ToggleStateChanged; this.decreaseZoomButton.Click += this.decreaseZoomButton_Click; this.radTrackBarElement1.ValueChanged += this.radTrackBarElement1_ValueChanged; this.increaseZoomButton.Click += this.increaseZoomButton_Click; } zoomCombo = new RadDropDownListElement(); zoomCombo.DefaultItemsCountInDropDown = 7; zoomCombo.MinSize = new System.Drawing.Size(60, 0); zoomCombo.SelectedIndexChanged += zoomCombo_SelectedIndexChanged; zoomCombo.TextChanged += zoomCombo_TextChanged; radStatusStrip1.Items.Insert(3, zoomCombo); zoomCombo.Items.Add(new RadListDataItem("25%", 25)); zoomCombo.Items.Add(new RadListDataItem("50%", 50)); zoomCombo.Items.Add(new RadListDataItem("75%", 75)); zoomCombo.Items.Add(new RadListDataItem("100%", 100)); zoomCombo.Items.Add(new RadListDataItem("150%", 150)); zoomCombo.Items.Add(new RadListDataItem("200%", 200)); zoomCombo.Items.Add(new RadListDataItem("500%", 500)); zoomCombo.SelectedIndex = 3; }
protected override void CreateChildElements() { 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((RadElement)this.fillPrimitive); this.borderPrimitive = new BorderPrimitive(); this.borderPrimitive.Visibility = ElementVisibility.Collapsed; this.borderPrimitive.Class = "RadMenuComboItemBorderPrimitive"; this.borderPrimitive.Name = "MenuComboItemBorder"; this.Children.Add((RadElement)this.borderPrimitive); this.imagePrimitive = new ImagePrimitive(); int num1 = (int)this.imagePrimitive.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, (object)true); int num2 = (int)this.imagePrimitive.BindProperty(ImagePrimitive.ImageIndexProperty, (RadObject)this, RadButtonItem.ImageIndexProperty, PropertyBindingOptions.TwoWay); int num3 = (int)this.imagePrimitive.BindProperty(ImagePrimitive.ImageProperty, (RadObject)this, RadButtonItem.ImageProperty, PropertyBindingOptions.TwoWay); int num4 = (int)this.imagePrimitive.BindProperty(ImagePrimitive.ImageKeyProperty, (RadObject)this, RadButtonItem.ImageKeyProperty, PropertyBindingOptions.TwoWay); this.imagePrimitive.Class = "RadMenuComboItemImagePrimitive"; this.Children.Add((RadElement)this.imagePrimitive); this.comboBoxElement = new RadDropDownListElement(); this.comboBoxElement.MinSize = new Size(100, 20); this.comboBoxElement.BindingContext = new BindingContext(); this.Children.Add((RadElement)this.comboBoxElement); if (!this.DesignMode) { return; } this.comboBoxElement.ArrowButton.RoutedEventBehaviors.Add((RoutedEventBehavior) new RadMenuComboItem.CancelMouseBehavior()); }
public static void EventPopupOpening(object sender, CancelEventArgs e) { if (!(sender is RadDropDownListElement)) { return; } RadDropDownListElement list = sender as RadDropDownListElement; float width = 0; for (int x = 0; x < list.Items.Count; x++) { width = Math.Max(width, TextRenderer.MeasureText(list.Items[x].Text, list.Font).Width); } if (list.Items.Count * (list.ItemHeight - 1) > list.DropDownHeight) { width += list.ListElement.VScrollBar.Size.Width; } list.Popup.Width = Math.Min((int)width + ConstSizeAddition, ConstMaxWidth); if (list.Popup.Width < ConstMinWidth) { list.Popup.Width = ConstMinWidth; } if (list.Popup.Width < list.TextBox.Size.Width) { list.Popup.Width = list.TextBox.Size.Width + list.ArrowButton.Size.Width; } list.ListElement.ItemHeight = ConstItemHeight; list.Popup.Height = Math.Min(list.Items.Count, ConstVisibleItemCount) * (ConstItemHeight) + ConstSizeAddition; }
protected override void CreateChildElements() { base.CreateChildElements(); this.trackBar = this.CreateTrackBar(); this.dropDownList = this.CreateDropDownList(); this.Children.Add((RadElement)this.trackBar); this.Children.Add((RadElement)this.dropDownList); }
public ServerAutoCompleteSuggestHelper(RadDropDownListElement owner, IEnumerable <T> data, int maxItems = 1000) : base(owner) { this.Data = data.AsQueryable(); this.MaxItems = maxItems; ExpressionBuilder.Instance.Optimize(this.Data); }
public DropDownPopupForm(RadDropDownListElement ownerDropDownListElement) : base((RadItem)ownerDropDownListElement) { this.ownerDropDownListElement = ownerDropDownListElement; this.SizingGripDockLayout.Children.Add((RadElement)this.ownerDropDownListElement.ListElement); this.SizingGrip.ShouldAspectRootElement = false; this.TabStop = false; }
protected override void CreateChildElements() { base.CreateChildElements(); this.dropDownListElement = new RadDropDownListElement(); this.dropDownListElement.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; this.dropDownListElement.AutoSize = true; this.StretchHorizontally = this.StretchVertically = false; this.MinSize = new Size(106, 22); this.Children.Add((RadElement)this.dropDownListElement); }
public GridDropDownAccessibilityObject( RadDropDownListElement owner, CellAccessibleObject cellAccessibleObject, string name) { this.owner = owner; this.WireEvents(); this.cellAccessibleObject = cellAccessibleObject; this.name = name; }
//Refactor this private RadDropDownListElement GetMainDropDownListElement() //get the non suggest drop down list { if (!this.ownerDropDownListElement.isSuggestMode) { return(this.ownerDropDownListElement); } RadDropDownListElement owner = this.ownerDropDownListElement.Parent as RadDropDownListElement; Debug.Assert(owner != null, "Cannot find the non suggest owner"); return(owner); }
protected override void CreateChildElements() { base.CreateChildElements(); operatorElement = new LightVisualElement(); container = new StackLayoutPanel(); dropDown = new RadDropDownListElement(); dropDown.BindingContext = bc; dropDown.DropDownStyle = RadDropDownStyle.DropDownList; dropDown.SelectedIndexChanged += dropDown_SelectedIndexChanged; this.Children.Add(container); container.Children.Add(operatorElement); container.Children.Add(dropDown); }
private void AddCommandQueryTextBox() { _queryCommandList = new RadDropDownListElement(); _queryCommandList.MinSize = new Size(140, 22); _queryCommandList.BackColor = Color.FromArgb(209, 221, 231); _queryCommandList.Text = "查找命令"; _queryCommandList.NullText = "查找命令"; _queryCommandList.AutoCompleteDataSource = null; _queryCommandList.AutoCompleteValueMember = null; _queryCommandList.AutoCompleteDisplayMember = null; _queryCommandList.KeyUp += new KeyEventHandler(QueryCommand_KeyUp); _queryCommandList.TextBox.KeyUp += new KeyEventHandler(TextBox_KeyUp); _queryCommandList.SelectedIndexChanged += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(QueryCommand_SelectedIndexChanged); _radRibbonBar.QuickAccessToolBarItems.Add(_queryCommandList); }
protected override void CreateChildElements() { mainContainer = new StackLayoutElement(); mainContainer.Orientation = Orientation.Vertical; mainContainer.StretchHorizontally = true; mainContainer.StretchVertically = true; headersContainer = new StackLayoutElement(); headersContainer.Orientation = Orientation.Horizontal; nodeContentContainer = new StackLayoutElement(); nodeContentContainer.StretchHorizontally = true; mainContainer.Children.Add(headersContainer); mainContainer.Children.Add(nodeContentContainer); this.Children.Add(mainContainer); dropDownList = new RadDropDownListElement(); }
public AutoCompleteSuggestHelper(RadDropDownListElement owner) : base(owner) { this.filter = ""; this.dropDownList = new RadDropDownListElement(); owner.Children.Add(this.dropDownList); this.dropDownList.isSuggestMode = true; this.dropDownList.Visibility = ElementVisibility.Hidden; this.dropDownList.DropDownSizingMode = SizingMode.RightBottom; this.AutoCompleteDataSource = owner.AutoCompleteDataSource; this.AutoCompleteDisplayMember = owner.AutoCompleteDisplayMember; this.AutoCompleteValueMember = owner.AutoCompleteValueMember; this.dropDownList.ListElement.SelectedIndexChanged += SelectedIndexChanged; this.owner.ListElement.ItemsChanged += CollectionChanged; this.dropDownList.PopupClosed += PopupClosed; }
public AutoCompleteSuggestHelper(RadDropDownListElement owner) : base(owner) { this.filter = ""; this.dropDownList = this.CreateDropDownElement(); owner.Children.Add((RadElement)this.dropDownList); this.dropDownList.isSuggestMode = true; this.dropDownList.Visibility = ElementVisibility.Hidden; this.dropDownList.MaxSize = new Size(0, this.Owner.Size.Height); this.dropDownList.BorderThickness = new Padding(1, 0, 1, 0); this.dropDownList.DropDownSizingMode = SizingMode.RightBottom; this.AutoCompleteDataSource = owner.AutoCompleteDataSource; this.AutoCompleteDisplayMember = owner.AutoCompleteDisplayMember; this.AutoCompleteValueMember = owner.AutoCompleteValueMember; this.dropDownList.ListElement.SelectedIndexChanged += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(this.SelectedIndexChanged); this.Owner.ListElement.ItemsChanged += new NotifyCollectionChangedEventHandler(this.CollectionChanged); this.dropDownList.PopupClosed += new RadPopupClosedEventHandler(this.PopupClosed); }
private void RemoveEditorItems() { if (this.EditingElement == null || this.EditingElement.Editor == null) { return; } BaseDropDownListEditor editor = this.logicalOperatorElement.Editor as BaseDropDownListEditor; if (editor == null) { return; } RadDropDownListElement editorElement = editor.EditorElement as RadDropDownListElement; if (editorElement == null) { return; } editorElement.Visibility = ElementVisibility.Visible; }
private void DropDownListElement_SelectedIndexChanging(object sender, Telerik.WinControls.UI.Data.PositionChangingCancelEventArgs e) { if (e.Position >= 0) { RadDropDownListElement dropDownListElement = (RadDropDownListElement)this.EditorElement; if (!this.IsInitalizing && this.EditorElement.IsInValidState(true)) { object newValue = dropDownListElement.Items[e.Position].Value; object oldValue = null; if (dropDownListElement.SelectedItem != null) { oldValue = dropDownListElement.SelectedItem.Value; } ValueChangingEventArgs args = new ValueChangingEventArgs(newValue, oldValue); this.OnValueChanging(args); e.Cancel = args.Cancel; cancelValueChanging = args.Cancel; } } }
private void radTreeView1_EditorInitialized(object sender, TreeNodeEditorInitializedEventArgs e) { TreeViewDropDownListEditor editor = e.Editor as TreeViewDropDownListEditor; if (editor != null) { RadDropDownListElement listElement = (RadDropDownListElement)editor.EditorElement; listElement.DropDownStyle = RadDropDownStyle.DropDownList; if (listElement.Items.Count == 0) { listElement.Items.Add(new RadListDataItem("White", "White")); listElement.Items.Add(new RadListDataItem("Black", "Black")); listElement.Items.Add(new RadListDataItem("Gray", "Gray")); listElement.Items.Add(new RadListDataItem("Red", "Red")); listElement.Items.Add(new RadListDataItem("Blue", "Blue")); listElement.Items.Add(new RadListDataItem("Green", "Green")); listElement.Items.Add(new RadListDataItem("Yellow", "Yellow")); } listElement.SelectedValue = ((PropertyHelper)e.Node.Value).ToString(); } }
private void PopulateEditorItems() { BaseDropDownListEditor editor = this.logicalOperatorElement.Editor as BaseDropDownListEditor; if (editor == null) { return; } RadDropDownListElement editorElement = editor.EditorElement as RadDropDownListElement; DataFilterGroupNode groupNode = this.GroupNode; if (editorElement == null || groupNode == null) { return; } editorElement.BeginUpdate(); editorElement.Items.Clear(); int num1 = 0; int num2 = -1; foreach (FilterLogicalOperator logicalOperator in Enum.GetValues(typeof(FilterLogicalOperator))) { RadListDataItem radListDataItem = new RadListDataItem(this.GetOperatorText(logicalOperator), (object)logicalOperator); editorElement.Items.Add(radListDataItem); if (object.Equals((object)logicalOperator, (object)groupNode.LogicalOperator)) { num2 = num1; } ++num1; } editorElement.DropDownWidth = 110; editorElement.SelectedIndex = num2; editorElement.EndUpdate(); editorElement.SelectedValue = (object)groupNode.LogicalOperator; editorElement.Visibility = ElementVisibility.Hidden; }
public override bool OnKeyDown(Keys keyData) { KeyEventArgs e = new KeyEventArgs(keyData); if (e.KeyCode != Keys.Up && e.KeyCode != Keys.Prior && e.KeyCode != Keys.Down && e.KeyCode != Keys.Next && !this.ownerDropDownListElement.ContainsFocus) { this.ownerDropDownListElement.OnKeyDown(e); if (e.Handled) { return(false); } } this.lastPressedKey = new Keys?(keyData); switch (keyData) { case Keys.Back: return(false); case Keys.Tab: this.GetMainDropDownListElement().ClosePopup(RadPopupCloseReason.Keyboard); if (this.ownerDropDownListElement.isSuggestMode) { this.ownerDropDownListElement.ClosePopup(RadPopupCloseReason.Keyboard); } return(false); default: RadListElement listElement = this.OwnerDropDownListElement.ListElement; bool flag = this.OwnerDropDownListElement.MaxDropDownItems == 1; if (listElement.ReadOnly) { return(false); } if (keyData == Keys.Home) { listElement.SelectedItem = this.OwnerDropDownListElement.Items.First; } if (keyData == Keys.End) { listElement.SelectedItem = this.OwnerDropDownListElement.Items.Last; } if (keyData == Keys.Up && listElement.Items.Count > 0) { if (listElement.SelectedIndex > 0) { --listElement.SelectedIndex; if (flag) { listElement.Scroller.ScrollToItem(listElement.SelectedItem); } } return(true); } if (keyData == Keys.Down && listElement.Items.Count > 0) { if (listElement.SelectedIndex < listElement.Items.Count - 1) { ++listElement.SelectedIndex; if (flag) { listElement.Scroller.ScrollToItem(listElement.SelectedItem); } } return(true); } if (keyData == Keys.Prior) { listElement.ScrollByPage(-1); } if (keyData == Keys.Next) { listElement.ScrollByPage(1); } if (keyData != Keys.Return) { return(base.OnKeyDown(keyData)); } RadListDataItem selectedOrHoveredItem = this.GetSelectedOrHoveredItem(); if (selectedOrHoveredItem != null) { this.ownerDropDownListElement.SelectedIndex = selectedOrHoveredItem.RowIndex; this.ownerDropDownListElement.ClosePopup(RadPopupCloseReason.Keyboard); } else { RadDropDownListElement dropDownListElement = this.GetMainDropDownListElement(); if (dropDownListElement != null) { string text = dropDownListElement.TextBox.Text; dropDownListElement.SelectItemFromText(text); dropDownListElement.ClosePopup(RadPopupCloseReason.Keyboard); } } if (keyData == Keys.Return && this.ownerDropDownListElement.isSuggestMode) { this.GetMainDropDownListElement()?.ClosePopup(RadPopupCloseReason.Keyboard); } return(base.OnKeyDown(keyData)); } }
public ServerAutoCompleteAppendHelper(RadDropDownListElement owner, IEnumerable <T> data) : base(owner) { this.Data = data.AsQueryable(); ExpressionBuilder.Instance.Optimize(this.Data); }
protected override void OnLoaded() { base.OnLoaded(); if (this.Children.Contains(this.TextBoxItem)) { this.Children.Remove(this.TextBoxItem); } TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement; if (nodeElement.NodeElement.Data != null) { DataRow row = nodeElement.NodeElement.Data.Tag as DataRow; mainContainer.MinSize = new Size(columnWidth * row.Table.Columns.Count, nodeElement.NodeElement.Data.TreeView.ItemHeight); mainContainer.DrawFill = true; mainContainer.GradientStyle = GradientStyles.Solid; mainContainer.BackColor = nodeElement.NodeElement.BackColor; mainContainer.Margin = new Padding(-2, -4, 0, 0); if (headersContainer.Children.Count == 0) { foreach (DataColumn col in row.Table.Columns) { //generate columns LightVisualElement columnHeader = new LightVisualElement(); columnHeader.MinSize = new System.Drawing.Size(columnWidth, 20); columnHeader.StretchHorizontally = true; columnHeader.Text = col.ColumnName; headersContainer.Children.Add(columnHeader); StyleBorder(columnHeader); //generate data cells if (col.ColumnName == "DeliveryType") { this.dropDownList = new RadDropDownListElement(); this.dropDownList.DropDownStyle = RadDropDownStyle.DropDownList; this.dropDownList.MinSize = new System.Drawing.Size(columnWidth, 0); nodeContentContainer.Children.Add(this.dropDownList); this.dropDownList.DataSource = Enum.GetValues(typeof(DeliveryType)); this.dropDownList.SelectedValueChanged += DropDownList_SelectedValueChanged; } else if (col.ColumnName == "Date") { this.dateEditor = new RadDateTimeEditorElement(); this.dateEditor.Format = DateTimePickerFormat.Custom; this.dateEditor.CustomFormat = "dd/MM/yyyy"; this.dateEditor.MinSize = new System.Drawing.Size(columnWidth, 20); nodeContentContainer.Children.Add(this.dateEditor); this.dateEditor.ValueChanged += DateEditor_ValueChanged; } else if (col.ColumnName == "Id") { this.idEditor = new LightVisualElement(); this.idEditor.StretchVertically = true; this.idEditor.MinSize = new System.Drawing.Size(columnWidth, 24); StyleBorder(this.idEditor); nodeContentContainer.Children.Add(this.idEditor); } else if (col.ColumnName == "ParentId") { this.parentIdEditor = new LightVisualElement(); this.parentIdEditor.MinSize = new System.Drawing.Size(columnWidth, 20); this.parentIdEditor.Margin = new System.Windows.Forms.Padding(0, -1, 0, 0); StyleBorder(this.parentIdEditor); nodeContentContainer.Children.Add(this.parentIdEditor); } else if (col.ColumnName == "Title") { this.titleEditor = new RadTextBoxControlElement(); this.titleEditor.Margin = new System.Windows.Forms.Padding(0, -1, 0, 0); StyleBorder(this.titleEditor); this.titleEditor.MinSize = new System.Drawing.Size(columnWidth, 20); nodeContentContainer.Children.Add(this.titleEditor); this.titleEditor.TextChanged += TitleEditor_TextChanged; } } } this.dropDownList.SelectedValueChanged -= DropDownList_SelectedValueChanged; this.dateEditor.ValueChanged -= DateEditor_ValueChanged; this.titleEditor.TextChanged -= TitleEditor_TextChanged; this.idEditor.Text = row["Id"].ToString(); this.parentIdEditor.Text = row["ParentId"].ToString(); this.titleEditor.Text = row["Title"].ToString(); this.dateEditor.Value = (DateTime)row["Date"]; this.dropDownList.SelectedValue = row["DeliveryType"]; this.titleEditor.TextChanged += TitleEditor_TextChanged; this.dateEditor.ValueChanged += DateEditor_ValueChanged; this.dropDownList.SelectedValueChanged += DropDownList_SelectedValueChanged; } }
public RadDropDownListEditableAreaElement(RadDropDownListElement owner) { this.owner = owner; }
public AutoCompleteAppendHelper(RadDropDownListElement owner) : base(owner) { }
public override bool OnKeyDown(Keys keyData) { if (keyData == Keys.Tab) { RadDropDownListElement mainDropDown = this.GetMainDropDownListElement(); Debug.Assert(mainDropDown != null); mainDropDown.ClosePopup(RadPopupCloseReason.Keyboard); if (this.ownerDropDownListElement.isSuggestMode) { this.ownerDropDownListElement.ClosePopup(RadPopupCloseReason.Keyboard); } return(false); } if (keyData == Keys.Back) { return(false); } RadListElement listElement = this.OwnerDropDownListElement.ListElement; if (keyData == Keys.Home) { listElement.SelectedItem = this.OwnerDropDownListElement.Items.First; } if (keyData == Keys.End) { listElement.SelectedItem = this.OwnerDropDownListElement.Items.Last; } if (keyData == Keys.PageUp) { listElement.ScrollByPage(-1); } if (keyData == Keys.PageDown) { listElement.ScrollByPage(1); } if (keyData != Keys.Enter) { return(base.OnKeyDown(keyData)); } RadListDataItem hoveredItem = this.GetSelectedOrHoveredItem(); if (hoveredItem != null) { int indexOfHoveredItem = hoveredItem.RowIndex; this.ownerDropDownListElement.SelectedIndex = indexOfHoveredItem; this.ownerDropDownListElement.ClosePopup(RadPopupCloseReason.Keyboard); } else { RadDropDownListElement owner = this.GetMainDropDownListElement(); string text = owner.TextBox.Text; owner.SelectItemFromText(text); owner.ClosePopup(RadPopupCloseReason.Keyboard); } bool baseResult = base.OnKeyDown(keyData); return(baseResult); }
public override int GetChildCount() { RadDropDownListElement element = this.DropDown.OwnerElement as RadDropDownListElement; return(element.ListElement.Items.Count); }
public BaseAutoComplete(RadDropDownListElement owner) { this.owner = owner; }
public override AccessibleObject GetChild(int index) { RadDropDownListElement element = this.DropDown.OwnerElement as RadDropDownListElement; return(new RadListDataItemAccessibleObject(element.ListElement.Items[index])); }