Updating PropertyGrid after selecting new value CustomEditor
Hello Customer Support,
I am sorry to ask so many question, but I am still learning about your controls. I came across an issue in my propertygrid demo.
I am still using
- WPF
- MVVM
- Multi lingual (see Bootstrapper.cs line 65)
- Caliburn Micro, although CM does not really seems to work - I will try to create a different approach for that next.
I am planning to try implementing Fluent Validation as well (https://fluentvalidation.net/), but it creating this demo is a stepwise process, so it will follow later.
For now, I have created a custom editor to display a combobox on the PropertyGrid (PG) that holds a reference to multiple addresses. Initially, changing the selection in the address editor did now show any new values in the PG. So I created a method to refresh the PG after the user selects a new address from the list. The address contains a country field. I defined the country in a separate class. I also created a custom editor that displays a combobox on the PG from which users can select a country. When changing the country, the underlying/nested display details of the country class were updated, sometimes, after the first selection change without having to force refresh the PG ( and without me handling the event explicitly). In the SF demo code (see WPF 2020 vol 1 Attribute Support Demo .NetCore -> changing a date will not update date details). Since this was unreliable I wrote a method that refreshes the PG after the selection changes in the Country combobox. This initially failed because I was using the syncfuction ComboBoxAdv in my custom country editor. I created a second version of the country custom editor with a regular combobox and this one works, but it is really slow.
The attached code has both versions of the code and you can switch between them by commenting / uncommenting the indicated code. The initial code version is the one that works.
My questions are
- Why does the application crash when the custom country editor is created with a syncfysion combobox Adv
Look in the SyncFusion\PropertyGrid\CountryEditor.cs (comment out the entire class (the regular combobox version) and uncomment the class at the bottom of this file (the SF comboboxAdv version)).
This will affect which code is run from the ViewModels\PropertyGridViewModel.cs. The editor with the regular combocox will trigger property_ComboBoxSelectionChanged (row 246) and the comboboxAdv version will trigger property_ComboBoxAdvSelectionChanged on row 276.
- Is there a more elegant way to refresh just the values that reflect the change in selection without having to refresh the entire PG? Refreshing the entire PG is slow.
** One option I would like to try: Is there a way to pre-define the entire Syncfusion PG in xaml? With this I mean that I predefine each property in xaml using a x:name declaration. This name would then also be a property in the ViewModel. This way I think I can bind indivual properties between the View and ViewModel using Caliburn Micro. This would allow a single change to display directly without having to refresh the entire PG.
Thanks for any help you may be able to provide.
Kind regards,
Niels
Attachment: demo_9a26d8fd.7z
SIGN IN To post a reply.
11 Replies
1 reply marked as answer
NI
Ninja
Syncfusion Team
June 30, 2020 03:15 AM UTC
Hi NM Van Strein,
Thanks for contacting Syncfusion support.
We tried to access your project but we are unable to run it due to the following issues when tried to build your application. Please provide a solution for the below output. We tried reducing the path of the files , but it didn’t work either. So please provide us a working sample. We have checked the reported query that when change the date value of DateofBirth property , and it works properly. Please refer the below video for same. The properties value update of PropertyGrid can only be changed by UpdateSourceMode as mentioned in below documentation.
Output:
|
Error occurred while restoring NuGet packages: The local source 'C:\Users\NiranjanKumarGopalan\Downloads\SyncfusionNuget_16.1.0.24_292270_9102019031227842_I246313\4.6' doesn't exist. 1>------ Rebuild All started: Project: SystemExtensionsLibrary, Configuration: Debug Any CPU ------ 1>C:\Program Files\dotnet\sdk\3.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1004: Assets file 'D:\SyncfusionControlsDemo\SystemExtensionsLibrary\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. 1>Done building project "SystemExtensionsLibrary.csproj" -- FAILED. 2>------ Rebuild All started: Project: SFMVVM, Configuration: Debug Any CPU ------ 2>C:\Program Files\dotnet\sdk\3.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1004: Assets file 'D:\SyncfusionControlsDemo\SFMVVM\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. 2>Done building project "SFMVVM.csproj" -- FAILED. ========== Rebuild All: 0 succeeded, 2 failed, 0 skipped ========== |
Regards,
Niranjan Kumar Gopalan
NV
NM van Strien
June 30, 2020 09:19 AM UTC
Hi Niranjan Kumar Gopalan,
Wrt the DateOfBirth property in the demo, I agree that the breakpoint is hit - but you should also check the values that are displayed in the user interface. Although the date selector tool shows the new date after a new selection, the date values below the dateselector tool are not updated.
I recorded a video using VLC demonstrating this behavior, but for some reason my cursor is not visible. Still, I think if you pay attention to the date values below the date picker tool, then you will spot the discrepancy after changing the date and also despite that the breakpoint is hit.
Is this the intended behavior in the demo? If so, to me it would be
beneficial if the demo also shows how to properly update the date values
that are visible below the date selector, so that they are updated to be equal to the selected date in the date picker.
Wrt my code demo, I think that this is caused by a different version of the Syncfusion packages on your system. If you be so kind to check your dependencies in Nuget and upgrade or reinstall the Syncfusion dependencies - then I think it should work.
Kind regards,
Niels van Strien
Attachment: sfpgvideo_b3da3c32.7z
NI
Ninja
Syncfusion Team
July 1, 2020 11:19 AM UTC
Hi NM Van Strien,
Thanks for your update.
We have checked your query “ Isuse in Syncfusion Dashboard sample for AttributeSupport in PropertyGrid ” and logged it as defect. The fix will be included in weekly NuGet release which will roll out by mid of July, 2020. We will update you once it rolls out. And for the issue “When ComboBoxAdv is used in CustomEditor of application crashes when selection is changed” and it has already been fixed , and it will be included in our Volume 2 release which will roll out by end of this week. We appreciate your patience until then. Please refer the below feedback for same.
Regards,
Niranjan Kumar Gopalan
NV
NM van Strien
February 11, 2021 11:42 AM UTC
Dear Niranjan Kumar Gopalan,
I have noticed that the nested properties of a DateTime field is now correctly updated after selecting a new value. See: https://www.syncfusion.com/feedback/15676/in-propertygrid-datetime-value-change-of-a-property-does-not-update-its-nested
However, I was hoping that this would provide a fix for more than just the DateTime field. If you look at the latest release of your software 18.4.0.39, you can load the WPF propertygrid demos
-> run local demos .net core
-> select propertygrid
-> select configuring at runtime demo
-> change the favorite color using the colour picker
Notice that the nested properties do not update. For DateTime the problem is solved, but for other editors, the nested properties are still not updated. The issue partly remains.
I have the same issue with a custom editor for which the nested properties do not update. Can you please share the solution that was created for the DateTime field, so that I may apply it to my custom editor? Also, I think it would be good if your team validates which nested properties are also not updated for built-in editors - like the colour picking editor.
Thank you and kind regards,
Niels van Strien
BR
Bharathi Rajakantham
Syncfusion Team
February 12, 2021 01:53 PM UTC
Hi NM Van Strein,
Thanks for contacting Syncfusion Support,
We have confirmed the reported issue “Nested Properties not updating in ColorPicker used in PropertyGrid” from our end. We have logged a bug report on this. The patch for this fix will be expected to be available on 5th March 2021. We will provide you the feedback Link shortly. We appreciate your patience until then.
Regards,
Bharathi R
NV
NM van Strien
February 13, 2021 01:36 PM UTC
Dear Bharathi Rajakantham,
Thank you for
creating a bug report for the issue that nested properties in a property
grid are not updated after selecting a new value in the color picker.
My
question is somewhat broader in scope. I am experiencing the same issue
with a custom editor. For my custom editor I am following the pattern
that is shown in the user documentation:
https://help.syncfusion.com/wpf/propertygrid/customeditor-support
However,
instead of a simple data type like string or integer or enum, I am using a
so called https://github.com/ardalis/SmartEnum. The custom editor works
in the sense that I can make selections using a combobox on the basis
of the smart enum, but the nested properties of the smart enum are not
updated once the selection in the combobox changes. This seems to be the
same problem as was the case for the DateTime object and the
ColorPicker object.
I would appreciate it
if you could tell me how to change the custom editor code, so that the
nested properties are properly updated.
Thank you for any help you can provide.
Kind regards,
Niels van Strien
BR
Bharathi Rajakantham
Syncfusion Team
February 15, 2021 12:59 PM UTC
Hi NM Van Strein,
Thanks for your update,
We are validating the reported query from our side. We will update you the further details on 17th Feb 2021. We appreciate your patience until then.
Regards,
Bharathi R
BR
Bharathi Rajakantham
Syncfusion Team
February 17, 2021 01:42 PM UTC
Hi NM Van Strein,
Thanks for your Patience,
We have validated the reported query and logged a bug reported on the Nested properties of ColorPicker in PropertyGrid and also the nested properties of the Smart Enum. The patch for this fix is estimated to be available on 10th March 2021.
You can track the status of the issue using the below feedback Link.
Feedback Link: https://www.syncfusion.com/feedback/22417/nested-properties-not-updating-in-colorpicker-used-in-propertygrid
We appreciate your patience, until then.
Regards,
Bharathi R
BR
Bharathi Rajakantham
Syncfusion Team
March 10, 2021 02:07 PM UTC
Hi NM Van Strein,
Thanks for your patience,
The reported issue “Nested properties of ColorPicker in PropertyGrid and also the nested properties of the Smart Enum” has been fixed.
This patch which can be download from the below links.
|
Recommended approach - exe will perform automatic configuration.
Please find the patch setup from below location:
Patch link :
Please find the patch assemblies alone from below location:
Assemblies Link:
Nuget link:
|
Assembly Version: 18.4.0.39
Installation Directions:
This patch should replace the files "Syncfusion.PropertyGrid.WPF” under the following folder.
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\[TargetFramework]
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\18.4.0.39\precompiledassemblies\18.4.0.39\4.6
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you must manually copy and paste them to the preferred location or you must run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.
Disclaimer:
Please note that we have created this patch for version 18.4.0.39 specifically to resolve the issue reported in this incident. If you have received other patches for the same version for other products, please apply all patches in the order received. Please let us know, if you are using any other Syncfusion version, we will provide patch in your version.
Regards,
Bharathi R
NV
NM van Strien
April 1, 2021 10:10 AM UTC
Hi Bharathi,
I was working on some other things, but am now back at this particular issue. I already updated my syncfusion libraries to 19.1.0.54. Would these patches still work, or would I revert back to the earlier version? Will the patches become part of production code at some point? If yes, is there an indication when that it will be pushed to clients?
Kind regards,
Niels
PS
Prabakaran Sangameswaran
Syncfusion Team
April 2, 2021 12:54 PM UTC
Hi NM van Strien,
Thanks for contacting Syncfusion support.
Yes, the fix “Nested properties of ColorPicker in PropertyGrid and also the nested properties of the Smart Enum” is also included in our latest version 19.1.0.54. Please check the same in our latest version and get back to us if you need further assistance.
Regards,
Prabakaran S
Marked as answer
SIGN IN To post a reply.
- 11 Replies
- 4 Participants
- Marked answer
-
NV NM van Strien
- Jun 29, 2020 10:37 AM UTC
- Apr 2, 2021 12:54 PM UTC