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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:39:40+00:00 2026-05-31T02:39:40+00:00

I’m new to Prism, but I have successfully built several WPF/Mvvm-Light applications. I’m using

  • 0

I’m new to Prism, but I have successfully built several WPF/Mvvm-Light applications. I’m using ViewModel-first instaciation for each View/ViewModel pair. The views are all loaded and deactivated when the application opens. Views are activated as a result of catching an aggregate event aimed at them. This is the first view I’ve tried to bind to data in a ViewModel. The view displays as expected, except that my listbox is never populated. Only the outline of the listbox is visible. If I change the background color of the listbox, the color of the empty listbox is changed. The ViewModel property has eight rows but none of them are visible. I am able to display hardcoded items in the list box. I know that the view model is loading into the view as the data context, since another textblock is able to bind to a ViewModel property It must be something broken in my listbox xaml. Here is some xaml to review:

  <UserControl
     x:Class="DxStudioSelect.View.DxStudioFindView"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
     mc:Ignorable="d" 
  >
     <UserControl.Resources>
        <DataTemplate x:Key="DxStudioListTemplate">
           <TextBlock Text="{Binding Path=FriendlyForkName}"/>
        </DataTemplate>
     </UserControl.Resources>
     <Grid>
        <Grid.ColumnDefinitions>
           <ColumnDefinition Width="*"/>
           <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <ListBox
           Grid.Column="0"
           ItemsSource="{Binding DatabaseInstanceList}"
           ItemTemplate="{StaticResource DxStudioListTemplate}"
        />
        <TextBlock Text="{Binding Path=PageName}" Grid.Column="1" FontSize="32" Foreground="Green" TextAlignment="Right"/>
     </Grid>
  </UserControl>

Here is the code-behind:

  public partial class DxStudioFindView : UserControl, IDxStudioFindView {
     public DxStudioFindView() {
        InitializeComponent();
     }

     public IViewModel ViewModel {
        get { return (IDxStudioFindViewModel)DataContext; }
        set { DataContext = value; }
     }
  }

Here is the ViewModel:

  private readonly IEventAggregator _eventAggregator;
  private readonly IUnityContainer _unityContainer;
  private readonly IRegionManager _regionManager;
  private readonly string _dxStudioDatabaseName;
  private readonly HeaderUpdatePayload _headerUpdatePayload = new HeaderUpdatePayload("DxStudio", "Select DxStudio Instance");

  public DxStudioFindViewModel(IUnityContainer unityContainer, IRegionManager regionManager, IEventAggregator eventAggregator, IDxStudioFindView view)
     : base(view) {
     _unityContainer = unityContainer;
     _regionManager = regionManager;
     _eventAggregator = eventAggregator;
     View.ViewModel = this;

     if(IsInDesignMode) {

        //Design-time, so show fake data
        DesignTimeDataLoad();
     } else {

        //Run-time, so do the real stuff
        DesignTimeDataLoad();
        _dxStudioDatabaseName = LiteralString.DxStudioDatabaseNameTest;

        _eventAggregator.GetEvent<ViewChangeRequestEvent>().Subscribe(DxStudioInstanceChangeRequest, ThreadOption.UIThread, false, target => target.TargetView == LiteralString.DxStudioFind);
     }
  }


  public string PageName { get; set; }
  //public string PageName { get { return "Find DxStudio Instance"; } }

  private ObservableCollection<IDxStudioInstanceDto> _dxStudioInstanceList = null;
  public ObservableCollection<IDxStudioInstanceDto> DxStudioInstanceList {
     get { return _dxStudioInstanceList; }
     set {
        _dxStudioInstanceList = value;
        OnPropertyChanged("DxStudioInstanceList");
     }
  }

  private void DxStudioInstanceChangeRequest(ViewChangeRequestPayload payload) {
     var region = _regionManager.Regions[RegionNames.Content];
     region.Activate(View);

     _eventAggregator.GetEvent<ViewChangedHeaderEvent>().Publish(_headerUpdatePayload);

     var footerUpdatePayload = new FooterUpdatePayload(FooterDisplayMode.DxStudioSelect, _dxStudioDatabaseName, payload.TargetBackDatabase, payload.TargetBack, string.Empty, LiteralString.ToolboxStart);
     _eventAggregator.GetEvent<ViewChangedFooterEvent>().Publish(footerUpdatePayload);
  }

  private void DesignTimeDataLoad() {
     PageName = "Find DxStudio Instance";
     DxStudioInstanceList = new ObservableCollection<IDxStudioInstanceDto>() {
        new DxStudioInstanceDto("Instance1"),
        new DxStudioInstanceDto("Instance2"),
        new DxStudioInstanceDto("Instance3"),
        new DxStudioInstanceDto("Instance4"),
        new DxStudioInstanceDto("Instance5"),
        new DxStudioInstanceDto("Instance6"),
        new DxStudioInstanceDto("Instance7"),
        new DxStudioInstanceDto("Instance8"),
     };
  }

And here is the data transfer object:

public class DxStudioInstanceDto : IDxStudioInstanceDto {
  public string FriendlyForkName { get; private set; }

  public DxStudioInstanceDto(string friendlyForkName) { FriendlyForkName = friendlyForkName; }
}

Since I’m completely out of ideas, any suggestion would be helpful.
Thanks

  • 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-31T02:39:41+00:00Added an answer on May 31, 2026 at 2:39 am

    Your list is binding to ItemsSource="{Binding DatabaseInstanceList}" but your view model has the property DxStudioInstanceList.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.