0

I'm using OxyPlot in my application. I want to change the color of the rectangle when marking an area for zooming.

I just used Controller to bind the left mouse button to zoom:

ChartController = new PlotController(); 
ChartController.BindMouseDown(OxyMouseButton.Left,PlotCommands.ZoomRectangle);
Palle Due
  • 5,929
  • 4
  • 17
  • 32
  • could you please share your attempted code ? – Anu Viswan Apr 21 '19 at 05:51
  • I just used Controller to bind the left mouse button to zoom: ChartController = new PlotController(); ChartController.BindMouseDown( OxyMouseButton.Left,PlotCommands.ZoomRectangle); – Smadar Tsdaka Apr 22 '19 at 06:02
  • @Smadar Tsdaka: When adding code, please edit the question. Don't add it in a comment. That way it is more useful for others with the same problem. I fixed it for you. – Palle Due May 21 '19 at 07:45

1 Answers1

1

To Color the Zoom Rectangle in Oxyplot, you can customize the ZoomRectangleTemplate.

For Example,

<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>

This would provide you the desired output

enter image description here

Anu Viswan
  • 17,797
  • 2
  • 22
  • 51
  • @SmadarTsdaka Glad to help you, kindly mark it as answer it helped in resolving your issue, so that it would be helpful for others. – Anu Viswan Apr 28 '19 at 10:14