G
G
Georgy Kuznetsov2021-06-08 18:17:06
WPF
Georgy Kuznetsov, 2021-06-08 18:17:06

How to draw a graphic object on canvas without the help of events and other things?

I’ll make a reservation right away that reading the Microsoft documentation did not give any result, and Google gives out too outdated ways to draw something, for example, the very first question on stackoverflow contains clearly outdated information:
https://ru.stackoverflow.com/questions/794942/%D0 %...

In the "Canvas1.Children.Add" line, the Add method does not contain such an override that could accept an object of the Line class, it can only accept an object of the UIElement class, and I did not find any methods that would help draw anything in definition of this class

PS I ask you not to advise books and so on, given that even on the Internet, according to the very first results, it gives outdated methods for solving various issues - they will be of no use 0

PSS In the xaml file, there should be nothing but the canvas and the main window

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2021-06-09
@JoeSmith3100

Line inherits from UIElement, so you can safely pass it to Canvas1.Children.Add
https://social.msdn.microsoft.com/Forums/vstudio/e...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question