Skip to content

Commit ea298db

Browse files
committed
Add info on adding a new page
1 parent 48605ff commit ea298db

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,15 @@ Signal-Windows kindly also displays the tsdevice string below the qrcode. Use `s
3838
If you want to backup your database files, `Libsignal.db` and `Signal.db`, you can find them in `C:\Users\<USERNAME>\AppData\Local\Packages\2383BenediktRadtke.SignalPrivateMessenger_teak1p7hcx9ga\LocalCache\`
3939

4040
On mobile these are found at `LocalAppData\2383BenediktRadtke.SignalPrivateMessenger_<VERSION>_arm__teak1p7hcx9ga\LocalCache\`
41+
42+
## Adding a New View
43+
44+
1. Add a new Blank Page in `Signal-Windows/Views`. For example NewPage.xaml.
45+
2. Add a new class in `Signal-Windows/ViewModels`. The name of the class should be the `ViewModel` appended to the page name. For example NewPageViewModel.cs.
46+
3. Inherit from `ViewModelBase` (namespace `GalaSoft.MvvmLight`) in the new view model class. For example `public class NewPageViewModel : ViewModelBase`
47+
4. Add a property for the new page in the new view model class. For example `public NewView View { get; set; }`
48+
5. In the new view code behind add a property for the new view model class. For example `public NewPageViewModel Vm { get { return (NewPageViewModel)DataContext; } }`
49+
6. In the new view code behind assign the view model `View` to the code behind class in the constructor. For example in the NewPage constructor add `Vm.View = this;` after `this.InitializeComponent();`
50+
7. In `Signal-Windows/ViewModels/ViewModelLocator.cs` register the new page view model in `SimpleIoc`. For example `SimpleIoc.Default.Register<NewPageViewModel>();`
51+
8. Add a property that returns an instance of the new page view model. For example `public NewPageViewModel NewPageInstance { get { return ServiceLocator.Current.GetInstance<NewPageViewModel>(Key.ToString()); } }`
52+
9. In the new page XAML set the DataContext of the page to the instance of the new page view model. This must be set in the Page opening tag. For example `DataContext="{Binding NewPageInstance, Source={StaticResource Locator}}"`

0 commit comments

Comments
 (0)