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.
Unfortunately, activation email could not send to your email. Please try again.

Setting enum in propertygrid

Thread ID:

Created:

Updated:

Platform:

Replies:

124022 May 10,2016 12:07 AM May 17,2016 09:00 AM WPF 4
loading
Tags: PropertyGrid
Mers Tho
Asked On May 10, 2016 12:07 AM

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? 

Venkateshwaran Ramdoss [Syncfusion]
Replied On May 11, 2016 09:43 AM

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.

Mers Tho
Replied On May 11, 2016 10:37 PM

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

Mers Tho
Replied On May 11, 2016 10:45 PM

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. 

Venkateshwaran Ramdoss [Syncfusion]
Replied On May 17, 2016 09:00 AM

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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;