Fixed totaling of CoinCollection's value.
This commit is contained in:
1 parent
93219aaf9b
commit
24a9a2b71e
2 files changed
+8
-4
No files matched your search
@@ -116,10 +116,14 @@ public class MainWindowViewModel : ViewModelBase {
|
||||
// TODO Clear the text boxes.
|
||||
});
|
||||
|
||||
// Change TotalValue anytime SelectedCoin.TotalPrice changes.
|
||||
// TODO: fix this. Should update when a coin within the collection is changed.
|
||||
// Possible null deref - how do you remove this?
|
||||
// Update TotalValue anytime a coin's quantity changes.
|
||||
// Possible null reference is currently ignored - SelectedCoin will never be null.
|
||||
this.WhenAnyValue(x => x.SelectedCoin.TotalPrice)
|
||||
.Subscribe(_ => TotalValue = ConnectedCoinDatabase.Collection.Sum(x => x.TotalPrice));
|
||||
|
||||
// Update TotalValue anytime a coin is added or removed.
|
||||
ConnectedCoinDatabase.Collection.CollectionChanged += (sender, args) => {
|
||||
TotalValue = ConnectedCoinDatabase.Collection.Sum(x => x.TotalPrice);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@
|
||||
Binding="{Binding Designation}"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Est. Price" Width="*"
|
||||
Binding="{Binding PriceGuideValue}"
|
||||
Binding="{Binding PriceGuideValue, StringFormat='${0:0.00}'}"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="PCGS #" Width="*"
|
||||
Binding="{Binding PCGSNo}"
|
||||
|
||||
Reference in new issue
Block a user