P
P
PETROPALOVSK2014-05-04 18:05:00
WPF
PETROPALOVSK, 2014-05-04 18:05:00

How to add XAML elements via C# to WPF

There is a WPF page and a tag tree in it. I'm taking the image link URLs from the database and I have to turn those links into images that I have to insert into the StackPanel. How do I insert the created Image objects into the StackPanel in C# code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexP11223, 2014-05-04
@PETROPALOVSK

<StackPanel Name="stackPanel"/>

TextBox tbox = new TextBox();
tbox.Text = "Hello";
stackPanel.Children.Add(tbox);

As for creating pictures, there seem to be some slight difficulties, but Google and stackoverflow will save you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question