Selection changed event for gridviewcombobox column

11 posts, 0 answers
  1. Swathi
    Swathi avatar
    16 posts
    Member since:
    Dec 2010

    Posted 15 Dec 2010 Link to this post

    Hi ,
                   I have a combo box column with in the grid and i need  an event for that combo box value changed .
                   I am unable to register a selection changed event for telerik:GridViewComboBoxColumn.
                   Suggest me how to do that.
    Thanks,
    Swathi.
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Dec 2010 Link to this post

    Hi Swathi,

    You may add a handler for the SelectionChanged event as follows:

    this.RadGridView1.AddHandler(RadComboBox.SelectionChangedEvent, new SelectionChangedEventHandler(OnSelectionChanged));
     
    private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        // TODO: Implement this method
        throw new NotImplementedException();
    }

    All the best,
    Maya
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  3. UI for WPF is Visual Studio 2017 Ready
  4. Swathi
    Swathi avatar
    16 posts
    Member since:
    Dec 2010

    Posted 15 Dec 2010 Link to this post

    Thanks for the immediate response.I am able to register and use the event now.But i have few more queries.

    1.Can i register the event for a particular column in a grid.right now i am putting a condition within the event.
    2.This event is being called while loading also,which i think is not valid.Can u answer this?

    Thanks in advance
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Dec 2010 Link to this post

    Hello Swathi,

    You need to define a condition in the OnSelectionChanged method if you want to fire the event only for a particular column. For example:

    private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                //First approach:
                var cell = (e.OriginalSource as RadComboBox).ParentOfType<GridViewCell>();
                if (cell != null && cell.Column.UniqueName == "MyUniqueName")
                {
                }
                //Second approach:
                RadComboBox comboBox = (RadComboBox)e.OriginalSource;           
                if (comboBox.SelectedValue == null || comboBox.SelectedValuePath != "Code") // we take action only if the continent combo is changed
                {
                }
            }

    As for your second question, indeed the event is fired while loading and so far this is the expected behavior.  

    Greetings,
    Maya
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  6. AndyRutter
    AndyRutter avatar
    32 posts
    Member since:
    Mar 2009

    Posted 31 Jul 2012 Link to this post

    Please could you also provide a sample in VB, your converter is next to useless when dealing with events
    Cheers
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 31 Jul 2012 Link to this post

    Hello Brian,

    he idea of the logic implemented should be exactly the same as in C#. Could you clarify what are the difficulties you met when writing the code in VB ? 


    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. AndyRutter
    AndyRutter avatar
    32 posts
    Member since:
    Mar 2009

    Posted 31 Jul 2012 Link to this post

    I have no idea how to implement the following in VB:
    this.RadGridView1.AddHandler(RadComboBox.SelectionChangedEvent, new SelectionChangedEventHandler(OnSelectionChanged));

    The converter gives you this:
    Me.RadGridView1.[AddHandler](RadComboBox.SelectionChangedEvent, New SelectionChangedEventHandler(OnSelectionChanged))
    As with all addhandler conversions it is wrong, I have worked out how to modify a normal handler using the address of function but I cannot work out the syntax for how to handle one that is bound to a grid, it comes up with errors like, cannot use a lamda expression, must use addressof and radcombobox has no such event..

    Cheers
  9. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 31 Jul 2012 Link to this post

    Hi,

    You can take a look at this forum thread for further reference.
     

    Regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  10. AndyRutter
    AndyRutter avatar
    32 posts
    Member since:
    Mar 2009

    Posted 31 Jul 2012 Link to this post

    Hadn't seen that blog post but I still get this error:
    Error 3 Method 'Private Sub comboSelectionChanged(sender As Object, e As Telerik.Windows.RadRoutedEventArgs)' does not have a signature compatible with delegate 'Delegate Sub SelectionChangedEventHandler(sender As Object, e As Telerik.WinControls.UI.SelectionChangedEventArgs)'. C:\TFS_Trunk\BM Pallets\EMU\dashboard\admin\ucAdminAddresses.xaml.vb 29 101 dashboard

    My other issue here is that I have spent countless hours as a VB developer trying to find work arounds to the c# code samples and documentation. Surely you as a company selling these controls for the same price as the c# users should provide equal documentation for both instead of making us VB users scrounge around in blog posts hoping that someone else has had the same issue previously. Just today I have wasted 2 hours on this and I've been having these same issues for around 3 years now, it equates to 'days' lost...!
  11. Robert
    Robert avatar
    1 posts
    Member since:
    Jul 2013

    Posted 16 Jul 2015 in reply to Maya Link to this post

    I agree with the comment - why are vb programmers treated as 2nd class citizens by Terlerik?
  12. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 Jul 2015 Link to this post

    Hi,

    Thank you for sharing your feedback.

    For the VB programmers we offer this online converter. For the purpose of converting entire solutions, you can also consider using Instant VB Converter.

    Also, as you run the WPF demos, the C# code can be converted into VB.NET code on demand (choosing the VB.NET tab for the code behind files).

    Regards,
    Dimitrina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready