none
Need help on System.Windows.Data Error 40 :: Binding Expression path error

    Question

  • Hello All,

    I have a view model which exposes a observablecollection of certain entities which I try to bind to the combobox.

    But unfortuntaly the data gets bound, but when I click the combo box in order to scroll through the different entiteis,
    I get an error message saying, System.Window.Data Error 40 ::: BindingExpressionPath error - "IsSelected property not found on object XYZee "  BindingExpression:Path=IsSelected DataItem = 'XYZee' target element is combobox "

     

    Can someone help me on how to resolve this error.  one line comes for each entry in combobox when I try to open the same.

    Thanks in advance.

     

    Is writing a wrapper as olution to this??  But I surely do not want to write a wrapper :) is there any way out ??
    Friday, June 24, 2011 9:08 AM

All replies

  • Hi,

    Would you provide some code snippet of your combobox? Which property of combobox did you bind to? And what is your datatemplate/itemtemplate? 

    Maybe to perform the binding throught Expression Blend will solve your problem.

    By the way, there are some links might be helpful to you:

    WPF Apps With The Model-View-ViewModel Design Pattern

    How do I set up a ComboBox with MVVM?

    Binding WPF ComboBox to a Custom List

    Binding Combo Boxes in WPF with MVVM

     

    May this information is helpful to you.


    Ouch Liu
    Welcome to visit by blog: Ouch@點部落
    Welcome to join the Designer x Developer group on Facebook: Facebook 設計x程式 社團
    Friday, June 24, 2011 10:16 AM
  • hello

    class Customer

        CustomerName

        CustomerID

    class ViewModel

        ObservableCollection<Customer> Customers

    <ComboBox ItemsSource="{Binding Path=Customers" DisplayMamberPath = "CustomerName"/>

      I have removed   all the SelectedValue and SelectedValuePath property from the combobox. but even for displaying a simple customer I get the error in output window..

     

    Thanks for your help

    Friday, June 24, 2011 10:32 AM
  • Hi,

    Would you please provide more information about this problem, or upload your application source code somewhere?

    It's a bit hard to me to indicate where the problem is with the information you give.


    Ouch Liu
    Welcome to visit by blog: Ouch@點部落
    Welcome to join the Designer x Developer group on Facebook: Facebook 設計x程式 社團
    Monday, June 27, 2011 9:00 AM
  • Hi SandepKU,

    One thing you may consider is:

    System.Window.Data Error 40 ::: BindingExpressionPath error - "IsSelected property not found on object XYZee "  BindingExpression:Path=IsSelected DataItem = 'XYZee' target element is combobox "

    This Binding error in Output Window also could be caused by the DataBinding which didn't get bound to target items in time. For example, if you take advantage of virtualizingstackpanel, the items out of view will fail to data binding and the error info get displayed on Output Window.

    If this is the case, you could ignore them 'cause they do no harm.

    But maybe some more details could bring a better view of this problem for us.

    Thank you!

     


    Yves Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, June 28, 2011 5:57 AM
    Moderator
  • Any updates?
    Yves Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 05, 2011 5:10 AM
    Moderator