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

  • Home
  • SEARCH
  • 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 9192875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:02:14+00:00 2026-06-17T21:02:14+00:00

I have a simple project with domain service and I am trying to binding

  • 0

I have a simple project with domain service and I am trying to binding combox with domain service from my view model.

I am using mvvm design pattern, note that when I am not using mvvm design pattern and I am binding the combox from code behind I see the results on the combox.

enter code here


public class MainViewModel:INotifyPropertyChanged
{
    DomainService1 ctx = new DomainService1();
    private ObservableCollection<product> _products;
    public ObservableCollection<product> Products
    {

        get { return _products; }
        set {

            if (value != _products)
            {
                _products = value;
                OnPropertyChanged("Products");
            }
        }
    }

    public MainViewModel()
    {
        if (!DesignerProperties.IsInDesignTool)
        {
            LoadProdcuts();
        }
    }

    private void LoadProdcuts()
    {
        ctx.Load(ctx.GetProductsQuery(), LoadProdcutCallBack, null);
    }
    private void LoadProdcutCallBack(LoadOperation<product>lo)
    {
        _products = new ObservableCollection<product>(lo.Entities);
    }


    private void OnPropertyChanged(string propName)
    {
        if (this.PropertyChanged != null)
        {
            this.PropertyChanged(this, new PropertyChangedEventArgs(propName));
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;
}
enter code here

<UserControl.Resources>
    <data:MainViewModel x:Key="VwModel"/>
</UserControl.Resources>


    <ComboBox HorizontalAlignment="Left"  VerticalAlignment="Top" Height="30" Width="100" ItemsSource="{Binding Products}"/>
  • 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-17T21:02:15+00:00Added an answer on June 17, 2026 at 9:02 pm

    You must set DataContext property:

    <ComboBox HorizontalAlignment="Left"  VerticalAlignment="Top" Height="30" Width="100" 
                          DataContext="{StaticResource VwModel}"
                          ItemsSource="{Binding Products}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple java project (adapted from the example here ), which is
In my simple project I have 2 views - a line item view (Brand)
I have the following situation: A project MyCompany.MyProject.Domain which contains my domain model, and
I have created a simple java web (Vaadin) application project using JPA and it
I have created a very simple window service using visual studio 2010 and .NُET
This is an ASP.NET MVC website. Following domain driven design, we have a service
I have my GWT project, and another project that just has simple Domain Objects,
I'd like to try out the D programming language. I have simple pet project
I have a simple Scala project that runs without any problems inside Eclipse, however,
I have this simple test project just to test the IncludeExceptionDetailInFaults behavior. public class

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.