Jump to content
  • Advertisement
Sign in to follow this  
BrasiLokau

[.net] PropertyGrid issue

This topic is 3665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, Im trying to implement an editor type for property grid, in which it would allow me to browse for a file. I've read an article at msdn and i was able to set the class and make it work, partially. The method bellow shows the open file dialog:
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            {

                    System.Windows.Forms.OpenFileDialog form = new System.Windows.Forms.OpenFileDialog();
                    form.Multiselect = false;

                    if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        return base.EditValue(context, provider, form.FileName);
                    }
                }
            }

            return base.EditValue(context, provider, value);
        }
If i pick a different file it will continue to show the old one on property grid. I tried to return just the filename but it does not work. Do i have to create a type converter just to put the value on the property grid? Can anyone please help me figure this out thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!