Files
laatzen/Common/OmniPlus/InspectionUI/Plugins/ItemsGridRowVM.cs
T

97 lines
2.2 KiB
C#

namespace InspectionUI
{
using InspectionUI.Abstraction.Interfaces;
using System.Collections;
using System.Collections.Generic;
public class ItemsGridRowVM : VM, IGridRow, IEnumerable<ItemsGridCellVM>
{
private readonly IList<ItemsGridCellVM> cells;
public ItemsGridRowVM() : base()
=> this.cells = new List<ItemsGridCellVM>();
public IGridCellCheckbox AddCheckbox()
{
var checkbox = new ItemsGridCellCheckboxVM();
this.cells.Add(checkbox);
return checkbox;
}
public IGridCellCommand AddCommand()
{
var command = new ItemsGridCellCommandVM();
this.cells.Add(command);
return command;
}
public IGridCellDropdown AddDropdown()
{
var dropdown = new ItemsGridCellDropdownVM();
this.cells.Add(dropdown);
return dropdown;
}
public IGridCell AddHeader()
{
var header = new ItemsGridCellHeaderVM();
this.cells.Add(header);
return header;
}
public IGridCell AddTextBlock()
{
var textBlock = new ItemsGridCellVM();
this.cells.Add(textBlock);
return textBlock;
}
public IGridCellInput AddTextBox()
{
var textBox = new ItemsGridCellInputVM();
this.cells.Add(textBox);
return textBox;
}
public IEnumerator<ItemsGridCellVM> GetEnumerator()
=> this.cells.GetEnumerator();
public IGridCell ReplaceWithTextBlock(System.Int32 index)
{
var textBlock = new ItemsGridCellVM();
this.cells[index] = textBlock;
this.NotifyPropertyChanged();
return textBlock;
}
public IGridCellInput ReplaceWithTextBox(int index)
{
var textBox = new ItemsGridCellInputVM();
this.cells[index] = textBox;
this.NotifyPropertyChanged();
return textBox;
}
IEnumerator IEnumerable.GetEnumerator()
=> this.GetEnumerator();
}
}