We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Setting enum in propertygrid

Hi, I want to use enum datatype to display a combobox with int values in propertygrid, is there anyway to do that? I was trying to TotalStepsInInt = (int)totalSteps this method, but if i use this, it display in textbox instead of combobox. By not using CustomEditor, is it possible to do that? 

4 Replies

VR Venkateshwaran Ramdoss Syncfusion Team May 11, 2016 01:43 PM UTC

Hi Tho Jun Xiong,

In our PropertyGrid control, the input type can only be changed by using CustomEditor. Without using this we cannot change the input type. Can you please explain your requirement clearly, this would help us to proceed further.

Regards,
Venkateshwaran V.R.


MT Mers Tho May 12, 2016 02:37 AM UTC

Hi, thank you for replying.
my purpose is to display 2 combobox with int value in propertygrid. The attachment below is my sample.

In the sample, I create two combobox named TotalSteps and Steps. By right, the Steps combobox value is dependent with the selection of totalsteps. For example, in totalsteps combobox, i select 3, then steps combobox will be added a list of int value (1,2, and 3). However, by using CustomEditor, I can't perform the function. 

Attachment: WpfApplication4_c6120831.zip


MT Mers Tho May 12, 2016 02:45 AM UTC

public object Create(PropertyInfo propertyInfo)
            {
                TotalStepComboBox = new ComboBox();

                {
                    if (propertyInfo.Name == "TotalSteps")
                    {
                        TotalStepComboBox.Items.Add("0");
                        TotalStepComboBox.Items.Add("1");
                        

                        TotalStepComboBox.SelectedIndex = 0;
                    }

                    if (propertyInfo.Name == "Steps")
                    {
                        TotalStepComboBox.Items.Add("0");
                        TotalStepComboBox.Items.Add("1");
                        TotalStepComboBox.Items.Add("2");

                        TotalStepComboBox.SelectedIndex = 0;
                    }

                }

                TotalStepComboBox.SelectionChanged += ComboBox_SelectionChanged;

                return TotalStepComboBox;
            }

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {

            }


I have this in my code, but since both  are using TotalStepComboBox, I cannot do the function i mentioned above, but if I change the type of steps, and create another CustomEditor, but if using that way, I cannot get the name of steps. 


VR Venkateshwaran Ramdoss Syncfusion Team May 17, 2016 01:00 PM UTC

Hi Tho Jun Xiong,

We have analyzed your requirement. In our current implementation, we cannot change the CustomEditor based on other CustomEditor value. As the value changes depends on SelectedObject, we cannot change the value outside the scope.

Please let us know if you need any other assistance.

Regards,
Venkateshwaran V.R.

Loader.
Up arrow icon