public void Add(object item, bool check) { CheckedListBoxItem newItem = _viewModel.Container.Resolve <CheckedListBoxItem>(); newItem.Text = item.ToString(); newItem.Value = item; newItem.Checked = check; _viewModel.AddItem(newItem); }
public void Insert(int index, string item) { CheckedListBoxItem newItem = _viewModel.Container.Resolve <CheckedListBoxItem>(); newItem.Text = item; newItem.Value = item; newItem.Checked = false; _viewModel.Items.Insert(index, newItem); }
public void Add(object item, CheckState checkState) { var check = (checkState == CheckState.Checked) ? true : false; CheckedListBoxItem newItem = _viewModel.Container.Resolve <CheckedListBoxItem>(); newItem.Text = item.ToString(); newItem.Value = item; newItem.Checked = check; _viewModel.AddItem(newItem); }
private int IndexOfItem(CheckedListBoxItem item) { int innerIndex = -1; for (int i = 0; i < _viewModel.Items.Count; i++) { if (item == _viewModel.Items[i]) { innerIndex = i; } } return(innerIndex); }
public void Add(Object item) { if (item is CheckedListBoxItem) { CheckedListBoxItem value = ((CheckedListBoxItem)item); CheckedListBoxItem newItem = _viewModel.Container.Resolve <CheckedListBoxItem>(); newItem.Text = value.Text; newItem.Value = value.Value; newItem.Checked = value.Checked; _viewModel.AddItem(newItem); } else { CheckedListBoxItem newItem = _viewModel.Container.Resolve <CheckedListBoxItem>(); newItem.Text = item.ToString(); newItem.Value = item; _viewModel.AddItem(newItem); } }
public bool Remove(CheckedListBoxItem item) { RemoveAt(IndexOfItem(item)); return(true); }
public bool Contains(CheckedListBoxItem item) { return(SelectedItems().Any(innerItem => innerItem == item)); }
public void Insert(int index, CheckedListBoxItem item) { _viewModel.Items.Insert(index, item); }