Telerik Forums
UI for WinForms Forum
5 answers
509 views

Hello,

I have a grid view with a cell containing either a TextBox which is ReanOnly or a ComboBox for which the user has to select a value.

The arrow button of ComboBox cell is only visible when user clicks on cell to edit it. Thus, the user does not know if he has to select or not a value

I'd like that the arrow button of ComboBox cell is always visible to indicate to user that a value has to be selected.

I've tried to set the visibility of arrow button in EditorRequired event but it has no effect.

        void QualityControlsEntryGridView_EditorRequired(object sender, EditorRequiredEventArgs e)
        {
            if (QualityControlsEntryGridView.Columns["Result"].IsCurrent)
            {
                if (QualityControlsEntryGridView.CurrentRow.Cells["ReferenceValueToType"].Value.ToString() != "")
                {
                    e.Editor = new RadTextBoxEditor();
                    e.EditorType = typeof(RadTextBoxEditor);
                }
                else
                {
                    e.Editor = new RadDropDownListEditor();
                    e.EditorType = typeof(RadDropDownListEditor);
                    RadDropDownListEditorElement editorElement = (RadDropDownListEditorElement)((RadDropDownListEditor)e.Editor).EditorElement;
                    editorElement.ArrowButton.Visibility = ElementVisibility.Visible;
                }
            }
        }

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 05 Oct 2017
17 answers
737 views
I have a Grid that is editable by the user and I've got almost everything working. The problem I've run into is that I have this grid on a form that the user can click a button on and close the form. If the user clicks on a textbox column and edits the value, then clicks directly on the "Ok" button to close the form, the data is not validated via the RowValidating event.

Both the CellFormatting event is called, but apparently the RowValidating event isn't and neither is the CellEndEdit event. However, the DataTable that the grid is bound to is updated properly. For the time being, what I'm doing is rebinding the DataTable to the grid. This works in some cases, but I end up doing my validation after the data has been saved into the DataTable, and by that point it's too late and messes up my data.

Is there a way for me to manually fire the Validation code? I don't see an easy way to force it to be called in a way that is going to intercept something like this because it seems to bypass all of my validation code.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 05 Oct 2017
3 answers
169 views

Hi all,

some time ago starting from some code I found here, I wrote a method to add a button in a dropdownlist (I have used a label with an image instead of a button), it seems to work fine but if I use it with a dropdownlist that is contained in a RadWizard or RadTreeView page, the button is shown only if that page is the selected page when the form is loaded, but is not shown when I click on a Tab move to the page that contains the dropdownlist.

I usually add call the method in the Load event of the form, but I've tried tu use other events with effects.

 

This is the method :

 

        public static void ButtonizeDropDown(RadDropDownList ddlistControl, EventHandler OnClick, out RadLabelElement btnElement) {
            btnElement = null;
            EventHandler onLabelElementClicked = (object s, EventArgs ea) => { ddlistControl.SelectedIndex = -1; };
            if (OnClick != null) onLabelElementClicked = (object s, EventArgs ea) => { OnClick(ddlistControl,ea); };
            ddlistControl.BeginInit();
            RadLabelElement lbl = new RadLabelElement();
            btnElement = lbl;
            lbl.Click += onLabelElementClicked;
            lbl.Margin = new Padding(0, 0, 0, 0);
            lbl.AutoSize = false;
            lbl.Text = "";
            lbl.Tag = ddlistControl;
            lbl.Image = new Bitmap(global::K2O.UI.Properties.Resources.Delete_Thin_BW_UltraLight_12);
            lbl.ImageAlignment = ContentAlignment.MiddleCenter;
            lbl.TextAlignment = ContentAlignment.MiddleCenter;
            lbl.TextImageRelation = TextImageRelation.Overlay;
            lbl.Alignment = ContentAlignment.MiddleCenter;
            ddlistControl.DropDownListElement.EditableElement.ShouldPaint = false;
            RadDropDownTextBoxElement textBoxElement = ddlistControl.DropDownListElement.EditableElement.TextBox;
            RadTextBoxItem textboxitem = textBoxElement.TextBoxItem;
            ddlistControl.DropDownListElement.EditableElement.TextBox.Children.Remove(textboxitem);
           
            lbl.Size = new System.Drawing.Size(textBoxElement.Size.Height, textBoxElement.Size.Height);
            StackLayoutElement stackPanel = new StackLayoutElement();
            stackPanel.Orientation = Orientation.Horizontal;
            stackPanel.Margin = new Padding(0, 0, 0, 0);
            stackPanel.Size = lbl.Size;
            stackPanel.Children.Add(lbl);
            DockLayoutPanel dockPanel = new DockLayoutPanel();
            dockPanel.Size = lbl.Size;
            dockPanel.Children.Add(stackPanel);
            dockPanel.Children.Add(textboxitem);
            DockLayoutPanel.SetDock(textboxitem, Dock.Right);
            DockLayoutPanel.SetDock(stackPanel, Dock.Left);
            ddlistControl.DropDownListElement.EditableElement.TextBox.Children.Add(dockPanel);
            if (ddlistControl.DropDownStyle == RadDropDownStyle.DropDownList) {
                textboxitem.ReadOnly = true;
                ddlistControl.DropDownListElement.EditableElement.TextBox.Visibility = ElementVisibility.Visible;
                ddlistControl.DropDownListElement.EditableElement.TextBox.Enabled = true;
                lbl.Enabled = true;
                lbl.Visibility = ElementVisibility.Visible;
            }
            //Per fare in modo che tutti gli elementi del controllo acquistino lo stesso stato (Enabled/Disabled) del controllo stesso;
            ddlistControl.Enabled = !ddlistControl.Enabled;
            ddlistControl.Invalidate();
            ddlistControl.Enabled = !ddlistControl.Enabled;
            ddlistControl.EndInit();
        }

 

