Posts

Showing posts with the label MVVM

Start template for Xaml MapControl

Image
 The Xaml.MapControl comes with a nice example that sow different options. This can be found in the examples directory at  https://github.com/ClemensFischer/XAML-Map-Control . This post is meant to show a more simple solution. And my hope is that I can use this as a start template. The goal is to end up with this view: And this is the steps to get this going: Create new project and setup  Create a new project in Visual Studio. When writing this I selected the tradistional .Net Framework 4.8. Then I installed the Map Control by the package manager console:      PM> Install-Package XAML.MapControl For this template I didn't use any MVVM Frameworks. This is to make less depentant on third-party solutions. I used the base MVVM template I wrote aboute in:  Absolute Mini MVVM .  Copy those two classes to the folder explained below.   Then I made the following folders in Visual Studio: Models Views ViewModels AbsoluteMiniMvvm Extensions For thi...

Absolute minimal MVVM

Since I have plans for showing some examples using WPF with MVVM, I thought it would be a good idea to post the code for a very basic MVVM template. This is so I don't have to rely on some advanced frameworks. And this way the examples can focus on the issue at hand. The files may be placed in a library and referenced by several projects, or they may be copied inside the project itself. The first class to be used is the base for handling INotifyPropertyChanged in the ViewModels and models: using System.ComponentModel; using System.Runtime.CompilerServices; namespace AbsoluteMiniMvvm { public class PropertyChangedBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public void RaisePropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } } The second is for the Command: namespace AbsoluteMiniMvvm { public class Command : ICommand { ...