예제 #1
0
        private SelectableItem CreateSelectable(object newItem)
        {
            var selectableItem = new SelectableItem(newItem)
            {
                ItemTemplate         = ItemTemplate,
                SelectedItemTemplate = SelectedItemTemplate
            };

            selectableItem.Selected += ItemSelected;
            return(selectableItem);
        }
예제 #2
0
        private void ItemSelected(object sender, object e)
        {
            if (_lastSelected != null)
            {
                _lastSelected.IsSelected = false;
            }

            _lastSelected = (SelectableItem)sender;

            if (SelectedItem != e)
            {
                SelectedItem = e;
            }
        }
예제 #3
0
        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);
                }
            }
        }