can you please tell me what I must change to have it work in every page of a RadPageView or RadWizard ?

 

Thanks

 

 

Dimitar
Telerik team
 answered on 05 Oct 2017
0 answers
135 views

I have 4 tabs in a PageView Strip mode where 2nd tabs visibility is false that's why empty space found in continuity of 4 tabs.

how can i set property to auto arrange tabs on page load in c# windows form.

Muhammad Naveed
Top achievements
Rank 1
 asked on 04 Oct 2017
1 answer
149 views

Hi,

Can i add shapes from RadDiagramToolbox to RadDiagram by double clicking on the items instead of drag and drop?

 

Thanks.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 04 Oct 2017
2 answers
1.5K+ views

I have a datetimepicker field where I want to change the background colour of special days.

I have set up event handlers for the clicking of the arrows but what event is fired when the user changes the month drop down on the picker.

My code as it stands is

       public form1()
        {
            InitializeComponent();

            RadDateTimePickerCalendar calendarBehavior = this.dtDOI.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar;
            calendar = calendarBehavior.Calendar as RadCalendar;
            RadCalendarElement calendarElement = calendar.CalendarElement as RadCalendarElement;
            MonthViewElement monthView = calendarBehavior.Calendar.CalendarElement.CalendarVisualElement as MonthViewElement;
            calendarElement.NextButton.Click += new EventHandler(calendar_SelectionChanged);   
            calendarElement.PreviousButton.Click += new EventHandler(calendar_SelectionChanged);
            calendarElement.FastBackwardButton.Click += new EventHandler(calendar_SelectionChanged);
            calendarElement.FastForwardButton.Click += new EventHandler(calendar_SelectionChanged);
         }

        void calendar_SelectionChanged(object sender, EventArgs e)
        {
            FormatCalendar();
        }

        private void FormatCalendar()
        {
            RadDateTimePickerCalendar calendarBehavior = this.dtDOI.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar;
            RadCalendar calendar = calendarBehavior.Calendar as RadCalendar;
            MonthViewElement monthView = calendarBehavior.Calendar.CalendarElement.CalendarVisualElement as MonthViewElement;
            RadCalendarDay[] specialDays = calendar.SpecialDays.ToArray();
            List<DateTime> dates = ExtractSpecialdates(specialDays);

            foreach (CalendarCellElement cell in monthView.TableElement.Children)
            {
                if (dates.Contains(cell.Date))
                {
                    cell.BackColor = Color.Green;
                }
                else
                {
                    cell.BackColor = Color.White;
                }
            }

        }

If I use   calendar.ElementRender += new RenderElementEventHandler(calender_SelectionChanged); I get stuck in a perpetual loop. 

Or is there a better way of doing things?

Mike
Top achievements
Rank 1
 answered on 03 Oct 2017
3 answers
376 views

Hi, according to docs, High DPI for RadControls should run smoothly when the controls are placed on a RadForm.

Whats the strategy if the application uses standard Dialogs (not based on RadForm)?

Per Monitor DPI awareness assuming running on newest Win10 Update and .net 4.7?

Regards

Erwin

Hristo
Telerik team
 answered on 03 Oct 2017
4 answers
135 views
Is there a way to disable the add to dictionary button from the dialog created in the WinControls RadSpellChecker?
MS
Top achievements
Rank 1
 answered on 02 Oct 2017
3 answers
258 views

How do you resize a document window when it is changed to floating.  Also, how do you change the title bar text?  I am using the FloatingWindowCreated event.  I have the statements listed below included already and they are working.  Nothing I have tried has worked for setting the size and title text.

      e.Window.AutoSize = True
      e.Window.ThemeName = myThemeName
      e.Window.MaximizeBox = True
      e.Window.MinimizeBox = True
      e.Window.Icon = My.Resources.TMBIcon

Susan
Top achievements
Rank 1
 answered on 02 Oct 2017
3 answers
143 views

Hello,

I have a requirement to display grid view of decimal value columns with the exception that I need to show comboboxes in the first row of the grid view. Comboboxes will have three non-editable values. How to achieve this?

Dimitar
Telerik team
 answered on 02 Oct 2017
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Form
Chart (obsolete as of Q1 2013)
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?