借鉴OxyPlot wpf

时间:2015-04-27 08:35:53

标签: c# wpf oxyplot

我的点画有问题。当我开始在oxyplot画布上画线时没有任何反应。但是,当我开始超越氧气图的界限时,它起作用。为什么这么奇怪?如何解决这个问题?

function checkcar(){
    var u = _("carname").value;
    if(u != ""){
        _("carname").innerHTML = 'checking ...';
        var B = new XMLHttpRequest();
        B.open("POST","check.php",true); /
        B.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        B.onreadystatechange = function() {
            if(B.readyState==4 && B.status== 200) {
                _("carnamestatus").innerHTML = B.responseText;
            }
        }
        var v = "carnamecheck="+u;
        B.send(v);
    }
}
</script>

<Window x:Class="WpfApplication18DrawProblem.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"
    xmlns:lib="clr-namespace:DrawToolsLib;assembly=DrawToolsLib"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <Canvas  Name="paintSurface" MouseDown="Canvas_MouseDown_1" MouseMove="Canvas_MouseMove_1" Grid.Column="1" Background="Transparent">
    </Canvas>
    <oxy:Plot Model="{Binding PlotModel}" Controller="{Binding PlotController}" Height="300" Width="300" Background="Transparent" Grid.Column="0"></oxy:Plot>
</Grid>

enter image description here

1 个答案:

答案 0 :(得分:2)

XAML文件中元素的顺序在此处起作用。如果您将绘图区域放在Canvas区域的顶部/后面,则Canvas的该部分将被隐藏以供用户输入。

因此,在这种情况下最直接的解决方案是切换XAML文件中oxy:PlotCanvas元素的顺序:

...
<Grid>
  <oxy:Plot Model="{Binding PlotModel}" Controller="{Binding PlotController}" Height="300" Width="300" Background="Transparent" Grid.Column="0" />
  <Canvas Name="paintSurface" MouseDown="Canvas_MouseDown_1" MouseMove="Canvas_MouseMove_1" Grid.Column="1" Background="Transparent" />
</Grid>