2

I want to dynamically generate a form in WPF. I would like to do it using XAML not from the code behind(Which I am currently doing.).

If I have a data template like below, What is the parent controller that I can use for this.(Like we use Listbox)

I have dataTemplate like below

<DataTemplate x:Key="FieldTemlate">
       <TextBlock HorizontalAlignment="Left"  VerticalAlignment="Top" />
       <TextBox  VerticalAlignment="Top"  Width="40" />
</DataTemplate>
2
  • What is your sorrounding XAML ? Do you want this control to repeat based on some bindings? Commented Jan 18, 2013 at 8:57
  • 1
    Yes. I have a List of my custom objects which has information about the field need to be in the form. I want to bind that list. Commented Jan 18, 2013 at 8:59

1 Answer 1

3

ItemsControl is what you need.

Here you can find an example.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.