Hi~!
I am using RadPropertyGrid in WinForm.
One item of propertygrid is File Path(string). When user click the File Path element to edit, I want to show Openfiledialog.
When I use Windows default control, it works well, but when I use telerik control, it doesn't work.
{
string _LogFile = "";
[Category("Design")][Editor(typeof(FileLocationEditor), typeof(System.Drawing.Design.UITypeEditor))]
[Description("Viewer background image path.")]
public string LogFileName
{
get
{
return _LogFile;
}
set
{
_LogFile = value;
}
}
}
public class FileLocationEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
// set file filter info here
if (ofd.ShowDialog() == DialogResult.OK)
{
return ofd.FileName;
}
}
return value;
}
}