コード例 #1
0
            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);
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            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);
            }
コード例 #4
0
            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);
            }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
 public bool Remove(CheckedListBoxItem item)
 {
     RemoveAt(IndexOfItem(item));
     return(true);
 }
コード例 #7
0
 public bool Contains(CheckedListBoxItem item)
 {
     return(SelectedItems().Any(innerItem => innerItem == item));
 }
コード例 #8
0
 public void Insert(int index, CheckedListBoxItem item)
 {
     _viewModel.Items.Insert(index, item);
 }