Hi Kevin, I am really enjoying all your videos, I am a WPF fan. I was wondering if you would go over the topic of CRUD. In particular if you have an observablecollection (AllSuppliers) of a class (Suppliers) and a SelectedSupplier object. And then have a listbox of SupplierNames from AllSuppliers and a data entry grid for changing Supplier Details. As well as a SAVE button that is only valid when the SelectedSupplier SupplierName is not empty. I can follow your code for Rentopoly as far as you have gone but I cannot then modify it to notice the changing of a field within a different class (SelectedSupplier). Hope that makes sense and you have the time to demonstrate such an operation. Thanks in advance.
@@Kitokeboo Thank you. I have a solution up on GitHub (currently private) which I can share. It is well written (as I used your examples) but then it has gone sideways where I have tried to use my own methodology. let me know if you would like the repo to be made public? Thanks
Hi Kevin I have one more question. In your solution it is possible to bind data to View from another ViewModel ?? Because I wont to have ViewModel for some general operation which be common for whole Views.
So yes, but this is possibly a bit of a structural thing. The bindings are always evaluated for a given context. By default, this is the DataContext property (that is also inherited). So if you want to bind to a different view model, typically you then have to get that view model set as your DataContext or the DataContext of one of your parent controls. How to do this varies a little bit, but it is rare to not have any DataContext. Often there is one that is set at the Window that can be used to hold data that applies to all of the view. Then individual views get a more specific view model as their data context.
@@Kitokeboo Kevin it is possible to send my simple project with ViewModelLocator solution, and maybe you can check what is wrong there. Because datacontex works ok, but I have problem because i don't see my variables in View (but they works)
Hello, you have some excellent tutorials. I am updating some very old applications that have reports with Crystal Report and RDLC, but I have problems with these reports when updating them to versions of .NET 6.0 onwards. Can you give me an idea? I can't find any demo anywhere. Greetings and thanks.
It is a good question. However, I don't have a much experience with Crytal Reports. I know more newer stuff typically will do something like PowerBI instead, but unfortunately that doesn't help much with an upgrade situation.
Hi Kivin I have question for you. I try to build app like yours Demo App (templates). I installed whole required nuget packages, and I set up App.xaml , App.xaml.cs, etc. And I get an error CS0017 The program has more than one entry point defined. What can I do to fix this problem ??
This typically occurs in WPF apps because the App.xaml defaults to wanting to generate the Main method, but my template wants to define the Main method. Three key changes from my template: 1. Ensure the StartupUri is NOT set (this is set by the normal WPF template). github.com/Keboo/DotnetTemplates/blob/1c6d412585a234d4f1dceadce24e5606e46b40e7/templates/WPF/WpfApp/WpfApp/App.xaml#L5 2. In the csproj file make sure the the StartupObject is pointed at your App class. Typically this is your root namespace plus the name App unless you have renamed it. github.com/Keboo/DotnetTemplates/blob/1c6d412585a234d4f1dceadce24e5606e46b40e7/templates/WPF/WpfApp/WpfApp/WpfApp.csproj#L8 3. Most importantly, the App.xaml need to be removed at the ApplicationDefinition. This is the built-in setting that causes the App.xaml to generate a Main method. Here we see it removed from ApplicationDefinition item group, and then added into the Page item group instead. github.com/Keboo/DotnetTemplates/blob/1c6d412585a234d4f1dceadce24e5606e46b40e7/templates/WPF/WpfApp/WpfApp/WpfApp.csproj#L31-L35
Hi Kevin, I downloaded the source code and run it. What I noticed is some weakness?! I recon... When the user presses 2-3 times the 2nd and 3rd tab item, the one after the other (before the await Task.Delay(2_000); finishes) then the list of the rentals will be displayed 2 or 3 times respectively depending on how fast you press on the tab items. Is that because of a lack of a cancellation of the datagrid update when the displayed view is no more visible? Hope you get my point!! And how could we correct that? given that in your project its the delay causing the long procees but if for example a long list of rentals should be displayed then that could be confusing!! Thanks for the lovely example Kevin!!
Good catch, and your analysis of the issue is absolutely correct. Because of the Task.Delay and the async void Loaded inevent that is manually calling the command, it effectively queues up multiple loads and concatenates all of the results together. There are various ways to handle it, the simplest (and the change I just pushed) is to simply cancel the first load, and use the latest load request. Let me know if you have any questions on it.
I have it on my list to work on setting up a dotnet template similar to what my wpf temple looks like. So stay tuned, there will be some Maui content in the future