This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
In the samples, multiedit behaves just fine with a small button that enables the editing of the properties that have different values in the selected objects. When I try to do multi editing in my project, I get the button, and when I press it, it tries to set the property values to "null", but my properties doesn't allow null-values for its strings. Shouldn't the property grid first allow the user to set a new value before the value is propagated to the underlying objects? Is it possible to override this behavior? /Jonas |
|
|
In this particular case, the underlying object doesn't even allow an empty string as a property value (it is the name of the item, and the name can't be empty). We would really need the property grid to wait with setting the value until the editor looses focus. It seems to be a general problem that the propertygrid standard editor for strings will commit to the underlying object on each key stroke, can this be avoided with a setting? |
|
|
Hello Jonas To use a text editor that only updates when lost focus, you can add PropertyEditor instances to the Editors collection of the PropertyGrid. Here is an example:
Here the grid is displaying an instance of our Person class in the sample-data namespace. In the Editors tag of the PropertyGrid, I set a PropertyEditor which uses the NonAutoUpdatingTextEditor for the FirstName property. Unfortunately we can not change the current behavior of the ManyEditor at this stage. I have noted this down as an improvement for a future version. You could detect when null is being set and then either set an appropriate default value, or ignore setting the value. Jason Fauchelle |
|
|
Unfortunately this is not an option for us. The propertygrid resides in a usercontrol that is declared in an assembly that is unaware of the actual model types that are being edited (the whole purpose of the property grid is to be a generic declaratively driven component, right?). We can't specify editors for each concrete property that we are going to edit. Is there really no way to override this behavior for all properties? Btw, I noticed that the mindscape grid doesn't respect custom editors described by PropertyDescriptors. I have updated my demo in the previous post: https://www.dropbox.com/s/b6gvzkik5uzij1l/PropGridDemo2.zip to include a multiline property that uses MultilineEditor (inherits from UITypeEditor). It works well with the standard grid, but not in yours. /Jonas |
|
|
Hello Jonas Yes, the property grid is a generic declaratively driven component. The PropertyEditor is provided for fine tune adjustments. In your case you'll want to use the TypEditor. This will yet you specify an editor for all properties of a particular type, regardless of what the SelectedObject is. Here is an example:
This will use the non-auto updating text editor for all string properties. You could also add a TypeEditor for integer and double values etc. Indeed the PropertyGrid does not currently have support for custom editors defined by the property descriptors. I've noted this as an improvement to make in a future version. Jason Fauchelle |
|