Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8116361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:48:25+00:00 2026-06-06T03:48:25+00:00

I am working on a dynamic search view wherein clicking a button should add

  • 0

I am working on a dynamic search view wherein clicking a button should add a new row containing 3 combobox and 2 textboxes.

How should I go about doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:48:27+00:00Added an answer on June 6, 2026 at 3:48 am

    If you really want to do mvvm , try to forget “how can I add controls”. You don’t have to, just think about your viewmodels – WPF create the contols for you 🙂

    In your case lets say we have a SearchViewModel and a SearchEntryViewmodel.

    public class SearchEntryViewmodel
    {
        //Properties for Binding to Combobox and Textbox goes here
    }
    
    
    public class SearchViewModel 
    {
        public ObservableCollection<SearchEntryViewmodel> MySearchItems {get;set;}
        public ICommand AddSearchItem {get;}
    }
    

    Till now you dont have to think about usercontrols/view. In your SearchView you create an ItemsControl and bind the ItemsSource to MySearchItems.

    <ItemsControl ItemsSource="{Binding MySearchItems}"/> 
    

    You see now all of your SearchEntryViewmodels in the ItemsControl(just the ToString() atm).

    To fit your requirements to show every SearchEntryViewmodel with 3Comboboxes and so on you just have to define a DataTemplate in your Resources

    <DataTemplate DataType="{x:Type local:SearchEntryViewmodel}">
        <StackPanel Orientation="Horizontal">
            <Combobox ItemsSource="{Binding MyPropertyInSearchEntryViewmodel}"/>
            <!-- the other controls with bindings -->
        </StackPanel>
    </DataTemplate>
    

    That’s all 🙂 and you never have to think about “how can I add controls dynamically?”. You just have to add new SearchEntryViewmodel to your collection.

    This approach is called Viewmodel First and I think it’s the easiest way to do MVVM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working dynamic TableLayout that holds user data. Clicking an Add Event
I recently was working with some dynamic Search Expressions and ran into a bit
Pagination link not working on expression engine exp:search results.Page does not display the new
I am working on dynamic form. i have a radio button, if a user
I'm working with 7 dynamic dependent lists, and I thought the best way to
I'm working with a dynamic DOM here, and have called the jQuery UI datepicker
We're working in a Dynamic Data project that will handle entities coming from two
I am working on a dynamic bingo game that randomly generates the number in
I am working on a dynamic report where charts need to be recreated on
I have been working on a dynamic page http://www.euroworker.no/order and I want my lovely

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.