Jot icon indicating copy to clipboard operation
Jot copied to clipboard

Setup for Caliburn.Micro and WPF without a code behind.

Open lorinkundert opened this issue 3 years ago • 1 comments

I have been using Jot a long time and have always loved it, now I have been tasked with converting everything to WPF and removing all write behind code and instead using a viewmodel. I have not been able to find a way to make jot work with this, Is it even possible? another change is Net core.

lorinkundert avatar Aug 04 '21 05:08 lorinkundert

@lorinkundert Although this is quite an old issue, I've decided to help anyone who comes to this issue in the future. Yes, it is possible to use this library with the MVVM framework, I've tested it with Caliburn.Micro and Stylet.

An example of the app which uses .NET Core 3.1 + WPF MVVM (Caliburn.Micro): https://github.com/Coke21/GTA-Mission-Downloader/blob/master/GTAMissionDownloader/ViewModels/MainViewModel.cs#L115

Persistence class: https://github.com/Coke21/GTA-Mission-Downloader/blob/0f58c1db12601b8e6419016a876c0253b8cbc3ec/GTAMissionDownloader/Classes/Persistence.cs#L5

You can just put the above in your constructor: Tracker tracker = new();

It's one of the app which I've created in the past. So basically put Jot stuff in the constructor (in your ViewModel), make the stuff that you want to save as properties and it should do the job.

Just don't use Caliburn.Micro or Stylet's Screen in your Model since it seems to be bugged (implement your own INotifyPropertyChanged), see this issue: https://github.com/anakic/Jot/issues/39

Coke21 avatar Nov 30 '21 22:11 Coke21