private void AddItem(object item, int index = -1) { index = index < 0 ? _stack.Children.Count : index; var control = new IndicatorItem { SelectedForeground = SelectedForeground, Foreground = Foreground, Background = Background, Style = this.ItemContainerStyle, ContentTemplate = this.ItemTemplate, Content = item }; _stack.Children.Insert(index, control); PlugControl(control); }
private void UnplugControl(IndicatorItem control) { control.IsSelectedChanged -= OnSelectedItemChanged; }