Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何删除plot oxyplot C#_C#_Wpf_Oxyplot - Fatal编程技术网

如何删除plot oxyplot C#

如何删除plot oxyplot C#,c#,wpf,oxyplot,C#,Wpf,Oxyplot,我有一个图表。当调用“OnClearAll”方法时,我希望这些图表消失/被删除 我想要这样的东西: private void OnClearAll() { HistoView.Clear(); } 然而,这并不清楚 我应该写什么来删除我的图表? 我的主面板xaml: <oxy:PlotView x:Name ="HistoView" Model="{Binding HistogramModel}" Margin="476,304,102,459"/> 我的直方图类:

我有一个图表。当调用“OnClearAll”方法时,我希望这些图表消失/被删除

我想要这样的东西:

private void OnClearAll()
{
    HistoView.Clear(); 
}
然而,这并不清楚

我应该写什么来删除我的图表?

我的主面板xaml:

<oxy:PlotView x:Name ="HistoView" Model="{Binding HistogramModel}" Margin="476,304,102,459"/>

我的直方图类:

namespace myNameSpace
{
    public class Histogram : INotifyPropertyChanged
    {
        //private Histogram DataContext;

        public Collection<Item> Items { get; set; }
        private PlotModel histogramModel;
        public PlotModel HistogramModel //{ get; set; }
        {
            get { return histogramModel; }
            set { histogramModel = value; OnPropertyChanged("HistogramModel"); }
        }

        public class Item
        {
            public string Label { get; set; }
            public double Value { get; set; }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        //NotifyPropertyChangedInvocator
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public Histogram(List<double> frequency, List<double> axis, string VariableName)
        {
            CreateRectangleBar(frequency, axis, VariableName);
        }
名称空间myNameSpace
{
公共类直方图:INotifyPropertyChanged
{
//私有直方图数据上下文;
公共集合项{get;set;}
私有PlotModel组织语法模型;
公共PlotModel Historogramodel/{get;set;}
{
获取{return historogramodel;}
set{historogramodel=value;OnPropertyChanged(“historogramodel”);}
}
公共类项目
{
公共字符串标签{get;set;}
公共双值{get;set;}
}
公共事件属性更改事件处理程序属性更改;
//NotifyPropertyChangedInvocator
受保护的虚拟void OnPropertyChanged(字符串propertyName)
{
PropertyChangedEventHandler处理程序=PropertyChanged;
if(处理程序!=null)
{
处理程序(这是新的PropertyChangedEventArgs(propertyName));
}
}
公共直方图(列表频率、列表轴、字符串变量名称)
{
CreateRectangleBar(频率、轴、变量名称);
}

尝试将
模型
数据上下文
属性设置为
null

private void OnClearAll()
{
    HistoView.DataContext = null; 
}