As part of a WPF presentation, I need a control like the mock up below to let a user:
- enter a variable number of percentages up to 100%
- know what the total of all entries are
- know what the balance is (100% – TotalEntered)
While this is obviously a pretty pedestrian requirement, I am at a loss as to how to implement it. It’s a one-off requirement, so it need not be a reuseable, although it would be nice if it could be. A pattern to allow separation and testability (ie, MVVM) would also be great.
I assume the existing DataGrid control is the right tool to go with, but maybe it’s overkill. Can someone suggest some starting implementation code or link to same?
Cheers,
Berryl

VM = “ViewModel” implementing
INotifyPropertyChanged.Create a
SharesVM and aShareVM (implementation removed for brevity).Use this article to see how to keep the
Linesequence in order.Bind
DataGrid ItemsSourcetoSharesViewModel Sharesproperty.(Ensure to validate percent inputs.
IDataErrorInfomay help.)