R
R
Rustam Khalilov2017-02-12 17:08:41
WPF
Rustam Khalilov, 2017-02-12 17:08:41

WPF. How to position a TextBlock element with the text 'text' in the C# code with indent from the edge 'x' and 'y'?

There is a Path element. There is a certain GeometryGroup in which the graph is drawn.
There is a certain TextBlock (an array with the names of the vertices).
Question. How to set text in a TextBlock and position it at certain coordinates (above vertices, for example (vertex coordinates are known)) from C# code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavlo Barmak, 2017-02-13
@konversys

something like this

var graph = new GeometryGroup();
var text = new FormattedText("12345",
        CultureInfo.CurrentCulture,
        FlowDirection.LeftToRight,
        new Typeface("Verdana"),
        32,
        Brushes.Black);
graph.Children.Add(text.BuildGeometry(new Point(5, 5));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question