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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:47:34+00:00 2026-05-23T08:47:34+00:00

in my ListBox , I have 5 numbers 1 – 5 , SelectedItem is

  • 0

in my ListBox , I have 5 numbers 1 – 5 , SelectedItem is databind in TwoWay Mode to SelectedAmount , an int property which has a default value of 1 , whenever I run the Application I have 1 as value selected and highlighted on my ListBox, thats very good but now whenever I change the value to 2 or any other value , the ListBox shows the new value but it is not highlighted , and the SelectedAmount is still holding the old value , that is obviously bad , I want whenever the user changes the selected value, SelectedAmount to get the new value directly , the user now after he made his selection,had to click again to highlight it. any ideas ?

<ListBox ItemsSource="{Binding SiliconAmounts}" SelectedItem="{Binding SiliconAmount,Mode=TwoWay}" Height="31" HorizontalAlignment="Left" Margin="83,148,0,0" VerticalAlignment="Top" Width="149" IsTabStop="True" TabIndex="4" />

my property databind to selectedItem looks like

public int SiliconAmount
    {
        get
        {
            return _SiliconAmount;
        }
        set
        {
            if (_SiliconAmount != value)
            {
                _SiliconAmount =value;
                OnPropertyChanged("SiliconAmount");
            }
        }
    }

my items property looks like

public ObservableCollection<int> SiliconAmounts
    {
        get { return _SiliconAmounts; }
        set
        {
            if (_SiliconAmounts != value)
            {
                _SiliconAmounts = value;
                OnPropertyChanged("SiliconAmounts");
            }
        }
    }

on my viewModel constructor

SiliconAmounts = new ObservableCollection<int>();
        SiliconAmounts.Add(1);
        SiliconAmounts.Add(2);
        SiliconAmounts.Add(3);
        SiliconAmounts.Add(4);
        SiliconAmounts.Add(5);

thanks in advance

  • 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-23T08:47:35+00:00Added an answer on May 23, 2026 at 8:47 am

    After posting and reading the comments, it sounds like the problem is UI styling. I have found that Expression Blend is a helpful tool for writing styles and templates on controls. I tend to like to code direct XAML quite a bit, but Expression has an editor for this and some nice tools for setting up visual states, visual triggers, selecting colors, and more. You can get a trial of Blend here. Another tool a lot of WPF developers use is Kaxaml.

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

Sidebar

Related Questions

I have a ListBox that has a style defined for ListBoxItems. Inside this style,
I have a ListBox which displays items of variable height. I want to show
I have implemented my own usercontrol based on listboxes. It has a dependency property
I am tring to have the selected number showing on the listbox as default.
I have a ListBox that each of its items has a button, I set
I have simple SL user control. A listbox which shows all customers and on
I have a Silverlight 2.0 listbox which reads in data from a custom list
I have a listbox to which I have bound the data context to an
This only occurs in Internet Explorer. I have a ListBox which is in an
Surely, this shouldn't be so hard? I have a <select> , which has, of

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.