×

Notice

The forum is in read only mode.
×
Getting new Releases

To get notified on new releases you may follow us on twitter @expandframework or subscribe in our main RSS feed.

Topic-icon FileBrowsePropertyEditor

  • Sheldmandu
  • Sheldmandu's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
More
11 months 4 weeks ago #11592 by Sheldmandu
FileBrowsePropertyEditor was created by Sheldmandu
Hi Tolis, may I suggest adding a File Browser Property Editor that allows you to select a file (rather than a folder). It's pretty much the same as the Folder Browser Property Editor but just needs to use OpenFileDialog instead. Very handy if you're doing anything with individual files. I've got my own but would be good to have in Expand.
[PropertyEditor(typeof(string), "FileBrowserEditor", false)]
    public class FileBrowserEditor : DXPropertyEditor
    {
        public FileBrowserEditor(Type objectType, IModelMemberViewItem model) : base(objectType, model) { }
        private void buttonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                if (dialog.ShowDialog() != DialogResult.Cancel)
                {
                    ((ButtonEdit)sender).Text = dialog.FileName;
                }
            }
        }
        protected override object CreateControlCore()
        {
            return new ButtonEdit();
        }
        protected override RepositoryItem CreateRepositoryItem()
        {
            return new RepositoryItemButtonEdit();
        }
        protected override void SetupRepositoryItem(RepositoryItem item)
        {
            base.SetupRepositoryItem(item);
            ((RepositoryItemButtonEdit)item).ButtonClick += buttonEdit_ButtonClick;
        }
        protected override void SetRepositoryItemReadOnly(RepositoryItem item, bool readOnly)
        {
            base.SetRepositoryItemReadOnly(item, readOnly);
            ((RepositoryItemButtonEdit)item).Buttons[0].Enabled = !readOnly;
        }
    }
More
11 months 3 weeks ago #11604 by Tolis
Replied by Tolis on topic FileBrowsePropertyEditor
I agree that this is a handy editor, I will add it in the System.Win in 17.1.7.4

thnks for sharing!

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand
Moderators: expand
Time to create page: 0.212 seconds