Open DheerajSaravagi opened 8 years ago
It's warning you because your EventBinding
is most likely incorrect.
I would recommend against using SelectionChanged
altogether.
Since you already have a two-way binding for the selection, you could watch the change in your view model.
class VendorSearchViewModel ... {
...
OnPropertyChanged(propertyName: string) {
super.OnPropertyChanged(propertyName);
if (propertyName === "SelectedValue") {
//changed code
}
}
}
If you are still sold on using EventBinding
, try changing to this:
(Remove the RelayCommand)
OnSelectedValueChanged(e: Fayde.IEventBindingArgs<Fayde.Controls.Primitives.SelectionChangedEventArgs >) {
var value = e.args.NewValues[0];
if (!value)
return;
var ParentObject = this.Criteria.GetValueAt(0);
ParentObject.SelectedValue = value;
if (value.Description == "Section" || value.Description == "AnswerStatus")
ParentObject.Criteria = value.Key;
else
ParentObject.Criteria = value.Description;
}
SelectionChanged="{EventBinding Command={Binding DataContext.OnSelectedValueChanged, RelativeSource={RelativeSource ItemsControlParent}}, CommandParameter="{Binding}}"
We have used EventBinding so many places for many controls. This issue occurs only when we create new MVVM class object and assign to ContentControl for Page Navigation purpose. On page initialization stage it shows warning message in console.
If we use only SelectionChanged={EventBinding functionName}
then also it show warning message in above scenario. However this event and page functionality works fine once page is loaded.
It is possible that your DataContext may be swapping and causing the SelectedValue
to change. During the DataContext swap, the EventBinding
won't be able to find the callback as it is reporting.
I wanted to warn the developer rather than have the developer confused why the event binding wasn't working.
This is why I recommend against using SelectionChanged
. I built it to be compatible, but in your case, there is no reason to use it.
while using combo box selection change event its working fine but showing warning in console
[EVENTBINDING]: Could not find command target for event 'SelectionChanged'
below code is for reference