@@ -53,6 +53,11 @@ namespace BasicRdl.ViewModels
5353 [ ThingDialogViewModelExport ( ClassKind . Category ) ]
5454 public class CategoryDialogViewModel : CDP4CommonView . CategoryDialogViewModel , IThingDialogViewModel
5555 {
56+ /// <summary>
57+ /// The backing field for <see cref="IsPermissibleClassListEmpty"/>
58+ /// </summary>
59+ private bool isPermissibleClassListEmpty ;
60+
5661 /// <summary>
5762 /// Initializes a new instance of the <see cref="CategoryDialogViewModel"/> class.
5863 /// </summary>
@@ -95,6 +100,7 @@ public CategoryDialogViewModel(Category category, IThingTransaction transaction,
95100 : base ( category , transaction , session , isRoot , dialogKind , thingDialogNavigationService , container , chainOfContainers )
96101 {
97102 this . WhenAnyValue ( vm => vm . PermissibleClass ) . Subscribe ( _ => this . UpdateOkCanExecute ( ) ) ;
103+ this . PermissibleClass . CountChanged . Subscribe ( _ => this . UpdateOkCanExecute ( ) ) ;
98104 this . WhenAnyValue ( vm => vm . Container ) . Subscribe ( _ => this . PopulateSuperCategory ( ) ) ;
99105 }
100106
@@ -108,6 +114,16 @@ public CategoryDialogViewModel(Category category, IThingTransaction transaction,
108114 /// </summary>
109115 public ReactiveList < Category > PossibleSuperCategories { get ; set ; }
110116
117+ /// <summary>
118+ /// Gets a value indicating whether no <see cref="ClassKind"/> has been selected as permissible class yet. When <c>true</c>
119+ /// the dialog shows guidance that at least one permissible class must be selected on the "Permissible Classes" tab before saving.
120+ /// </summary>
121+ public bool IsPermissibleClassListEmpty
122+ {
123+ get => this . isPermissibleClassListEmpty ;
124+ private set => this . RaiseAndSetIfChanged ( ref this . isPermissibleClassListEmpty , value ) ;
125+ }
126+
111127 /// <summary>
112128 /// Initializes the list of this dialog
113129 /// </summary>
@@ -162,6 +178,7 @@ protected override void PopulateSuperCategory()
162178 protected override void UpdateOkCanExecute ( )
163179 {
164180 base . UpdateOkCanExecute ( ) ;
181+ this . IsPermissibleClassListEmpty = ! this . PermissibleClass . Any ( ) ;
165182 this . OkCanExecute = this . OkCanExecute && this . PermissibleClass . Any ( ) ;
166183 }
167184
0 commit comments