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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:18:55+00:00 2026-05-17T02:18:55+00:00

I am creating an application using the MVVM pattern and somewhere I have a

  • 0

I am creating an application using the MVVM pattern and somewhere I have a view which contains a ComboBox.

<Controls:SettingsComboBox x:Name="Setting"
    SelectedIndex="{Binding SteeringIndex, Mode=TwoWay}"
    IsEnabled="{Binding SteerAttached, Mode=TwoWay}">
    <ComboBoxItem Content="{Binding Path=on, Source={x:Static Localization:CultureResources.ObjectDataProvider}}"/>
    <ComboBoxItem Content="{Binding Path=off, Source={x:Static Localization:CultureResources.ObjectDataProvider}}"/>
</Controls:SettingsComboBox>

So the SelectedIndex and IsEnabled are bound to the view model which retrieves the values from a settings file or gets it from an external event.

If SelectedIndex is 0 (on) and IsEnabled is set to false, everything is OK. If SelectedIndex is 1 (off) and IsEnabled is set to false the SelectedIndex is somehow set to -1, thus resulting in an empty combo box.

Why does this happen and how can I work around it? I can set the SelectedIndex back when I receive the event to change the IsEnabled property, but that still leaves and empty combobox when it’s disabled so that doesn’t really qualify as a solution.

  • 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-17T02:18:56+00:00Added an answer on May 17, 2026 at 2:18 am

    Setting IsEnabled on a combobox does not change its SelectedIndex property. Something in your code (not shown here) is doing that, probably your VM. Question, why did you do twoway binding for IsEnabled? Do you really want to update SteerAttached whenever IsEnabled on the combobox changes?

    Below code lets you play around with enabling/disabling a combobox and changing selected index. As you can see these properties works independent of each other.

    <ComboBox
        SelectedIndex="{Binding Path=Value, ElementName=_slider, Mode=TwoWay}" 
        IsEnabled="{Binding IsChecked, ElementName=_checkBox}">
        <ComboBoxItem>AAA</ComboBoxItem>
        <ComboBoxItem>BBB</ComboBoxItem>
        <ComboBoxItem>CCC</ComboBoxItem>
    </ComboBox>
    
    <Slider Name="_slider" IsSnapToTickEnabled="True" TickFrequency="1" Minimum="0" Maximum="2" Width="30"/>
    
    <CheckBox Name="_checkBox" />
    

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

Sidebar

Related Questions

I have an application I am creating in WPF, using MVVM pattern. In this
Using the MVVM pattern creating WPF applications you have the ViewModel providing data to
I am creating an application using WPF which is using Prism framework. I have
I'm creating a WPF application using the MVVM design pattern that consists of a
I'm creating a Silverlight 3.0 MVVM application using Silverlight.FX but my View is actually
I am creating a page-based WPF application using MVVM. I have created a custom
I'm creating a WPF application using the MVVM design pattern, and I'm trying to
I'm creating an application using WPF, MVVM and LINQ to SQL. I have a
I try to rewrite my Application using the MVVM pattern. I have a window
I creating a web application using JSF,Hibernate,Spring. I have added a filter for checking

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.