B
Bill McCormick
I have a TextBlock with the Text property set to do a Binding like so:
Text="{Binding CurrentTare}"
The DataContext is set in the Parent StackPanel container from the following:
SomeStackPanel.DataContext = _db.Trks.OrderBy(t => t.TrkId);
and Trks is defined as:
public System.Data.Linq.Table<Trk> Trks
and the CurrentTare property is as follows:
public partial class Trk : INotifyPropertyChanging, INotifyPropertyChanged
{
public double CurrentTare {
get {
var ctare = (from t in TTares
where (t.TTareDateTime) == (from r in TTares
select r.TTareDateTime).Max()
select t.TTareWeight).Single<double>();
return ctare;
}
}
}
I've tried several things with no success including:
_db.Refresh(RefreshMode.OverwriteCurrentValues, _db.TTares);
_db.Refresh(RefreshMode.OverwriteCurrentValues, _db.Trks);
trk.UpdateTare();
BindingExpression binding =
txtCurrentTare.GetBindingExpression(TextBlock.TextProperty);
binding.UpdateTarget();
binding.UpdateSource();
where trk.UpdateTare() is also from the Trk class:
public partial class Trk : INotifyPropertyChanging, INotifyPropertyChanged
{
public void UpdateTare() {
this.SendPropertyChanging();
this.TTares.Load();
this.SendPropertyChanged("TTares");
this.SendPropertyChanged("CurrentTare");
}
}
Ideas????
TIA, Bill
Text="{Binding CurrentTare}"
The DataContext is set in the Parent StackPanel container from the following:
SomeStackPanel.DataContext = _db.Trks.OrderBy(t => t.TrkId);
and Trks is defined as:
public System.Data.Linq.Table<Trk> Trks
and the CurrentTare property is as follows:
public partial class Trk : INotifyPropertyChanging, INotifyPropertyChanged
{
public double CurrentTare {
get {
var ctare = (from t in TTares
where (t.TTareDateTime) == (from r in TTares
select r.TTareDateTime).Max()
select t.TTareWeight).Single<double>();
return ctare;
}
}
}
I've tried several things with no success including:
_db.Refresh(RefreshMode.OverwriteCurrentValues, _db.TTares);
_db.Refresh(RefreshMode.OverwriteCurrentValues, _db.Trks);
trk.UpdateTare();
BindingExpression binding =
txtCurrentTare.GetBindingExpression(TextBlock.TextProperty);
binding.UpdateTarget();
binding.UpdateSource();
where trk.UpdateTare() is also from the Trk class:
public partial class Trk : INotifyPropertyChanging, INotifyPropertyChanged
{
public void UpdateTare() {
this.SendPropertyChanging();
this.TTares.Load();
this.SendPropertyChanged("TTares");
this.SendPropertyChanged("CurrentTare");
}
}
Ideas????
TIA, Bill