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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:35:54+00:00 2026-05-14T18:35:54+00:00

If I have a property in my C#; public CollectionView Months { get {

  • 0

If I have a property in my C#;

    public CollectionView Months
    {
        get 
        {
            CollectionView retList = new Enumerations.Months().ToCollectionView<Enumerations.Months>();
            return retList;
        }
    }

And I have a ComboBox;

<ComboBox x:Name="ddlMonth" Grid.Row="3" Grid.Column="1" 
ItemsSource="{Binding Source={StaticResource Months}}"/>

How can I bind my ComboBox to my property?

I should add I’m a complete xaml newbie.

  • 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-14T18:35:54+00:00Added an answer on May 14, 2026 at 6:35 pm

    First up, that isn’t a method – it is a property.

    All you have to do is this:

    <ComboBox x:Name="ddlMonth" Grid.Row="3" Grid.Column="1" ItemsSource="{Binding Months}"/>
    

    The trick is to ensure that whatever class the property Months appears in is set as the DataContext of the ComboBox or one of its parents (including the Page).

    So if the Months property appears in the same page that hosts the ComboBox, then you can add this line of code in the constructor or Loaded event of the page:

    this.DataContext = this;
    

    If the Months property appears in a ViewModel (which i hope it does!) then you need to assign the ViewModel to the DataContext of the page (or a subsidiary control that is still a parent (ancestor) of the ComboBox).

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

Sidebar

Related Questions

I have a property public ObservableCollection<string> Name { get { return _nameCache; } }
Let's say I have a property: public Collection<T> GameCollection { get { return new
i have the following property declaration Public Property IsAreaSelected() As Integer Get Return If(ViewState(IsAreaSelected)
I have this property: public SubjectStatus Status { get { return status; } set
I have the following property: public double TotalHours { get { return (from session
I have a DataTable-Property: Public Property Files() As DataTable Implements Presenter.ISearchSetup.Files Get Return _files
Global variable m_xDoc I have a property of public XmlDocument xDoc { get {return
I have the following property public MyType MyProperty {get;set;} I want to change this
I have an automatic property public int GearCount { get; set; } when i
hi i have property named. public bool ShowLabels{get; set;} and one toolbar menu button

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.