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
|
Hi, if you have a instance of a class A with properties: a, b, c and a instance of class B with properties a,b,y (A and B derived from Base (which has virtual propertie a,b,c,x,y) is there a way to select both instances and show only the shared properties? like this propertygrid.SelectedObjects =new object[]{instanceA,instanceB}; the propertiegrid shows now a "shared object" only with property "a" and "b". if you cange the propertie in the propertygrid both instances will be changed. Is there a way to get something like this ?
Thanks for helping!
Mario |
|
|
Hello Mario, Recent nightlies support exactly the syntax and behaviour you describe: there is a SelectedObjects property and the grid will display only those properties defined by all selected objects. You can get the latest nightly from the store (or http://www.mindscape.co.nz/products/wpfpropertygrid/nightlybuilds.aspx for the trial edition). I am a bit confused however by your description of Base having virtual properties a, b, c, x, y. In this case both A and B will have those properties as well, so the grid will show all of those properties, not just properties a and b. Are you asking for the grid to show only properties that have been *overridden* at the A and B levels? |
|
|
Hi ivan, Thank you for answering. This is an really cool feature. I love it. "Iam a bit confused however by your description of Base having virtual properties a, b, c, x, y. In this case both A and B will have those properties as well, so the grid will show all of those properties, not just properties a and b. Are you asking for the grid to show only properties that have been *overridden* at the A and B levels?" You are right. The most Properties in the base classe are virtual . Derived classes overwrites some properties. All Properties also tagged with "[Browsable(bool)]" attributes. The propertie grid should show only the shared browsaeble attributes. In the moment we have a appereance (with the newsest nightly build) like this: If "first " selected object=Instance A+"second" selectedobject=instanceB (the list entries in SelectedObjects..) ->the grid shows 1 propertie->good If "first " selected object=Instance B+"second" selectedobject=instanceA (the list entries in SelectedObjects..) ->the grid shows 2 propertie->bad (The second propertie is only browsable for the class B. The first propertie is browsable for all classes.) (we want:(in this case) show always 1 propertie)
The second issue is: If i write propertyGrid.SelectedObjects = objs; (whre objs= IList) we have many crashes ("Null reference exception" in the propertiegrid,call stack is "empty" (debugger shows exception in Application.run :( The crash happens if you do this : 1. SelectedObjects=instanceA, 2. SelectedObjects=instanceB, 3. SelectedObjects=instanceA->crash If i debug the crash i can see (very) much "get propertie calls" . If i change the code to : if (objs.Count==1) there there will be less crashes. is the feature "stable"? Cheers, Mario |
|
|
Hello Mario, I will look into merging the browsable attributes and aim to get a fix out in the next nightly build (will let you know). Regarding the NullReferenceException, I think this is the same problem that Craig reported at http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=1480. It should have been fixed in the 21 Nov nightly build. If you are still seeing it with that build then could you zip up a sample project that reproduces the problem, please? Thanks! "Is the feature 'stable'?" We have at least one customer who has been using it for a couple of months so we had thought it was stable. However it sounds like there must be some cases that that customer didn't hit, so we may have a bit more stabilisation and fit-and-finish work to do after all. We appreciate your patience and your help in reporting problems. |
|
|
Hi Mario, Just to let you know that the browsability fix will be in nightly builds dated 22 Nov 2008 and above, available after about 1430 GMT. This fix is specific to browsability: if you are using other, less "mergable" attributes such as DisplayName, these will still be taken from the first item in the SelectedObjects collection. We would welcome your feedback if there are other attributes which you feel need to be merged in a multi-select scenario. |
|
|
Hi ivan,
thanks a lot. In the next days we will test it. I will contact you again. CHeers, Mario
|
|
|
Hi ivan, I think the "crash-bug" is fixed.Thanks a lot. But there are some other issues. issue 1: With "SelectedObject" (instead selectedobjects) the prop grid looks good.(selectedobject-only.JPG) with selectedobjectS it looks not good (some margins...) issue 2: with selectedobject only you cant write in the "propertie value field" (because "it is" a combobox if mouse over) With selectedobjectS (also if selectedobjectS.count==1) you can write in some "propertie value fields" (Target Animation,Target SHape,Verification picture, Verification after Calibration, Accept Points automatacally, ) ( Background color is still not "writeable", random group is also "writable" with selectedobject) The typeconverter doesnt work ( Accept points auto, true/false->yes/no)
issue 3: ( i think this is issue 1+2) For some objects we have a propertie "duration". (duration-selectedobjectonly.JPG) ("writeable"+combobox) it looks now "bad" (typeconverter not (full) used (normally -1 is "auto") ,writable +no (means empty) combobox, multiple editor doesnt work(still shown after click on the "the propertie has different values across the selected properties"-button) "not full used" means: the prop grid shows -1 if "auto".(bad) but i can write 3000->the object duration is now 3000.(good) i can write auto->the object duration is auto. (good)
the duration propertie editor is defiened: <ms:PropertyGrid Name="propertyGrid" (blabla)> <ms:PropertyEditor PropertyName="Duration" DeclaringType="ms:Many" there are also some "builtineditor templates" <ms:BuiltInEditorStyle EditorKey="{x:Static ms:PropertyGrid.ListSelectNoTextEntryEditorKey}" Style="{StaticResource ListSelectNoTextEntryEditor}">
the color picker editor works fine. (propertie Background color)
summary: issue 1: styles/templates are "not really" used issue 2: typcoverter ot used issue 3: duration propertie editor "is very bad" now (but i think this is issue 1+ issue 2) Whats going wrong ? Thank you for helping Cheers, Mario
|
|
|
Please find the screenshots in the attachment.
Cheers, Mario
|
|
|
Hello Mario, I think I'm going to need to have a look at your code (data objects, type converters and templates) in order to figure out what's going on here -- I'm not managing to work it out from the screenshots. I think the first issue may be to do with needing to style the ManyEditor to work nicely with your layout. The second *may* be to do with having objects of different types and therefore different property metadata, but it is hard to tell without the code. Certainly things like type converters and writeability should be respected. If you're not comfortable posting the necessary bits in the forums, would it be possible for you to email them to us via the contact form, or directly to ivan @ the obvious domain? Sorry about this, but I think we will be able to resolve these issues a lot faster if we have a "live" repro case! Thanks! |
|
|
Hi ivan, you can see the issue if you modify your sample: In your SampleData\Persunfull.cs add the line [TypeConverterAttribute(typeof(YesNoTypeConverter))] before : public bool HasWorkPermit in your project quickstart change the line TestGrid.SelectedObjects = new object[] { Person.AliceFull, Person.Bob }; to TestGrid.SelectedObjects = new object[] { Person.AliceFull}; Add a typeconverter like this
public class YesNoTypeConverter : TypeConverter
now you can start the quickstart program page multipleselectedobjects.xaml you can see the hasworkpermit propertie editor in referencegrid1 works fine but the property editor in "testgrid" works bad (shows true/false+ "writeable" )
Have a nice weekend! Mario |
|
|
Hi Mario, Thanks for the detailed repro. This was down to an issue with the way we detected property-level type converters -- we were looking specifically for the TypeConverterAttribute and this was not being propagated through the multiple object property reconciliation code. I've made some improvements to property reconciliation which fix this problem. These will be in nightly builds dated 2 Dec 2008 and above, available from about 1430 GMT. Please let us know if you still see problems. Note that this fix has been applied to the 2.0 release of the grid. This is a free upgrade and you will get it automatically when you download the latest nightly from the store; however it installs in a different directory (%Program Files%\Mindscape\WPF Property Grid 2.0) so you may need to update your references in order to see the fix. (You *might* also need to updates licenses.licx with the new version number but in practice it seems to work okay without this.) Did you manage to resolve the layout issues you described in your previous post? If not, once you have the new release, it might be worth checking out the new styles (in the Source\Styles folder) as these include examples of styling/templating the ManyEditor which should hopefully resolve the margin problems. If they still don't help, let us know, but we would need your style code to resolve this. |
|
|
Hi ivan, we are using now the the nightly build dated 2 Dec 2008. It works fine. The margin issue is also solved (with your excellent sample ;) ) there are 2 small issues residual. We have "defined" (please note namespace "my" means Mindscape...) // xaml instance creation my:PropertyGrid.Editors> (..) Imageselector is: <DataTemplate x:Key="ImageSelector"> (...)
the button click handler is: private void Button_Click_1(object sender, RoutedEventArgs e) Imagefileeditor is: public class ImageFileEditor : ObjectWrappingEditor
this works fine with single selectobject method. It doesnt work with multiple selected object methed . (it doesnt work with the required Many cast too.) First the textbox in the property grid is empty (shows not the value). Second there is an exception (at "propertygrid level") if I "write the value by hand" (cannot convert string to Many 1 [string]) Is there a way/pattern to get this feature with multiple select objects? (The textbos should be writeable by hand and "with button" (shows dialog))
The other issue is more generic (and also present with single object selection): Sometimes we have properties like this: public enum TargetShapes
public TargetShapes TargetShape means: you can select built in values or userdefiend files. It works more or less as expected. You can select blackCircle->black circle is selected .. user defiend-> dialog appears-> you can select a file->works fine if you select user defiend again-> no dialog appears (doesnt "calls" the property setter) if you like to change the user defiend value (image) you have to select a built in value and then the user defiend entry. Is there a way/pattern to improve this ? the "bug" appears also if you select the user defiend entry and then "cancel"(the dialog) now the property value is set to black circle ("reset"). But if you now like to set a new user defiend value you have first to select an built in value and then the user defiend entry...
Hope you can understand this post. ;)
CHeers , Mario
|
|
|
Please ignore the post above. It works all fine! Thanks for the great new version! Thanks for the great support!
CHeers, Mario |
|