Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
990
XamComboEditor AllowMultipleSelection SelectedItems
posted

Hi team,

this is very cool control, but I am for some reason unable to bind SelectedItems to my VM.

<ig:XamComboEditor EmptyText="Select Region..." IsEnabled="{Binding ElementName=_regionSearch, Path=IsChecked}" Grid.Column="1" SelectedItem="{Binding SelectedRegions, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged}" IsEditable="False" CheckBoxVisibility="Visible" AllowMultipleSelection="True" ItemsSource="{Binding Regions}"/>

VM

public ObservableCollection<IdentifierDetail> SelectedRegions{

get { return _selectedRegions; }

set {

if (_selectedRegions == null

)

_selectedRegions = new ObservableCollection<IdentifierDetail>();

_selectedRegions = value;

OnPropertyChanged("SelectedRegions");

}}

  public class IdentifierDetail
  {
    private string idField;
    private string nameField;

    public string Id
    {
      get
      {
        return this.idField;
      }
      set
      {
        this.idField = value;
      }
    }

    public string Name
    {
      get
      {
        return this.nameField;
      }
      set
      {
        this.nameField = value;
      }
    }

    public override string ToString()
    {
      if (!string.IsNullOrEmpty(Name))
        return Name;
      return string.Empty;
    }

    public override int GetHashCode()
    {
      return ToString().GetHashCode();
    }

    public override bool Equals(object obj)
    {
      IdentifierDetail other = (obj as IdentifierDetail);
      if (other != null && other.Id != null && other.Name != null)
      {
        return Id.Equals(other.Id) && Name.Equals(other.Name);
      }
      return false;
    }


  }

Please help me.

 

thanks

 

Parents Reply Children
No Data