ComboBox not sending SelectionChanged event on left-click

I have an application that hides certain properties on the underlying object for a PropertyGrid depending on selected value of an Enum property displayed in a combo box.
(see attached pictures).
This was achieved by code below. 
With a newer release of Syncfusion that we installed recently, left-clicking on one of the combo box choices no longer seems to raise SelectionChanged event.
Right clicking the choice first, and then left-clicking or hitting enter DOES work.
Is there some new option or code I should use to change selection on combo box ?

   
     void _PropertyGrid_SelectedPropertyItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PropertyGrid prop = d as PropertyGrid;
            if (prop.SelectedPropertyItem != null)
            {
                object typeinstance = prop.SelectedPropertyItem.PropertyEditor.GetType();

                if (prop.SelectedPropertyItem.DisplayName == "SearchType")
                {
                    ComboBox property = prop.SelectedPropertyItem.PropertyEditor as ComboBox;
                    if (property != null)
                    {
                        property.SelectionChanged += property_SelectionChanged;
                      
                    }
                }

            }
        }

        void property_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox instance = sender as ComboBox;
           if (instance != null)
           {
               HideProperties();
               
           }
        }

Attachment: ComboBox_fcbeb00c.7z

3 Replies 1 reply marked as answer

UN Unknown Syncfusion Team September 2, 2020 10:35 AM UTC

Hi Steve, 

Thanks for contacting Syncfusion support. 

We have checked your query “SelectionChanged event of ComboBox in PropertyGrid is not working when changing the enum values” and it works fine. We have created a simple sample with  a property containing enum values and used the codes you have shared , but the SelectionChanged event works properly. Please refer the below video and sample for same.  



Regards, 
Niranjan Kumar Gopalan 


Marked as answer

SM Steve McWilliams September 3, 2020 12:04 AM UTC

I saw that your sample works correctly.
My application works also if instead of calling HideProperties(), I do MessageBox.Show("Hi") or if I change HideProperties() to do nothing.
So, it seems that something in my HideProperties() method is preventing further selections from being detected.
However, when I added a similar method in your sample, it continued to work correctly as before, so I don't know what the difference is.


        void property_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox instance = sender as ComboBox;
           if (instance != null)
           {
                HideProperties();
               
            }
        }
 

        private void HideProperties()
        {
            propertyGrid.HidePropertiesCollection.Clear();

            propertyGrid.HidePropertiesCollection.Add("DocName");
            propertyGrid.HidePropertiesCollection.Add("ExportEventQuery");
            propertyGrid.HidePropertiesCollection.Add("QueryHistories");

            if (QueryManager.SearchType == QueryManager.SearchTypes.LocalCache)
            {

                propertyGrid.HidePropertiesCollection.Add("StartDate");
                propertyGrid.HidePropertiesCollection.Add("EndDate");
                propertyGrid.HidePropertiesCollection.Add("DaysPrior");
                propertyGrid.HidePropertiesCollection.Add("MaxRunsToSearch");
                propertyGrid.HidePropertiesCollection.Add("MaxRunsToReturn");
            }

            propertyGrid.RefreshPropertygrid();
        }


UN Unknown Syncfusion Team September 3, 2020 10:35 AM UTC

Hi Steve, 
 
Thanks for your update. 
 
As you have mentioned the sample we have provided in our previous update works fine and when we checked with the HideProperties method codes you have shared, it works fine as the SelectionChanged event of ComboBox is invoked properly. Please refer the below sample and also ensure that working of the PropertyGrid in your application is same as that of in our attached sample.  
 
 
 
Regards, 
Niranjan Kumar Gopalan  


Loader.
Up arrow icon