Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawing Axis Lines #38

Open
sgomez84 opened this issue Aug 23, 2024 · 3 comments
Open

Drawing Axis Lines #38

sgomez84 opened this issue Aug 23, 2024 · 3 comments

Comments

@sgomez84
Copy link

sgomez84 commented Aug 23, 2024

Hi,

I was wondering how I can add axis lines the X and Y lines with thicker stroke in the middle of the Canvas and stretching all the way to the edges. Also, I would like to make it not selectable.

image

Some light on this would be nice.

@mircea21S
Copy link
Owner

Hi,

Defining the stroke and thickness for those lines is up to you and your DataTemplate used for that Line.

To make them stretch all the way to the edges, you need to set the start position and the end position, to the ViewportRect property values. You can see how I draw lines in the RichCanvasDemo.

To make it not selectable, just set IsSelectable to false. Go through the Wiki on GitHub to find out more.

@sgomez84
Copy link
Author

sgomez84 commented Aug 28, 2024

Hi @mircea21S
Thank you for your suggestion, but I had done exactly that and I don't see the line across the viewport. Am I missing something?

The ViewportRect returns Infinity.

I added the line to RichItemsControlStyle.xaml in between the Canvas like this:

<!-- Horizontal Axis Line -->
<Line X1="0"
      Y1="{Binding Path=ViewPortRect.Height, Converter={StaticResource HeightToYConverter}}"
      X2="{Binding Path=ViewPortRect.Width}"
      Y2="{Binding Path=ViewPortRect.Height, Converter={StaticResource HeightToYConverter}}"
      Stroke="IndianRed"
      StrokeThickness="4"/>

Please help, thanks in advance.

@mircea21S
Copy link
Owner

Hi!

Well, what you're doing there is changing the library itself by modifying the RichItemsControlStyle.xaml.
If you want to do it this way, have a look at how the SelectionRectangle is added on the Canvas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants