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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:15:45+00:00 2026-06-18T03:15:45+00:00

I have a ComboBox: <ComboBox x:Name=cbConnection ItemsSource={Binding Source={StaticResource XmlConnectionList}, XPath=//ComboItem} DisplayMemberPath=Key SelectedValuePath=Value SelectedValue={Binding Path=ConnectionString,ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}

  • 0

I have a ComboBox:

<ComboBox x:Name="cbConnection"
                      ItemsSource="{Binding Source={StaticResource XmlConnectionList}, XPath=//ComboItem}"
                      DisplayMemberPath="Key"
                      SelectedValuePath="Value"
                      SelectedValue="{Binding Path=ConnectionString,ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}" 
                      Margin="{StaticResource ConsistentMargins}"
                      Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}" Width="120"
                      LostFocus="{Binding Path=cbConnection_LostFocus}"/>

I am trying to get the LostFocus event handler moved to the ViewModel because I do some error handling within the setter for the SelectedValue binding “ConnectionString” found in the ViewModel. I want this to happen if a user reselects the same ComboBoxItem, which does fire OnPropertyChanged unless a different list item is selected.

The above binding results in error

A ‘Binding’ cannot be set on the ‘AddLostFocusHandler’ property of
type ‘ComboBox’. A ‘Binding’ can only be set on a DependencyProperty
of a DependencyObject.

How can I fire repeatable code within the ViewModel on selection of any item within a ComboBox, regardless of the user’s selection?

  • 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-06-18T03:15:47+00:00Added an answer on June 18, 2026 at 3:15 am

    You’ll need to include a reference to the System.Windows.Interactivity dll, but it will look something like this:

    xmlns:b="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"  
    <ComboBox>
    <b:Interaction.Triggers>
        <b:EventTrigger EventName="LostFocus">
        <b:InvokeCommandAction  Command="{Binding cbConnection_LostFocus}" CommandParameter="{Binding}"/>
         </b:EventTrigger>
     </b:Interaction.Triggers>
    </ComboBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In XAML I have a combobox defined as: <ComboBox x:Name=UsernameComboBox ItemsSource={Binding Users} DisplayMemberPath=Username SelectedItem={Binding
I have a ComboBox: <ComboBox Name=Gen2Fis ItemsSource={Binding Path=Table} SelectionChanged=Gen2Fis_SelectionChanged DisplayMemberPath=LongName> The query used to
I have a combobox in WPF like this: <ComboBox Text=Select Language... IsEditable=True IsReadOnly=True ItemsSource={Binding
How to bind type Dictionary to Kendo Combobox? @(Html.Kendo().ComboBox() .Name(Division) .DataTextField(Key) .DataValueField(Value) .BindTo(Model.Filter.DivisionList) )
I have a combobox that has the entries of a full name, eg: John
At the moment I have a combobox that is populated from the name fields
i have combobox in datagrid (sourse in mysql (web)) how i can get value
I have a combobox whose value I want to use with a SQL WHERE
I Have a combobox with ItemsSource bound to an ObservableCollection. A RadioButton allows the
I have a combobox that is binding to an ObservableCollection of strings in an

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.