public ItemControl(ItemPrototypeModel model, List <Affix> affixes, ItemBase itemBase) { Model = model; Condition = new ConditionControl(model.Condition, itemBase, affixes); OnPropertyChanged(nameof(Condition)); DataContext = this; InitializeComponent(); }
public void Initialize(List <Affix> affixes, ItemBase itemBase, BaseInfomation baseInfo) { if (_baseInfo == null || !_baseInfo.Equals(baseInfo)) { _itemBase = itemBase; _affixes = affixes; _baseInfo = baseInfo; SelectedItem = new ItemPrototypeModel(); ItemPrototypes.Clear(); ItemControl = null; AddItem(); SelectedItem = ItemPrototypes[0]; OnPropertyChanged(nameof(SelectedItem)); } }
private void AddItem() { var index = GetNextIndex(); ItemPrototypeModel prototypeModel = new ItemPrototypeModel { Condition = new CraftingCondition(), ItemName = "Item " + index, Value = 0, Index = index }; ItemPrototypes.Add(prototypeModel); SelectedItem = prototypeModel; UpdateSelectedItem(); OnPropertyChanged(nameof(SelectedItem)); OnPropertyChanged(nameof(ItemControl)); OnPropertyChanged(nameof(ItemPrototypes)); }