I’m having some issues updating a dependency property from a standard property.
If I set the property to null or update it with new data I was under the impression that it would reset the dependency property. However it looks as tho it just piles the new data on top.
Here’s a couple of properties / dependency properties I’m using:
Dependency Properties
public static readonly DependencyProperty DataTableChartProperty = DependencyProperty.Register
("DataTableChart", typeof(DataTable), typeof(MainWindowViewModel));
public static readonly DependencyProperty ContentElementProperty = DependencyProperty.Register
("ContentElement", typeof(FrameworkElement), typeof(MainWindowViewModel));
Standard Properties
public DataTable DataTableChart
{
get { return (DataTable)this.GetValue(DataTableChartProperty); }
set { this.SetValue(DataTableChartProperty, value); }
public FrameworkElement ContentElement
{
get { return (FrameworkElement)this.GetValue(ContentElementProperty); }
set { this.SetValue(ContentElementProperty, value); }
}
I would greatly appreciate any suggestions. Thanks in Advance!
This is how I’m setting it for now… for testing…
void _bw_DoWork(object sender, DoWorkEventArgs e)
{
var loadLog = new LoadLog();
e.Result = loadLog.LoadCaseLogs(SelectedFiles);
}
void _bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
DataTableChart = null;
ContentElement = null;
ContentElement = blah;
DataTableResult = e.Result as DataTable;
DataTableChart = caseData.LoadUserData(DataTableResult);
LoadingScreen = false;
}
public ChartControl blah = new ChartControl();
Dependency properties are cleared using the
ClearValuemethod, setting it tonullis just setting it tonull, which is not the same.