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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:33:58+00:00 2026-05-11T06:33:58+00:00

I have a ListBox on a form that is bound to an ObservableCollection of

  • 0

I have a ListBox on a form that is bound to an ObservableCollection of a custom type. Within each item there is a ComboBox bound to an enumeration type. When the window loads, all ComboBoxes are defaulted to a certain value. When I change the SelectedItem for any one (from the UI, not from code), all other ComboBoxes change to the same SelectedItem.

I’m not sure what I’ve done wrong, here is my current XAML that is handling this.

<Window.Resources>     <ObjectDataProvider x:Key='SyncOperationValues'                         MethodName='GetNames'                         ObjectType='{x:Type sys:Enum}'>         <ObjectDataProvider.MethodParameters>             <x:Type TypeName='local:SyncOperationEnum' />         </ObjectDataProvider.MethodParameters>     </ObjectDataProvider> ...     <DataTemplate x:Key='SyncListTemplate'>         <Grid Grid.Column='1' Grid.RowSpan='2' Margin='0,0,20,0' x:Name='olDetails'             DataContext='{Binding Path=OlContact}'>             <Grid.RowDefinitions>                 <RowDefinition />                 <RowDefinition />                 <RowDefinition />                 <RowDefinition />                 <RowDefinition />                 <RowDefinition />             <RowDefinition />             </Grid.RowDefinitions> ...             <ComboBox x:Name='SyncOp'                  Width='120' Height='19'                 Margin='4,0,10,0'                  IsSynchronizedWithCurrentItem='True'                  ItemsSource='{Binding Source={StaticResource SyncOperationValues}}'                              SelectedItem='{Binding Operation}'                              VerticalAlignment='Center' />  ... 

and the ListBox:

 <ListBox x:Name='SyncList'      ScrollViewer.HorizontalScrollBarVisibility='Hidden'      ItemContainerStyle='{StaticResource StretchedContainerStyle}'      ItemTemplate='{StaticResource SyncListTemplate}'>  ListBox> 

I have tried some different options, like binding to a CollectionView; however nothing seems to work. Can anyone point me to my mistake?

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. 2026-05-11T06:33:58+00:00Added an answer on May 11, 2026 at 6:33 am

    I have finally found a solution. I ended up writing a ValueConverter for the enumeration type. I’d been under the impression that this was not necessary, but for some reason it is, at least if the ComboBox is within another list (ListBox in my case) of some sort.

    I did need to set the IsSynchronizedWithCurrentItem property to false as John M suggested, so thanks to John for that! Here is the converter code in case anyone else needs to do something like this.

    [ValueConversion( typeof( SyncOperationEnum ), typeof( String ) )] public class SyncOperationConverter : IValueConverter {     #region IValueConverter Members      public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) {         if( value != null && value.GetType() == typeof( SyncOperationEnum ) )             return Enum.GetName( typeof( SyncOperationEnum ), value );          return null;     }      public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) {         if( value != null && targetType == typeof( SyncOperationEnum ) )             foreach( object enumValue in Enum.GetValues( targetType ) )                 if( value.Equals( Enum.GetName( targetType, enumValue ) ) )                     return enumValue;          return null;     }      #endregion 

    And my XAML now looks like this:

    <Window.Resources>     <local:SyncOperationConverter x:Key='SyncConverter' />      <ObjectDataProvider x:Key='SyncOperationValues'                     MethodName='GetNames'                     ObjectType='{x:Type sys:Enum}'>         <ObjectDataProvider.MethodParameters>             <x:Type TypeName='local:SyncOperationEnum' />         </ObjectDataProvider.MethodParameters>     </ObjectDataProvider> ... <DataTemplate x:Key='SyncListTemplate'>     <Grid Grid.Column='1' Grid.RowSpan='2' Margin='0,0,20,0' x:Name='olDetails'         DataContext='{Binding Path=OlContact}'>         <Grid.RowDefinitions>             <RowDefinition />             <RowDefinition />             <RowDefinition />             <RowDefinition />             <RowDefinition />             <RowDefinition />         <RowDefinition />         </Grid.RowDefinitions> ...         <ComboBox x:Name='SyncOp'              Width='120' Height='19'             Margin='4,0,10,0'              IsSynchronizedWithCurrentItem='False'              ItemsSource='{Binding Source={StaticResource SyncOperationValues}}'             SelectedValue='{Binding Path=Operation,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource SyncConverter}}'             VerticalAlignment='Center' /> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this ListBox which is bound to an ObservableCollection. Each object in the
I have a ListBox that when in focus, and when I have an item
I have WPF ListBox which is bound to a ObservableCollection, when the collection changes,
I have a WPF form with a ListBox of items bound to a method
I have a listbox on an HTML form with a Submit button. The listbox
I have a ListBox that has a style defined for ListBoxItems. Inside this style,
I have a listbox that is databound to a Collection of objects. The listbox
I have a listbox where the items contain checkboxes: <ListBox Style={StaticResource CheckBoxListStyle} Name=EditListBox> <ListBox.ItemTemplate>
I have a ListBox which displays items of variable height. I want to show
I have a ListBox with a bunch of images in it (done through a

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.