My DataGrid's values does not seem to update when the values in it is modified.
I have tried:
- Setting the Mode to
TwoWay
- Using
BindableCollection
(from Caliburn.Micro) - Using
ObservableCollection
- Using a
List
- Merging
QuotationViewModel
withTableViewModel
- Adding an item in
Work
and removing it - Using
x:Name="Work"
in the DataGrid instead of ItemsSource
TableViewModel.cs
public class TableViewModel : Screen
{
[ ... ]
public QuotationViewModel QuotationViewModel { get; set; }
public void Update()
{
NotifyOfPropertyChange(() => WoodTotal);
QuotationViewModel.Update();
}
}
TableView.xaml
<!--Total-->
<ContentControl Grid.Column="1"
cal:View.Model="{Binding Path=QuotationViewModel}"/>
QuotationViewModel.cs
public class QuotationViewModel : INotifyPropertyChanged
{
private readonly TableViewModel _tableViewModel;
public QuotationViewModel(TableViewModel tableViewModel)
{
_tableViewModel = tableViewModel;
}
public BindableCollection<ICanCalculate> Work { get; set; } = App.Config.Work;
public void Update()
{
QuotationRow.CalculateQuotations(_tableViewModel.WoodTotal);
OnPropertyChanged(nameof(Work));
}
}
QuotationView.xaml
<DataGrid ItemsSource="{Binding Path=Work, Mode=TwoWay}" />
Repository: https://github.com/hizamakura/Furniture
As seen in this gif, the value updates when I double click it, it should update without having to double click it. I know that the bindings are correct because when I update Value, say of Milling
to 0.20
, the Total
will change to 20%
that of the Mahogany.