Wpf 更改缩放矩形的颜色

Wpf 更改缩放矩形的颜色,wpf,oxyplot,Wpf,Oxyplot,我在应用程序中使用OxyPlot。我想在标记要缩放的区域时更改矩形的颜色 我刚刚使用控制器将鼠标左键绑定到缩放: ChartController = new PlotController(); ChartController.BindMouseDown(OxyMouseButton.Left,PlotCommands.ZoomRectangle); 要在Oxyplot中为缩放矩形着色,可以自定义ZoomRectangleTemplate 比如说, <oxy:PlotView Model

我在应用程序中使用OxyPlot。我想在标记要缩放的区域时更改矩形的颜色


我刚刚使用控制器将鼠标左键绑定到缩放:

ChartController = new PlotController(); 
ChartController.BindMouseDown(OxyMouseButton.Left,PlotCommands.ZoomRectangle);

要在Oxyplot中为缩放矩形着色,可以自定义ZoomRectangleTemplate

比如说,

<oxy:PlotView Model="{Binding MyModel}" Controller="{Binding ChartController,UpdateSourceTrigger=PropertyChanged}">
        <oxy:PlotView.ZoomRectangleTemplate>
            <ControlTemplate>
                <Border BorderBrush="Black" BorderThickness="1">
                    <Rectangle Fill="Orange" />
                </Border>
            </ControlTemplate>
        </oxy:PlotView.ZoomRectangleTemplate>
</oxy:PlotView>

这将为您提供所需的输出


您可以分享您尝试的代码吗?我刚刚使用Controller将鼠标左键绑定到缩放:ChartController=new PlotController();ChartController.BindMouseDown(OxyMouseButton.Left,PlotCommands.ZoomRectangle)@Smadar Tsdaka:添加代码时,请编辑问题。不要在评论中添加它。这样对其他有同样问题的人更有用。“我帮你修好了。”SmadarTsdaka很高兴能帮助你,请将它标记为有助于解决你的问题的答案,以便对其他人有所帮助。