From 1277a0e982e5c9f6aca7379d70c4d719ff77ab20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gabriel=2Ehuot-v=C3=A9zina?= Date: Thu, 20 Jun 2024 13:36:41 -0400 Subject: [PATCH] #354 fixed not updatable project type in field book. --- GSCFieldApp/ViewModels/FieldBookDialogViewModel.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/GSCFieldApp/ViewModels/FieldBookDialogViewModel.cs b/GSCFieldApp/ViewModels/FieldBookDialogViewModel.cs index 79b5839c..0325ef82 100644 --- a/GSCFieldApp/ViewModels/FieldBookDialogViewModel.cs +++ b/GSCFieldApp/ViewModels/FieldBookDialogViewModel.cs @@ -4,6 +4,7 @@ using SQLite; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Threading.Tasks; using Template10.Common; using Template10.Mvvm; @@ -22,7 +23,7 @@ public class FieldBookDialogViewModel : ViewModelBase public FieldBooks existingUserDetail; //UI - private List _projectType = new List(); + private ObservableCollection _projectType = new ObservableCollection(); private string _selectedProjectType = string.Empty; private string _startStationNumber = "1"; private string _projectName = string.Empty; @@ -119,7 +120,7 @@ public string StartStationNumber public string ActivityName { get { return _activityName; } set { _activityName = value; } } public string Notes { get { return _notes; } set { _notes = value; } } - public List ProjectType { get { return _projectType; } set { _projectType = value; } } + public ObservableCollection ProjectType { get { return _projectType; } set { _projectType = value; } } public string SelectedProjectType { get { return _selectedProjectType; } set { _selectedProjectType = value; } } public bool Enability { get { return _enability; } set { _enability = value; } } @@ -141,7 +142,10 @@ private void FillProjectType() //Init. string fieldName = Dictionaries.DatabaseLiterals.FieldUserInfoFWorkType; - _projectType = accessData.GetComboboxListWithVocab(userTable, fieldName, out _selectedProjectType); + foreach (var pType in accessData.GetComboboxListWithVocab(userTable, fieldName, out _selectedProjectType)) + { + _projectType.Add(pType); + } //Update UI RaisePropertyChanged("ProjectType"); @@ -259,6 +263,7 @@ public void AutoFillDialog(FieldBooks incomingData) RaisePropertyChanged("GeologistLN"); RaisePropertyChanged("Notes"); RaisePropertyChanged("ActivityName"); + RaisePropertyChanged("SelectedProjectType"); }