.agents/skills/change-sublist-to-observablecollection/SKILL.md
Converts List<T> sub-list properties in a master mente ViewModel to ObservableCollection<T> so that DataGrid row additions/deletions are properly notified to the View. Applies the ApplyFromCurrentEdit / SyncToCurrentEdit pattern used in ShukkaUriageInputViewModel.
npx skillsauth add sekiya-sato/obsolete-cvnet10 change-sublist-to-observablecollectionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
このスキルは、BaseMenteViewModel<T> を継承したマスターメンテ ViewModel で、CurrentEdit 内の List<T>? サブリストプロパティを ViewModel 側の ObservableCollection<T> に展開し、行の追加・削除がUIに正しく通知されるようにするパターンを提供します。WPF全体の共通規約は wpf-project-guide、画面単位の基本手順は wpf-view-workflow を前提とし、本スキルはサブリスト通知問題の解決に特化します。
List<T>? を持ち、Read-Only のため変更できないとき[ObservableProperty]
ObservableCollection<SubItemType> editSubItems = [];
[ObservableProperty] を付与し、View への変更通知を有効化edit + 元のプロパティ名(例: editJgenka)とし、生成されるプロパティ名は EditJgenka となるprotected override void OnCurrentEditChangedCore(T? oldValue, T newValue) {
if (newValue == null) return;
ApplySubListsFromCurrentEdit();
}
void ApplySubListsFromCurrentEdit() {
EditSubItems = new ObservableCollection<SubItemType>(
CurrentEdit.SubItems?.Select(Common.CloneObject) ?? []);
}
protected override object CreateInsertParam() {
SyncSubListsToCurrentEdit();
return base.CreateInsertParam();
}
protected override object CreateUpdateParam() {
SyncSubListsToCurrentEdit();
return base.CreateUpdateParam();
}
void SyncSubListsToCurrentEdit() {
CurrentEdit.SubItems = [.. EditSubItems];
}
CreateInsertParam() / CreateUpdateParam() を override[.. collection] (コレクション式)で List<T> に変換[RelayCommand]
void AddSubItem() {
EditSubItems.Add(new SubItemType());
}
[RelayCommand]
void DeleteSubItem() {
if (SelectedSubItem == null) return;
EditSubItems.Remove(SelectedSubItem);
SelectedSubItem = null;
}
CurrentEdit.SubItems ではなく EditSubItems(ObservableCollection)を操作<!-- Before -->
<DataGrid ItemsSource="{Binding CurrentEdit.SubItems}" ... />
<!-- After -->
<DataGrid ItemsSource="{Binding EditSubItems}" ... />
Cvnet10Wpfclient/ViewModels/06Uriage/ShukkaUriageInputViewModel.cs(ApplyDetailFromCurrent / SyncDetailToCurrent)Cvnet10Wpfclient/ViewModels/04Juchu/JuchuInputViewModel.csCvnet10Wpfclient/Helpers/ViewModels/BaseMenteViewModel.csCvnet10Wpfclient/ViewModels/01Master/MasterShohinMenteViewModel.csList<T>? プロパティ自体を ObservableCollection<T> に変えることはできないtools
Defines the standard workflow for creating or updating individual WPF Views and ViewModels in Cvnet10Wpfclient, including menu wiring and validation steps.
tools
Provides the shared Cvnet10Wpfclient project conventions, resource usage, BaseWindow rules, validation flow, and build checks required before any WPF-related work.
tools
Guides the agent through unifying the material-design inspired layout across master maintenance windows in Cvnet10Wpfclient.
tools
Guides opencode to save Windows clipboard images into WSL with `clipimg` and pass the resulting file path into prompts.