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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:49:08+00:00 2026-05-24T18:49:08+00:00

I have a ComboBox that uses a ObservableCollection as the source. I have the

  • 0

I have a ComboBox that uses a ObservableCollection as the source. I have the source bound as follows

<ComboBox IsEditable="False"
          SelectedIndex="{Binding Source={x:Static Properties:CollectionControl.Settings}, Path=SamplingPeriodIndex, Mode=TwoWay}"
          SelectionChanged="onPeriodControlSelectionChanged"
          Name="PeriodControl"
          ItemsSource="{StaticResource test}">
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding SamplingPeriod}" Visibility="{Binding Converter={StaticResource TrackVis}, ConverterParameter=GroupIndex}"/>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

TrackVis is a converter that determines if the element is visible or collapsed depending on an external property which has INotifyPropertyChanged implemented.

Everything works as expected the first time the ComboBox is displayed, but the ComboBox is never refreshed to reflect changes. I must be missing something, but as of now everything I have tried fails.

Here is the code for the converter

public class IsVisibleConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, 
        System.Globalization.CultureInfo culture)
    {
        var tempObj = (SamplingPeriods) value;
        if (tempObj.GroupIndex >= CollectionControl.Settings.SamplingFrequencyIndex)
        {
            return Visibility.Visible;
        }

        return Visibility.Collapsed;
    }

    public object ConvertBack(object value, Type targetType, object parameter, 
        System.Globalization.CultureInfo culture)
    {
            throw new NotImplementedException();
    }
}

Also, here is the collection

public class PeriodsCollection : ObservableCollection<SamplingPeriods>
{
    public PeriodsCollection()
    {
        Add(new SamplingPeriods("1/16 of a second", 13));
        Add(new SamplingPeriods("1/8 of a second", 12));
        Add(new SamplingPeriods("1/4 of a second", 11));
        Add(new SamplingPeriods("1/2 of a second", 10));
        Add(new SamplingPeriods("1 second", 9));
        Add(new SamplingPeriods("2 seconds", 8));
        Add(new SamplingPeriods("4 seconds", 7));
        Add(new SamplingPeriods("8 seconds", 6));
        Add(new SamplingPeriods("16 seconds", 5));
        Add(new SamplingPeriods("32 seconds", 4));
        Add(new SamplingPeriods("64 seconds", 3));
        Add(new SamplingPeriods("128 seconds", 2));
        Add(new SamplingPeriods("256 seconds", 1));
        Add(new SamplingPeriods("512 seconds", 0));
    }
}

public class SamplingPeriods
{
    public SamplingPeriods(string samplingPeriod, int groupIndex)
    {
        SamplingPeriod = samplingPeriod;
        GroupIndex = groupIndex;
    }

    public string SamplingPeriod { get; private set; }
    public int GroupIndex { get; private set; }
}

The idea is that the selected sampling frequency limits the sampling periods that are available. The sampling frequency index ranges from 0 to 11. For example, if the sampling index is 9 the only valid sampling periods would have a GroupIndex >=
9. The other sampling periods would be collapsed.

  • 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-24T18:49:09+00:00Added an answer on May 24, 2026 at 6:49 pm

    You are trying to track samplingfrequency index. then you must bind to an object that have such property and implements INotifyPropertyChanged.Or, as I have already said, propagate this event to the object that is your binding source, and raise correct propertychanged on it. Otherwise, binding engine would know nothing of the changes of that property.
    Bind to the CollectionControl.Settings with a Path = SamplingFrequencyIndex

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

Sidebar

Related Questions

I have a ComboBox that has the SelectedItem bound to the ViewModel. <ComboBox SelectedItem={Binding
I have a ComboBox that uses a DataTemplate . The DataTemplate contains a binding
I have a ComboBox that is bound to an ObservableCollection of custom UserControls. Each
I have a ComboBox that has its ItemSource and SelectedItem properties bound to a
I have a ComboBox that has its ItemsSource bound to a static List<CustomSettings> of
I have this issue with ComboBox that uses IEnumerable<Brush> as ItemsSource; the problem lies
I have a combobox that I have Enabled = false. When that is the
I have a comboBox that has a datatrigger that set its SelectedIndex based on
I have a form in C# that uses a ComboBox . How do I
I have a WTL application that uses an extended combobox control (the Win32 class

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.