change-sublist-to-observablecollection

Convert ViewModel sublists from List<T> to ObservableCollection<T> for UI-bound updates.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/sekiya-sato/obsolete-cvnet10 --skill change-sublist-to-observablecollection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: change-sublist-to-observablecollection
Source: https://github.com/sekiya-sato/obsolete-cvnet10/tree/main/.agents/skills/change-sublist-to-observablecollection
Command: npx skills add https://github.com/sekiya-sato/obsolete-cvnet10 --skill change-sublist-to-observablecollection

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

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.

Core Features & Use Cases

  • Add an ObservableCollection field for sublists and expose an accompanying Edit* property for UI binding.
  • Expand sublists from CurrentEdit on changes and clone items to enable safe editing without mutating the original data.
  • Sync back to the List<T> before persisting (insert/update) to preserve data shape and support cancel/commit behavior.
  • Bind the DataGrid to the ObservableCollection (EditSubItems) to ensure UI updates reflect additions and deletions immediately.

Quick Start

Bind the DataGrid to EditSubItems, and expose AddSubItem/DeleteSubItem commands to modify the collection; ensure CurrentEdit changes are mirrored into the observable list for UI notifications.

Frequently Asked Questions about change-sublist-to-observablecollection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my WPF DataGrid not update the UI when adding or removing items from a sublist?

WPF DataGrid requires ObservableCollection<T> for sublist properties to receive automatic UI notifications. Standard List<T> lacks change notification events, so additions and deletions are not reflected in the View until manually refreshed.

How do I convert a List<T> sublist to ObservableCollection<T> in an MVVM master ViewModel?

Add an ObservableCollection field for sublists and expose an Edit property for UI binding. Expand sublists from CurrentEdit on changes, cloning items to enable safe editing without mutating the original data.

How do I preserve the original List<T> data shape when using ObservableCollection for UI binding?

Apply a pre-save SyncBack to List<T> before insert or update operations. This preserves the underlying data shape and supports cancel/commit behavior while keeping the observable collection bound to the UI.

Can I bind a DataGrid directly to an ObservableCollection sublist while editing?

Yes, bind the DataGrid to the EditSubItems ObservableCollection to ensure UI updates reflect additions and deletions immediately. Expose AddSubItem and DeleteSubItem commands to modify the collection safely.

When do I need to apply the Expand-From-CurrentEdit pattern in WPF MVVM?

Use the Expand-From-CurrentEdit pattern when you need DataGrid row additions and deletions properly notified to the View while keeping original data intact. It mirrors CurrentEdit changes into the observable list for UI notifications.

Does converting sublists to ObservableCollection affect my existing save or update logic?

No, the conversion requires a pre-save SyncBack to List<T> before insert or update operations. This ensures the original data shape remains intact for persistence while the ObservableCollection handles UI-bound updates.