Current filter:
                                You should refresh the page.
                                  • Hello,

                                    I've started converting a large application from vb.NET to C#, but for some reason my equivalent MVVM framework isn't working as it did in VB.

                                    It isn't completely broken though, because when I call RaisePropertyChanged after updating a property, it is correctly reflected in the UI.
                                    The commands (dxmvvm:EventToCommand) aren't binding at all, and I get the following error at runtime, even if the command exists in the ViewModel:

                                    [C#]
                                    System.Windows.Data Error: 40 : BindingExpression path error: 'BOMImportProgressWindow_ClosingCommand' property not found on 'object' ''BOMImportViewModel' (HashCode=59140967)'. BindingExpression:Path=BOMImportProgressWindow_ClosingCommand; DataItem='BOMImportViewModel' (HashCode=59140967); target element is 'EventToCommand' (HashCode=38750844); target property is 'Command' (type 'ICommand')

                                    Maybe I've missed something in the conversion but can't find it.
                                    I attached a stripped down version of the app with only enough to replicate the issue and was hoping you'd be able to take a look.

                                    Thanks!
                                    Matt

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,

                                As described at Basics of Generating POCO View Models, it's necessary to use the ViewModelSource class to create a POCO ViewModel. So, you can use the following code in the App.OnStartup method:

                                [C#]
                                BVM = ViewModelSource.Create(() => new BOMImport.BOMImportViewModel { BOMImportProgressStatus = "Status is set BEFORE the Window is initiated!", });

                                Note that you need not derive a POCO ViewModel from the ViewModelBase class and explicitly implement INotifyPropertyChanged. I've attached the modified project. Let me know if you have additional questions.

                                • Matt Patenaude 10.10.2019

                                  I see what I did wrong. In VB the ViewModel was being created as the main Module was initialized, but in C# I'm not using a static class, so the initialize never called the .create() even though it existed in my VM.

                                  Thanks!!
                                  Matt

                                • André (DevExpress Support) 10.11.2019

                                  You're welcome!