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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:01:38+00:00 2026-05-23T01:01:38+00:00

I have a comboBox that has a datatrigger that set its SelectedIndex based on

  • 0

I have a comboBox that has a datatrigger that set its SelectedIndex based on a .NET Property’s value that in the VM. My problem is that I can’t get the setter to set the Selected Index.

The ItemSource is based on a enum array.
The DataContext of the Window is the VM which has the Modulation, and Bandwidth properties.

I’m new to WPF so I’m sure I’m not understanding binding correctly, but I’m pulling my hair out! Thanks for your help in advance.

Here’s the Style.

    <Style x:Key="BWCombBoxStyle" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip"
                        Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                        Path=(Validation.Errors).CurrentItem.ErrorContent}"/>
            </Trigger>
            <DataTrigger 
                Binding="{Binding Modulation}" Value="P25">
                <Setter Property="SelectedIndex" Value="2"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

Here’s the ComboBox:

   <ComboBox Name="bandwidth" 
             Height="Auto" Width="70"
             Style="{StaticResource BWCombBoxStyle}"
             ItemsSource="{Binding BandwidthOptions, Mode=OneWay, ValidatesOnDataErrors=true, NotifyOnValidationError=true, UpdateSourceTrigger=PropertyChanged}"
             SelectedValue="{Binding IFBandwidth, Mode=TwoWay, ValidatesOnDataErrors=True, 
             NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}"/>

Here are the .Net Properties in my VM:

    public TMod Modulation
    {
        get { return modulation_; }
        set { modulation_ = value; NotifyPropertyChanged("Modulation"); }
    }

    public Channel.TBnd IFBandwidth
    {
        get { return chan_.IFBandwidth; }
        set
        {
            chan_.IFBandwidth = value; 
            NotifyPropertyChanged("IFBandwidth"); 
        }
    }

    public Channel.TBnd[] BandwidthOptions
    {
        get
        {
            return (Channel.TBnd[])System.Enum.GetValues(typeof(Channel.TBnd));
        }
    }

Here are the enums:

    public enum TMod
    {
        FM = 0,
        AM = 1,
        P25 = 2,
        TRK = 3
    }

    public enum TBnd
    {
        Std = 0,
        Nar = 1,
        Wide = 2,
        XWide = 3
    }
  • 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-23T01:01:39+00:00Added an answer on May 23, 2026 at 1:01 am

    Change your ComboBox binding to use SelectedValue instead of SelectedPath. That will properly set the IFBandwidth view model property when the value is changed.

    What exactly is the trigger going to be used for? It may be a better option to change your Modulation property to be something like this…

    public TMod Modulation
    {
        get { return modulation_; }
        set
        {
            modulation_ = value; 
            NotifyPropertyChanged("Modulation");
    
            if( modulation == TMod.P25 )
            {
                IFBandwith = TBand.Wide;
            }
        }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C#, say you have a ComboBox that has a DropDownStyle set to DropDown
I have created a custom combobox that has a LABEL property so when we
I have a ComboBox that has its ItemsSource bound to a static List<CustomSettings> of
I have a combobox which has ItemsSource set to an ObservableCollection property called DATA
I have a listview with a DataTemplate that has a ComboBox. I want the
I have a ComboBox that I set up like this: this.cmbCustomerJob.DisplayMember = display; this.cmbCustomerJob.AutoCompleteMode
I have a combobox that has the entries of a full name, eg: John
I have a ComboBox that has the SelectedItem bound to the ViewModel. <ComboBox SelectedItem={Binding
I have a ComboBox that has an associated ErrorProvider in the user control it
If I have a ComboBox that has a SelectionChanged event, it fires when I'm

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.