private SelectableItem CreateSelectable(object newItem) { var selectableItem = new SelectableItem(newItem) { ItemTemplate = ItemTemplate, SelectedItemTemplate = SelectedItemTemplate }; selectableItem.Selected += ItemSelected; return(selectableItem); }
private void ItemSelected(object sender, object e) { if (_lastSelected != null) { _lastSelected.IsSelected = false; } _lastSelected = (SelectableItem)sender; if (SelectedItem != e) { SelectedItem = e; } }
private void OnItemSourceChanged(IList enumerable) { Selectables = new AsyncObservableCollection <SelectableItem <object> >(enumerable.Count); foreach (var item in enumerable) { if (displatProperty == null) { displatProperty = item.GetType().GetProperty(DisplayMemberPath); } if (displatProperty != null) { var selectable = SelectableItem <object> .Create(item); selectable.Title = GetTitle(item); selectable.SelectChanged += SelectableSelectChanged; Selectables.Add(selectable); } } }