首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >OxyPlot PlotController

OxyPlot PlotController
EN

Stack Overflow用户
提问于 2015-04-13 08:41:24
回答 1查看 2.3K关注 0票数 2

我试图禁用自动摇摄右按钮。

代码语言:javascript
运行
复制
using OxyPlot;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using OxyPlot.Wpf;
using PlotController.Properties;
namespace PlotController
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
/// 
public class Chart
{
    private OxyPlot.Series.LineSeries LS;
    public PlotModel PlotModel {get;set;}
    public Chart()
    {
        Random rnd = new Random();
        PlotModel = new PlotModel();

        LS = new OxyPlot.Series.LineSeries();
        for (int i=0;i<100;i++)
        {
            LS.Points.Add(new DataPoint(i, rnd.Next(1,10)));
        }
        PlotModel.Series.Add(LS);
    }
}
public partial class MainWindow : Window
{
    Chart TChart;
    public MainWindow()
    {
        TChart = new Chart();
        OxyPlot.PlotController MyControl = new OxyPlot.PlotController();
        MyControl.UnbindAll();
        TestView = new PlotView();
        TestView.Model = TChart.PlotModel;
        TestView.Controller=MyControl;
        DataContext = TChart;

        InitializeComponent();
    }
}
}

和xaml **

代码语言:javascript
运行
复制
<Window x:Class="PlotController.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:oxy="http://oxyplot.org/wpf"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <oxy:PlotView Name="TestView"  Model="{Binding PlotModel}" DefaultTrackerTemplate="{x:Null}" ></oxy:PlotView>
</Grid>

在解除所有PlotCommand的绑定之后,它仍然是working.Why吗?如何可能禁用右按钮上的摇摄和左侧按钮上的启用?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-13 09:48:53

在您的MainWindow初始化代码中尝试这样做:

代码语言:javascript
运行
复制
TestView.ActualController.UnbindAll();

TestView是在XAML中定义的PlotView的名称。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29601173

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档