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 397775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:40:59+00:00 2026-05-12T16:40:59+00:00

How can I select a view for my viewmodel without using code behind? I

  • 0

How can I select a view for my viewmodel without using code behind? I want to load a ListBox with a lot of data coming from a WCF call. Using Josh Smith’s app, the view loads before the data arrives, empty. I want to receive all the data and then select the view with spinner showing progress.

// Completed Method
void _backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
    DataTemplate dataTemplate = new DataTemplate();
    //Leaderboards_All_View lb_all_view = new Leaderboards_All_View();
    CollectionViewSource collViewSrc = new CollectionViewSource();
    dataTemplate.DataType = "Leaderboards_All_View";
    List<Leaderboards_All> leaderboardList = e.Result as List<Leaderboards_All>;

    allViewModel =
    (from lbData in leaderboardList
     select new LB_Data_All_ViewModel(lbData, lb_All_ViewModel)).ToList();

    foreach (LB_Data_All_ViewModel avm in allViewModel)
    avm.PropertyChanged += this.OnLB_Data_All_ViewModelPropertyChanged;

    this.AllViewModel = new ObservableCollection<LB_Data_All_ViewModel>(allViewModel);
    this.AllViewModel.CollectionChanged += this.OnCollectionChanged;
    collViewSrc.Source = AllViewModel;
    lb_all_view.DataContext = collViewSrc;
}
  • 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-05-12T16:41:00+00:00Added an answer on May 12, 2026 at 4:41 pm

    — How can I select a view for my viewmodel without using code behind?

    Define your DataTemplates in xaml (probably in a ResourceDictionary, or in the Resources of the View, like (assuming you have declared ‘vm’, the namespace containing your ViewModels and ‘vw’, the namespace containing your Views):

    <DataTemplate DataType="{x:Type vm:LB_Data_All_ViewModel}">
      <vw:LB_Data_All_View />
    </DataTemplate>
    

    HTH 🙂

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

Sidebar

Ask A Question

Stats

  • Questions 288k
  • Answers 288k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You should use "r" for opening text files. Different operating… May 13, 2026 at 5:17 pm
  • Editorial Team
    Editorial Team added an answer You can you simple tools like uniq. See kobi's example… May 13, 2026 at 5:17 pm
  • Editorial Team
    Editorial Team added an answer Using your own Future implemenation: public class BazComputationFuture implements Future<Baz>,… May 13, 2026 at 5:17 pm

Related Questions

I'm working on a WPF application and is using the Model-View-ViewModel pattern. The application
I am starting to write an application in Silverlight with RIA services and SilverlightFx.
I am trying to understand something a bit better with being new to C#,
How can the following be accomplished in Magento? Display a Hello World message using

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.