Commit f1b669ed authored by 潘栩锋's avatar 潘栩锋 🚴

修复 AxisSection.Remove 出错。 当从来没有Load事件时,根本就没执行 AxisSection.AsCoreElement, 也就没有 Model. 不需要Remove

parent 46f822fe
......@@ -391,6 +391,9 @@ namespace LiveCharts.Wpf
/// </summary>
public void Remove()
{
if (Model == null)
return;//没有进入Load事件,没有Model
Model.Chart.View.RemoveFromDrawMargin(_label);
Model.Chart.View.RemoveFromView(_label);
Model.Chart.View.RemoveFromDrawMargin(_rectangle);
......@@ -405,7 +408,10 @@ namespace LiveCharts.Wpf
/// <returns></returns>
public AxisSectionCore AsCoreElement(AxisCore axis, AxisOrientation source)
{
//Load 事件,构建 Model
var model = new AxisSectionCore(this, axis.Chart);
//model.View 就是 这个 this (AxisSection)
model.View.Model = model;
return model;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment