user1095239
user1095239

Reputation: 183

what should be the control/style used to repeat the same controls

I have some what complex UI requirement, need help in understanding type of control/style/template that can provide this support.Please find the screenshot attached. So, I have some couple of Textbox and Textblocks which gets repeated. How to repeat the controls using WPF?

enter image description here


Hello All, Need some more information about above scenario. Now I am able to accomplish the UI, but I have a list of values for each text box so how to accomplish this binding. For Ex: and my Itemcontrol is So, my ListStpTrade has List of Some values (I am attaching the value how it is holding). So I need to bind the Textbox of RuleName with the ListSTPTrade's Rulenameenter image description here

Upvotes: 1

Views: 268

Answers (2)

Reed Copsey
Reed Copsey

Reputation: 564471

This seems like a perfect scenario for a ListView.

You could bind it to the collection of items, set their ItemsTemplate as needed. In order to create alternating row colors, you can use AlternationIndex. See this post for details.

Upvotes: 1

devdigital
devdigital

Reputation: 34349

If each form represents an instance of the same type in a collection, then you can use an ItemsControl with a custom DataTemplate.

E.g.

<ItemsControl ItemsSource="{Binding MyItemsCollection}">
  <ItemsControl.ItemTemplate>
    <DataTemplate>
      <Grid>
        .. add grid columns/rows here, with TextBox, Label controls etc and Bindings
      </Grid>
    </DataTemplate>
  </ItemsControl.ItemTemplate>
</ItemsControl>

See here for more details.

Upvotes: 1

Related Questions