Hi,
In my application I use RadPropertyGrid and I create set of properties for it in my code using RadPropertyStore.
Before I started to use RadPropertyGrid all properties were displayed in group-boxes with different controls like text-box, drop-down and button. It was a mess.
One of the properties should contain path to some local directory. And in old implementation it was displayed by text box and browse button that was opening FolderBrowserDialog
.
As you might already imagine, my question is how can I insert FolderBrowserDialog to RadPropertyGrid?
What I have managed to do is below:
But I have two problems with this implementation:
1) FolderBrowserDialog opens on initialization
2) There is no such a thing like Click event for PropertyStoreItem, so user have to really change the property value in order to FolderBrowserDialog to appear
In my application I use RadPropertyGrid and I create set of properties for it in my code using RadPropertyStore.
Before I started to use RadPropertyGrid all properties were displayed in group-boxes with different controls like text-box, drop-down and button. It was a mess.
One of the properties should contain path to some local directory. And in old implementation it was displayed by text box and browse button that was opening FolderBrowserDialog
.
As you might already imagine, my question is how can I insert FolderBrowserDialog to RadPropertyGrid?
What I have managed to do is below:
public partial class SettingsManager : UserControl { public SettingsManager() { InitializeComponent(); _propertyStore = CreateProperties(); radPropertyGrid1.SelectedObject = _propertyStore; radPropertyGrid1.PropertySort = PropertySort.CategorizedAlphabetical; } private RadPropertyStore _propertyStore; private PropertyStoreItem _defaultSaveDirectory; private RadPropertyStore CreateProperties() { var result = new RadPropertyStore(); _defaultSaveDirectory = new PropertyStoreItem(typeof(string), "DefaultSaveFolder", Properties.Settings.Default.DefaultSaveFolderPath, "Default directory for saving snapshot and configuration files.", "Save Snapshot/Configuration", false); _defaultSaveDirectory.PropertyChanged += OnDefaultSaveDirectoryChanged; result.Add(_defaultSaveDirectory); return result; } void OnDefaultSaveDirectoryChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var folderDialog = new FolderBrowserDialog { Description = Resources.DefaultLocationDialogHelp, ShowNewFolderButton = true }; if (DialogResult.OK == folderDialog.ShowDialog()) { _defaultSaveDirectory.PropertyChanged -= OnDefaultSaveDirectoryChanged; _defaultSaveDirectory.Value = folderDialog.SelectedPath; _defaultSaveDirectory.PropertyChanged += OnDefaultSaveDirectoryChanged; Properties.Settings.Default.DefaultSaveFolderPath = folderDialog.SelectedPath; } }}But I have two problems with this implementation:
1) FolderBrowserDialog opens on initialization
2) There is no such a thing like Click event for PropertyStoreItem, so user have to really change the property value in order to FolderBrowserDialog to appear
