Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Create a custom cell editor and use it in a Property Grid.

License

NotificationsYou must be signed in to change notification settings

DevExpress-Examples/winforms-property-grid-create-custom-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Property Grid - Use a custom cell editor

This example demonstrates how to implement a UI Type Editor (FilteredFileNameEditor) and use it within the PropertyGridControl.

  1. Create aFilteredFileNameEditor class and implement theUITypeEditor interface:

    internalclassFilteredFileNameEditor:UITypeEditor{privateOpenFileDialogofd=newOpenFileDialog();publicoverrideUITypeEditorEditStyleGetEditStyle(ITypeDescriptorContextcontext){returnUITypeEditorEditStyle.Modal;}publicoverrideobjectEditValue(ITypeDescriptorContextcontext,IServiceProviderprovider,objectvalue){ofd.FileName=value.ToString();ofd.Filter="Text File|*.txt|All Files|*.*";if(ofd.ShowDialog()==DialogResult.OK){returnofd.FileName;}returnbase.EditValue(context,provider,value);}}
  2. Apply theSystem.ComponentModel.Editor attribute as follows:

    publicclassFile{[System.ComponentModel.Editor(typeof(UIEditors.FilteredFileNameEditor),typeof(System.Drawing.Design.UITypeEditor))]publicstringPath{get;set;}publicstringPath2{get;set;}}
  3. Assign a ButtonEdit to a cell as shown in the Assigning Editors to Editor Rows topic.

    privatevoidForm1_Shown(objectsender,EventArgse){RepositoryItemButtonEditedit=newRepositoryItemButtonEdit();edit.ButtonClick+=edit_ButtonClick;(this.propertyGridControl1.Rows[0]asCategoryRow).ChildRows["rowPath2"].Properties.RowEdit=edit;}
  4. Handle the Button Editor's ButtonClick event.

    voidedit_ButtonClick(objectsender,DevExpress.XtraEditors.Controls.ButtonPressedEventArgse){this.openFileDialog1.ShowDialog();}

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp