Telerik Forums
UI for WinForms Forum
1 answer
38 views

Hello,

I created a custom column and cell in my grid following the progress-bar example

https://docs.telerik.com/devtools/winforms/controls/gridview/cells/creating-custom-cells

But I have modified it so that I can view either a textBoxElement or a dropDownListElement depending on what data is in the cell. It all seems to work just fine until I scroll the grid. Scrolling visualy shuffles the data in the custom column. I've tried to take the cell-formatting route but without success. Is it possible to achieve this result somehow?

 Public Class GridParameterValueElement
        Inherits GridDataCellElement

        Public Sub New(ByVal column As GridViewColumn, ByVal row As GridRowElement)
            MyBase.New(column, row)
        End Sub

        Private isInitialized As Boolean
        Private firstTimeIndexChanged As Boolean = True
        Private dropDown As RadDropDownListElement
        Private textBox As RadTextBoxElement
        Protected Overrides Sub CreateChildElements()
            MyBase.CreateChildElements()
            dropDown = New RadDropDownListElement() With { 
                .DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList
            }
            textBox = New RadTextBoxElement() With {
                .Enabled = True,
                .ClickMode = Telerik.WinControls.ClickMode.Press,
                .ZIndex = -1
            }
            If Me.Children.Contains(dropDown) Then Me.Children.Remove(dropDown)
            If Me.Children.Contains(textBox) Then Me.Children.Remove(textBox)
            Me.Children.Add(dropDown)
            Me.Children.Add(textBox)
            AddHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
            AddHandler textBox.TextChanged, AddressOf TextInBoxChanged
            'AddHandler textBox.Click, AddressOf TextBox_Click

        End Sub

        Protected Overrides Sub DisposeManagedResources()
            RemoveHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
            RemoveHandler textBox.TextChanged, AddressOf TextInBoxChanged
            MyBase.DisposeManagedResources()
        End Sub
            
        'Private Sub TextBox_Click(sender As Object, e As EventArgs)
        '    Dim test  = sender
        'End Sub


        Public Overrides Sub SetContent()
            MyBase.SetContent()

            If Me.RowInfo.Cells("DisplayValue").Tag IsNot Nothing Then

                If Not Me.isInitialized Then 
                    If Me.Children.Contains(textBox) Then Me.Children.Remove(textBox)

                    With Me.dropDown
                        .DataSource = Me.RowInfo.Cells("DisplayValue").Tag
                        .ValueMember = ("DevelopmentTypeParameterValueId")
                        .DisplayMember = ("ParameterValue")
                    End With 
                End If

                If Me.RowInfo.Tag IsNot Nothing Then
                    RemoveHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
                    dropDown.SelectedIndex = DirectCast(Me.RowInfo.Tag, Integer)
                    AddHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
                Else
                    RemoveHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
                    dropDown.SelectedIndex = -1
                    AddHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
                End If

            ElseIf Me.Value IsNot Nothing AndAlso Me.Value IsNot DBNull.Value Then

                If Not Me.isInitialized Then 
                    If Me.Children.Contains(dropDown) Then Me.Children.Remove(dropDown)
                    Me.textBox.Text = CStr(Me.Value)
                End If
       
            End If

            Me.isInitialized = True
        
        End Sub


        Protected Overrides ReadOnly Property ThemeEffectiveType() As Type
            Get
                Return GetType(GridDataCellElement)
            End Get
        End Property

        Public Overrides Function IsCompatible(ByVal data As GridViewColumn, ByVal context As Object) As Boolean
            Return TypeOf data Is GridViewParameterValueColumn AndAlso TypeOf context Is GridDataRowElement
        End Function

    End Class
    
    Public Class GridViewParameterValueColumn
        Inherits GridViewDataColumn
        Public Sub New(ByVal fieldName As String)
            MyBase.New(fieldName)
        End Sub
        Public Overrides Function GetCellType(ByVal row As GridViewRowInfo) As Type
            If TypeOf row Is GridViewDataRowInfo Then
                Return GetType(GridParameterValueElement)
            End If
            Return MyBase.GetCellType(row)
        End Function
    End Class


Nadya | Tech Support Engineer
Telerik team
 answered on 16 Jan 2024
1 answer
113 views

Hi Telerik support,

I've created a sample application with a gridview containing more combobox columns. In this forum I found some code snippets to auto open the dropdown box when one navigates to the cell (with the keybord arrow keys).

It seems to work fine except for one scenario..

click (with mouse) on the first column (which is readonly), then navigate to the next column with the arrowkey right. The focus jumps to the third column. If I navigate from the third column to the second (also with arrowkeys), it's ok.

Please try this also with column nr. 5 and 6. (so click on 5 and navigate to 6). After the application newly started, it also jumps away. But only the first time.

Can you help me out of this behaviour?

Kind regards,

Daniel Kaya

 

Dinko | Tech Support Engineer
Telerik team
 answered on 13 Jan 2023
1 answer
122 views

Hi, good day.

I have developed web applications using telerik controls with Visual Studio.

But now I'm going to develop a desktop application, so I'm going to use the Telerik controls for WinForms with Visual Studio.

I have three questions.

1. I have version 2017 of UI for ASP.NET AJAX installed, can I install a version of UI for Winforms 2022, do not create conflict?

2. What version of UI for Winforms is compatible with Visual Studio 2017?

3. In the project that I am going to carry out using Winforms, the idea is that the data is displayed as a dynamic excel table and graph. I have read the documentation and I understand that I would have to use several controls for that, I thought it would not be so laborious, is the latter correct or am I wrong?

Thank you very much for the help.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 05 Apr 2022
1 answer
124 views

Hi,

I am using a RadGridView in a window .

I am using RadDropDownListEditor for editing one of the cells in the column that has one element as list.

I want it to be able to set as empty on editingBut the change isn't persisting when I provide empty string.

According to the documentation, the change only persists when we select one of the other items in the list.

Is there any way I can set it as blank on providing empty string.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 27 Dec 2021
Narrow your results
Selected tags
Tags
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
Buttons, RadioButton, CheckBox, etc
ComboBox and ListBox (obsolete as of Q2 2010)
ListView
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
Menu
PropertyGrid
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
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
GanttView
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
VirtualGrid
ContextMenu
Spreadsheet
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
Rotator
TrackBar
MessageBox
CheckedDropDownList
SpinEditor
StatusStrip
CheckedListBox
Wizard
ShapedForm
SyntaxEditor
TextBoxControl
LayoutControl
DateTimePicker
CollapsiblePanel
Conversational UI, Chat
CAB Enabling Kit
TabbedForm
DataEntry
GroupBox
ScrollablePanel
WaitingBar
ImageEditor
ScrollBar
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
ColorBox
Callout
PictureBox
VirtualKeyboard
FilterView
Accessibility
DataLayout
NavigationView
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
FontDropDownList
Licensing
BreadCrumb
ButtonTextBox
LocalizationProvider
Dictionary
Overlay
Security
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
Rating
TimeSpanPicker
BarcodeView
Calculator
OfficeNavigationBar
Flyout
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?