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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:48:26+00:00 2026-06-10T11:48:26+00:00

I have the following inside a user control called UserInputOutput : <ComboBox Grid.Column=1 Background=White

  • 0

I have the following inside a user control called UserInputOutput:

<ComboBox Grid.Column="1" Background="White" Visibility="{Binding InputEnumVisibility}"     
          FontSize="{Binding FontSizeValue}" Width="Auto" Padding="10,0,5,0"     
          ItemsSource="{Binding EnumItems}"     
          SelectedIndex="{Binding EnumSelectedIndex}"/>    

I have several bindings here which all work great except ItemsSource. Here is my Dependency Property and public variable.

public ObservableCollection<String> EnumItems
{
    get { return (ObservableCollection<String>)GetValue(EnumItemsProperty); }
    set { SetValue(EnumItemsProperty, value); }
}

public static readonly DependencyProperty EnumItemsProperty =
    DependencyProperty.Register("EnumItems", typeof(ObservableCollection<string>),typeof(UserInputOutput)

All the Bindings are set in XAML except the ComboBox’s ItemSource. This has to be set at runtime. In my code I use the following:

ObservableCollection<string> enumItems = new ObservableCollection<string>();
UserInputOutput.getEnumItems(enumItems, enumSelectedIndex, ui.ID, ui.SubmodeID);
instanceOfUserInputOutput.EnumItems = enumItems;

I run this code after the XAML is loaded from a file. The instaceOfUserInputOutput.EnumItems contains the correct items after I set it equal to enumItems, but it doesn’t show up in the combo box in my program.

Not sure where I’m going wrong here. Any thoughts?

Thank you!

  • 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-10T11:48:27+00:00Added an answer on June 10, 2026 at 11:48 am

    I assume your ViewModel class (the one that is used as a source of binding) implements INotifyPropertyChanged interface. Otherwise update won’t work.

    Then, in your setter method, do this:

    set
    {
         // set whatever internal properties you like
         ...
    
         // signal to bound view object which properties need to be refreshed
         OnPropertyChanged("EnumItems");
    }
    

    where OnProperyChanged method is like this:

    protected void OnPropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = this.PropertyChanged;
        if (handler != null)
        {
            var e = new PropertyChangedEventArgs(propertyName);
            handler(this, e);
        }
    }
    

    BTW, I don’t know why you need to declare EnumItems as a dependency property. Having it as a class field would work fine, unless you want to use it as a target for binding (right now it is used as a binding source).

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

Sidebar

Related Questions

I have the following XAML inside a 4 Row by 2 column grid. The
I have a user control that inside has a TextBlock (textmsg), the following is
I have the following XAML inside a user control: <UserControl.Resources> <ObjectDataProvider x:Key=DataSources ObjectInstance={x:Static data:Sql.SqlDataSourceEnumerator.Instance}
I have a couple of update panels inside a user control. One of the
I have created Custom User Control which contain TextBox and PasswordBox. it is binding
I have a custom user control DatePicker.cs. Inside of another piece of code I
I have the following as a custom user control: <UserControl x:Class=TestGUI.TBorder> <Border Style={StaticResource brdListBoxItem}>
I have button with custom content (a red circle) defined inside a user control
I have the following code in a MVC User Control (the field names have
I have the following code inside a partial view: @if (Request.IsAuthenticated) { Hello, @Html.ActionLink(User.Identity.Name,

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.