This is a migrated thread and some comments may be shown as answers.

Problem implementing GridViewComboBoxColumn SelectionChanged Event

4 Answers 33 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Avinash
Top achievements
Rank 1
Avinash asked on 29 Jul 2017, 09:03 PM

Hello All,

I am facing problem implementing GridViewComboBoxColumn in my project. My requirement is to show popup on GridViewComboBoxColumn SelectionChanged Event. But, I am getting error (See the attached screenshots for the error). I am providing my XAML and XAML.vb code for your reference.

XAML Code:

<telerik:RadGridView x:Name="rgvResult" 
                                 AutoGenerateColumns="False"  
                                 CellEditEnded="rgvResult_CellEditEnded" 
                                 Loaded="rgvResult_Loaded"
                                 SelectionChanged="RadGridView_SelectionChanged" 
                                 Grid.Row="2" 
                                 Margin="1,116,0,-141"
                                 HorizontalAlignment="Left" Width="790">

                <telerik:RadGridView.Columns>
                    <telerik:GridViewComboBoxColumn Header="Screen Result" UniqueName="rgvScreenResultColumn"
                                                    DisplayMemberPath="Result" SelectedValueMemberPath="ID" 
                                                    DataMemberBinding="{Binding ScreenResultIsPositive, Mode=OneTime}" >
                    </telerik:GridViewComboBoxColumn>
            </telerik:RadGridView>

Code Behind:

Imports Telerik.Windows.Controls
Imports System.Windows.Controls

Public Sub New
        InitializeComponent()
        rgvResult.AddHandler(RadComboBox.SelectionChangedEvent, New Controls.SelectionChangedEventHandler(AddressOf OnSelectionChanged))
    End Sub

    Private Sub OnSelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs)
        If e.RemovedItems.Count > 0 Then
            If DirectCast(Me.rgvResult.Columns("rgvScreenResultColumn"), GridViewComboBoxColumn).SelectedValueMemberPath = 1 Then

            End If
        End If

    End Sub

 

Thank You,
Avinash Kumar

4 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 02 Aug 2017, 11:16 AM
Hello Avinash,


The presented error appears because the wrong namespace is used. To achieve the desired behavior you will need to use Telerik.Windows.Controls.SelectionChangedEventHandler and Telerik.Windows.Controls.SelectionChangedEventArgs instead of the ones used.

I hope that this helps.

Regards,
Martin Vatev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Avinash
Top achievements
Rank 1
answered on 09 Aug 2017, 09:09 PM

Hello Martin,

Thanks for your reply. I am still getting the same error (See attached file) even after using your solution. For your reference, below is the piece of code.

Imports Telerik.Windows.Controls
Imports Telerik.Windows.Controls.GridView

Partial Public Class Example
    Inherits UserControl

    Public Sub New
        InitializeComponent()
        rgvResult.AddHandler(RadComboBox.SelectionChangedEvent, New        Telerik.Windows.Controls.SelectionChangedEventHandler(AddressOf OnSelectionChanged), True)
    End Sub

    Private Sub OnSelectionChanged(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.SelectionChangedEventArgs)
        If e.RemovedItems.Count > 0 Then

        End If
    End Sub

 

Thanks,
Avinash Kumar

0
Martin
Telerik team
answered on 14 Aug 2017, 07:28 AM
Hello Avinash,

I tried a similar solution on my side but I was not able to reproduce the unexpected behavior. Attached you can find the project I used for the test. Please give it a try and let me know in case I am missing something.

I am looking forward to your reply.

Regards,
Martin Vatev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Avinash
Top achievements
Rank 1
answered on 14 Aug 2017, 07:09 PM

Hello Martin,

Thanks for your reply. Your solution worked. I just needed to Import Telerik.Windows namespace which was missing from my solution.

Thanks,
Avinash Kumar

Tags
GridView
Asked by
Avinash
Top achievements
Rank 1
Answers by
Martin
Telerik team
Avinash
Top achievements
Rank 1
Share this question
or