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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:46:58+00:00 2026-06-08T14:46:58+00:00

I have a databound combo box that lists Financial Years. The user selects a

  • 0

I have a databound combo box that lists Financial Years. The user selects a value from this combo and a value from a ‘Client’ combo box which then selects that client’s report for that financial year for processing by the user. Although processing a historical document is possible, the default use case is to process a report from the just finished financial year, so I would like to set the Combo box to default to (currently) 2011/2012 which is a string property of the FinancialYear entity.

My xaml:

<ComboBox Canvas.Left="353" 
          Canvas.Top="18" 
          Height="23" 
          Name="cboFinancialYear"
          Width="120" 
          DisplayMemberPath="FinancialYear1" 
          ItemsSource="{Binding}" 
SelectedValuePath="FinancialYearID" />;

The Window_Loaded method in my code behind:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    String thisYear = MainViewModel.GetCurrentFinancialYear();
    lGFinanceEntities = new LGFinanceEntities();
    // Load data into FinancialYears. You can modify this code as needed.
    CollectionViewSource financialYearsViewSource = ((CollectionViewSource)(this.FindResource("financialYearsViewSource")));
    ObjectQuery<FinancialYear> financialYearsQuery = this.GetFinancialYearsQuery(lGFananceEntities);
     financialYearsViewSource.Source = financialYearsQuery.Execute(System.Data.Objects.MergeOption.AppendOnly);
     cboFinancialYear.SelectedItem = thisYear;
}

However this doesn’t seem to have any effect, and the selected item in the combo box is the first year in the FinancialYear table.

Can anybody point out what I’ve done wrong? I’ve looked around, but most of the default value implementations in combo boxes seem to be of the ‘Select a year’ sort as instruction text, whereas I want to actually select a default value.

  • 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-08T14:47:00+00:00Added an answer on June 8, 2026 at 2:47 pm

    SelectedItem has a reference to an object of the ItemsSource. You cannot set SelectedItem to a string if your ItemsSource is of IEnumerable<FinancialYear> type.

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

Sidebar

Related Questions

I have a databound dgv that contains combobox columns. When the user selects an
I have a combobox databound to the available system colors. When the user selects
I've got a Combo Box that is databound to an ObservableCollection of items. I
Mildly confused. I have a combobox that is databound to a list of strings.
I have a ComboBox that is databound to an ObservableCollection of strings . The
I have a databound listbox which is actually displaying two columns of data. It
I have a databound listbox on my C# WinForm that holds strings that are
I have a XAML MenuItem DataBound ItemsSource that is working fine however there is
I have a GridView which is databound to an XML Datasource. For one of
Setup: I have a combo-box, it's itemsource bound to an ObservableCollection<T> of a custom

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.